namespace Wikimedia\Services;
use InvalidArgumentException;
+use Psr\Container\ContainerInterface;
use RuntimeException;
use Wikimedia\Assert\Assert;
* @see docs/injection.txt for an overview of using dependency injection in the
* MediaWiki code base.
*/
-class ServiceContainer implements DestructibleService {
+class ServiceContainer implements ContainerInterface, DestructibleService {
/**
* @var object[]
return isset( $this->serviceInstantiators[$name] );
}
+ /** @inheritDoc */
+ public function has( $name ) {
+ return $this->hasService( $name );
+ }
+
/**
* Returns the service instance for $name only if that service has already been instantiated.
* This is intended for situations where services get destroyed/cleaned up, so we can
return $this->services[$name];
}
+ /** @inheritDoc */
+ public function get( $name ) {
+ return $this->getService( $name );
+ }
+
/**
* @param string $name
*