TraversalStrategy.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Mapping;
  11. /**
  12. * Specifies whether and how a traversable object should be traversed.
  13. *
  14. * If the node traverser traverses a node whose value is an instance of
  15. * {@link \Traversable}, and if that node is either a class node or if
  16. * cascading is enabled, then the node's traversal strategy will be checked.
  17. * Depending on the requested traversal strategy, the node traverser will
  18. * iterate over the object and cascade each object or collection returned by
  19. * the iterator.
  20. *
  21. * The traversal strategy is ignored for arrays. Arrays are always iterated.
  22. *
  23. * @author Bernhard Schussek <bschussek@gmail.com>
  24. *
  25. * @see CascadingStrategy
  26. */
  27. class TraversalStrategy
  28. {
  29. /**
  30. * Specifies that a node's value should be iterated only if it is an
  31. * instance of {@link \Traversable}.
  32. */
  33. public const IMPLICIT = 1;
  34. /**
  35. * Specifies that a node's value should never be iterated.
  36. */
  37. public const NONE = 2;
  38. /**
  39. * Specifies that a node's value should always be iterated. If the value is
  40. * not an instance of {@link \Traversable}, an exception should be thrown.
  41. */
  42. public const TRAVERSE = 4;
  43. /**
  44. * Not instantiable.
  45. */
  46. private function __construct()
  47. {
  48. }
  49. }