ManaPHP\Di::getShared PHP Method

getShared() public method

Resolves a service, the resolved service is stored in the DI, subsequent requests for this service will return the same instance
public getShared ( string $name, array $parameters = [] ) : mixed
$name string
$parameters array
return mixed
    public function getShared($name, $parameters = [])
    {
        if (!isset($this->_sharedInstances[$name])) {
            /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
            $this->_sharedInstances[$name] = $this->get($name, $parameters);
        }
        return $this->_sharedInstances[$name];
    }