DefinitionSourceInterface.php 899 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Di\Definition;
  12. use Hyperf\Di\Exception\InvalidDefinitionException;
  13. interface DefinitionSourceInterface
  14. {
  15. /**
  16. * Returns the DI definition for the entry name.
  17. *
  18. * @throws InvalidDefinitionException an invalid definition was found
  19. * @return null|DefinitionInterface
  20. */
  21. public function getDefinition(string $name);
  22. /**
  23. * @return array definitions indexed by their name
  24. */
  25. public function getDefinitions(): array;
  26. /**
  27. * @param mixed $definition
  28. * @return $this
  29. */
  30. public function addDefinition(string $name, $definition);
  31. public function clearDefinitions(): void;
  32. }