NodeInterface.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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\Config\Definition;
  11. /**
  12. * Common Interface among all nodes.
  13. *
  14. * In most cases, it is better to inherit from BaseNode instead of implementing
  15. * this interface yourself.
  16. *
  17. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  18. */
  19. interface NodeInterface
  20. {
  21. /**
  22. * Returns the name of the node.
  23. *
  24. * @return string The name of the node
  25. */
  26. public function getName();
  27. /**
  28. * Returns the path of the node.
  29. *
  30. * @return string The node path
  31. */
  32. public function getPath();
  33. /**
  34. * Returns true when the node is required.
  35. *
  36. * @return Boolean If the node is required
  37. */
  38. public function isRequired();
  39. /**
  40. * Returns true when the node has a default value.
  41. *
  42. * @return Boolean If the node has a default value
  43. */
  44. public function hasDefaultValue();
  45. /**
  46. * Returns the default value of the node.
  47. *
  48. * @return mixed The default value
  49. * @throws \RuntimeException if the node has no default value
  50. */
  51. public function getDefaultValue();
  52. /**
  53. * Normalizes the supplied value.
  54. *
  55. * @param mixed $value The value to normalize
  56. *
  57. * @return mixed The normalized value
  58. */
  59. public function normalize($value);
  60. /**
  61. * Merges two values together.
  62. *
  63. * @param mixed $leftSide
  64. * @param mixed $rightSide
  65. *
  66. * @return mixed The merged values
  67. */
  68. public function merge($leftSide, $rightSide);
  69. /**
  70. * Finalizes a value.
  71. *
  72. * @param mixed $value The value to finalize
  73. *
  74. * @return mixed The finalized value
  75. */
  76. public function finalize($value);
  77. }