container = new RuntimeContainer(
array(
__CLASS__ => $this,
'Psr\Container\ContainerInterface' => $this,
)
);
}
/**
* Returns an instance of the specified class.
* See the comment about ContainerException in RuntimeContainer::get.
*
* @template T
* @param string|class-string $id Class name.
*
* @return T|object Object instance.
*
* @throws ContainerException Error when resolving the class to an object instance, or class not found.
* @throws \Exception Exception thrown in the constructor or in the 'init' method of one of the resolved classes.
*/
public function get( string $id ) {
return $this->container->get( $id );
}
/**
* Returns true if the container can return an instance of the given class or false otherwise.
* See the comment in RuntimeContainer::has.
*
* @param class-string $id Class name.
*
* @return bool
*/
public function has( string $id ): bool {
return $this->container->has( $id );
}
}