Yoast\WP\Lib\Dependency_Injection
Container_Registry::get() public Yoast 1.0
Get an instance from a specific container.
{} Это метод класса: Container_Registry{}
Хуков нет.
Возвращает
Объект. The service.
Использование
$result = Container_Registry::get( $name, $id, $invalid_behaviour );
- $name(строка) (обязательный)
- The name of the container.
- $id(строка) (обязательный)
- The ID of the service.
- $invalid_behaviour(число)
- The behaviour when the service could not be found.
Код Container_Registry::get() Container Registry::get Yoast 15.9
public static function get( $name, $id, $invalid_behaviour = 1 ) {
if ( ! \array_key_exists( $name, self::$containers ) ) {
if ( $invalid_behaviour === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE ) {
throw new ServiceNotFoundException( $id );
}
return null;
}
return self::$containers[ $name ]->get( $id, $invalid_behaviour );
}