yii\di\Instance::get PHP 메소드

get() 공개 메소드

Returns the actual object referenced by this Instance object.
public get ( ServiceLocator | Container $container = null ) : object
$container ServiceLocator | Container the container used to locate the referenced object. If null, the method will first try `Yii::$app` then `Yii::$container`.
리턴 object the actual object referenced by this Instance object.
    public function get($container = null)
    {
        if ($container) {
            return $container->get($this->id);
        }
        if (Yii::$app && Yii::$app->has($this->id)) {
            return Yii::$app->get($this->id);
        } else {
            return Yii::$container->get($this->id);
        }
    }