interface ServiceProviderInterface
Same name in this branch
- 11.1.x core/lib/Drupal/Core/DependencyInjection/ServiceProviderInterface.php \Drupal\Core\DependencyInjection\ServiceProviderInterface
A ServiceProviderInterface exposes the identifiers and the types of services provided by a container.
@author Nicolas Grekas <p@tchwork.com> @author Mateusz Sip <mateusz.sip@gmail.com>
@template-covariant T of mixed
Hierarchy
- interface \Psr\Container\ContainerInterface
- interface \Symfony\Contracts\Service\ServiceProviderInterface extends \Psr\Container\ContainerInterface
Expanded class hierarchy of ServiceProviderInterface
All classes that implement ServiceProviderInterface
4 files declare their use of ServiceProviderInterface
- ArgumentResolver.php in vendor/
symfony/ http-kernel/ Controller/ ArgumentResolver.php - ExpressionLanguageProvider.php in vendor/
symfony/ routing/ Matcher/ ExpressionLanguageProvider.php - RegisterServiceSubscribersPass.php in vendor/
symfony/ dependency-injection/ Compiler/ RegisterServiceSubscribersPass.php - ResolveServiceSubscribersPass.php in vendor/
symfony/ dependency-injection/ Compiler/ ResolveServiceSubscribersPass.php
File
-
vendor/
symfony/ service-contracts/ ServiceProviderInterface.php, line 24
Namespace
Symfony\Contracts\ServiceView source
interface ServiceProviderInterface extends ContainerInterface {
/**
* @return T
*/
public function get(string $id) : mixed;
public function has(string $id) : bool;
/**
* Returns an associative array of service types keyed by the identifiers provided by the current container.
*
* Examples:
*
* * ['logger' => 'Psr\Log\LoggerInterface'] means the object provides a service named "logger" that implements Psr\Log\LoggerInterface
* * ['foo' => '?'] means the container provides service name "foo" of unspecified type
* * ['bar' => '?Bar\Baz'] means the container provides a service "bar" of type Bar\Baz|null
*
* @return array<string, string> The provided service types, keyed by service names
*/
public function getProvidedServices() : array;
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ServiceProviderInterface::get | public | function | Overrides ContainerInterface::get | |
ServiceProviderInterface::getProvidedServices | public | function | Returns an associative array of service types keyed by the identifiers provided by the current container. | |
ServiceProviderInterface::has | public | function | Returns true if the container can return an entry for the given identifier. Returns false otherwise. |
Overrides ContainerInterface::has |