emptyiterator.inc 982 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /** @file emptyiterator.inc
  3. * @ingroup SPL
  4. * @brief class EmptyIterator
  5. * @author Marcus Boerger
  6. * @date 2003 - 2009
  7. *
  8. * SPL - Standard PHP Library
  9. */
  10. /** @ingroup SPL
  11. * @brief An empty Iterator
  12. * @author Marcus Boerger
  13. * @version 1.0
  14. * @since PHP 5.1
  15. */
  16. class EmptyIterator implements Iterator
  17. {
  18. /** No operation.
  19. * @return void
  20. */
  21. function rewind()
  22. {
  23. // nothing to do
  24. }
  25. /** @return \c false
  26. */
  27. function valid()
  28. {
  29. return false;
  30. }
  31. /** This function must not be called. It throws an exception upon access.
  32. * @throw Exception
  33. * @return void
  34. */
  35. function current()
  36. {
  37. throw new Exception('Accessing the value of an EmptyIterator');
  38. }
  39. /** This function must not be called. It throws an exception upon access.
  40. * @throw Exception
  41. * @return void
  42. */
  43. function key()
  44. {
  45. throw new Exception('Accessing the key of an EmptyIterator');
  46. }
  47. /** No operation.
  48. * @return void
  49. */
  50. function next()
  51. {
  52. // nothing to do
  53. }
  54. }
  55. ?>