FormExtensionInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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\Form;
  11. /**
  12. * Interface for extensions which provide types, type extensions and a guesser.
  13. */
  14. interface FormExtensionInterface
  15. {
  16. /**
  17. * Returns a type by name.
  18. *
  19. * @param string $name The name of the type
  20. *
  21. * @return FormTypeInterface The type
  22. *
  23. * @throws Exception\InvalidArgumentException if the given type is not supported by this extension
  24. */
  25. public function getType($name);
  26. /**
  27. * Returns whether the given type is supported.
  28. *
  29. * @param string $name The name of the type
  30. *
  31. * @return bool Whether the type is supported by this extension
  32. */
  33. public function hasType($name);
  34. /**
  35. * Returns the extensions for the given type.
  36. *
  37. * @param string $name The name of the type
  38. *
  39. * @return FormTypeExtensionInterface[] An array of extensions as FormTypeExtensionInterface instances
  40. */
  41. public function getTypeExtensions($name);
  42. /**
  43. * Returns whether this extension provides type extensions for the given type.
  44. *
  45. * @param string $name The name of the type
  46. *
  47. * @return bool Whether the given type has extensions
  48. */
  49. public function hasTypeExtensions($name);
  50. /**
  51. * Returns the type guesser provided by this extension.
  52. *
  53. * @return FormTypeGuesserInterface|null The type guesser
  54. */
  55. public function getTypeGuesser();
  56. }