Chris@14: Chris@14: * Chris@14: * For the full copyright and license information, please view the LICENSE Chris@14: * file that was distributed with this source code. Chris@14: */ Chris@14: Chris@14: namespace Symfony\Component\DependencyInjection; Chris@14: Chris@14: /** Chris@14: * A ServiceSubscriber exposes its dependencies via the static {@link getSubscribedServices} method. Chris@14: * Chris@14: * The getSubscribedServices method returns an array of service types required by such instances, Chris@14: * optionally keyed by the service names used internally. Service types that start with an interrogation Chris@14: * mark "?" are optional, while the other ones are mandatory service dependencies. Chris@14: * Chris@14: * The injected service locators SHOULD NOT allow access to any other services not specified by the method. Chris@14: * Chris@14: * It is expected that ServiceSubscriber instances consume PSR-11-based service locators internally. Chris@14: * This interface does not dictate any injection method for these service locators, although constructor Chris@14: * injection is recommended. Chris@14: * Chris@14: * @author Nicolas Grekas Chris@14: */ Chris@14: interface ServiceSubscriberInterface Chris@14: { Chris@14: /** Chris@14: * Returns an array of service types required by such instances, optionally keyed by the service names used internally. Chris@14: * Chris@14: * For mandatory dependencies: Chris@14: * Chris@17: * * ['logger' => 'Psr\Log\LoggerInterface'] means the objects use the "logger" name Chris@14: * internally to fetch a service which must implement Psr\Log\LoggerInterface. Chris@17: * * ['Psr\Log\LoggerInterface'] is a shortcut for Chris@17: * * ['Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface'] Chris@14: * Chris@14: * otherwise: Chris@14: * Chris@17: * * ['logger' => '?Psr\Log\LoggerInterface'] denotes an optional dependency Chris@17: * * ['?Psr\Log\LoggerInterface'] is a shortcut for Chris@17: * * ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface'] Chris@14: * Chris@14: * @return array The required service types, optionally keyed by service names Chris@14: */ Chris@14: public static function getSubscribedServices(); Chris@14: }