Attribute
2 years ago
Test
1 month ago
ResetInterface.php
2 years ago
ServiceLocatorTrait.php
1 month ago
ServiceProviderInterface.php
2 years ago
ServiceSubscriberInterface.php
1 month ago
ServiceSubscriberTrait.php
1 month ago
ServiceSubscriberInterface.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace IAWPSCOPED\Symfony\Contracts\Service; |
| 12 | |
| 13 | /** |
| 14 | * A ServiceSubscriber exposes its dependencies via the static {@link getSubscribedServices} method. |
| 15 | * |
| 16 | * The getSubscribedServices method returns an array of service types required by such instances, |
| 17 | * optionally keyed by the service names used internally. Service types that start with an interrogation |
| 18 | * mark "?" are optional, while the other ones are mandatory service dependencies. |
| 19 | * |
| 20 | * The injected service locators SHOULD NOT allow access to any other services not specified by the method. |
| 21 | * |
| 22 | * It is expected that ServiceSubscriber instances consume PSR-11-based service locators internally. |
| 23 | * This interface does not dictate any injection method for these service locators, although constructor |
| 24 | * injection is recommended. |
| 25 | * |
| 26 | * @author Nicolas Grekas <p@tchwork.com> |
| 27 | * @internal |
| 28 | */ |
| 29 | interface ServiceSubscriberInterface |
| 30 | { |
| 31 | /** |
| 32 | * Returns an array of service types required by such instances, optionally keyed by the service names used internally. |
| 33 | * |
| 34 | * For mandatory dependencies: |
| 35 | * |
| 36 | * * ['logger' => 'Psr\Log\LoggerInterface'] means the objects use the "logger" name |
| 37 | * internally to fetch a service which must implement Psr\Log\LoggerInterface. |
| 38 | * * ['loggers' => 'Psr\Log\LoggerInterface[]'] means the objects use the "loggers" name |
| 39 | * internally to fetch an iterable of Psr\Log\LoggerInterface instances. |
| 40 | * * ['Psr\Log\LoggerInterface'] is a shortcut for |
| 41 | * * ['Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface'] |
| 42 | * |
| 43 | * otherwise: |
| 44 | * |
| 45 | * * ['logger' => '?Psr\Log\LoggerInterface'] denotes an optional dependency |
| 46 | * * ['loggers' => '?Psr\Log\LoggerInterface[]'] denotes an optional iterable dependency |
| 47 | * * ['?Psr\Log\LoggerInterface'] is a shortcut for |
| 48 | * * ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface'] |
| 49 | * |
| 50 | * @return string[] The required service types, optionally keyed by service names |
| 51 | */ |
| 52 | public static function getSubscribedServices() : array; |
| 53 | } |
| 54 |