public function get($id)
    {
        $id = $this->dereference($id);

        if (isset($this->instances[$id])) {
            return $this->instances[$id];
        }

        $object = $this->build($id);
        $this->instances[$id] = $object;

        return $this->initObject($object);
    }
public function get($id)
    {
        $id = $this->dereference($id);

        if (isset($this->instances[$id])) {
            return $this->instances[$id];
        }

        $object = $this->build($id);
        $this->instances[$id] = $object;

        return $this->initObject($object);
    }
public function get ( $ id ) { $ id = $ this -> dereference ( $ id ) ; if ( isset ( $ this -> instances [ $ id ] ) ) { return $ this -> instances [ $ id ] ; } $ object = $ this -> build ( $ id ) ; $ this -> instances [ $ id ] = $ object ; return $ this -> initObject ( $ object ) ; }
Returns an instance by either interface name or alias.

Same instance of the class will be returned each time this method is called.

@param string $id the interface name or an alias name (e.g. `foo`) that was previously registered via [[set()]].
@return object an instance of the requested interface.
@throws CircularReferenceException
@throws InvalidConfigException
@throws NotFoundException
@throws NotInstantiableException
Returns an instance by either interface name or alias .