NodeInterface.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 bool If the node is required
  37. */
  38. public function isRequired();
  39. /**
  40. * Returns true when the node has a default value.
  41. *
  42. * @return bool 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. *
  50. * @throws \RuntimeException if the node has no default value
  51. */
  52. public function getDefaultValue();
  53. /**
  54. * Normalizes the supplied value.
  55. *
  56. * @param mixed $value The value to normalize
  57. *
  58. * @return mixed The normalized value
  59. */
  60. public function normalize($value);
  61. /**
  62. * Merges two values together.
  63. *
  64. * @param mixed $leftSide
  65. * @param mixed $rightSide
  66. *
  67. * @return mixed The merged values
  68. */
  69. public function merge($leftSide, $rightSide);
  70. /**
  71. * Finalizes a value.
  72. *
  73. * @param mixed $value The value to finalize
  74. *
  75. * @return mixed The finalized value
  76. */
  77. public function finalize($value);
  78. }