src/Phapi/Di/Container.php
public function make($key)
    {
        // Check if set
        if (!isset($this->keys[$key])) {
            throw new \InvalidArgumentException('Identifier "'. $key .'" is not defined.');
        }

        // Check if it is a simple value (string, int etc) that
        // should be returned
        if (
            !is_object($this->raw[$key])
            || !method_exists($this->raw[$key], '__invoke')
        ) {
            return $this->raw[$key];
        }

        if ($this->types[$key] === self::TYPE_SINGLETON) {
            if (isset($this->resolved[$key])) {
                return $this->resolved[$key];
            }

            $this->locked[$key] = true;
            return $this->resolved[$key] = $this->raw[$key]($this);
        }

        // Return multiton
        return $this->raw[$key]($this);
    }
public function make($key)
    {
        // Check if set
        if (!isset($this->keys[$key])) {
            throw new \InvalidArgumentException('Identifier "'. $key .'" is not defined.');
        }

        // Check if it is a simple value (string, int etc) that
        // should be returned
        if (
            !is_object($this->raw[$key])
            || !method_exists($this->raw[$key], '__invoke')
        ) {
            return $this->raw[$key];
        }

        if ($this->types[$key] === self::TYPE_SINGLETON) {
            if (isset($this->resolved[$key])) {
                return $this->resolved[$key];
            }

            $this->locked[$key] = true;
            return $this->resolved[$key] = $this->raw[$key]($this);
        }

        // Return multiton
        return $this->raw[$key]($this);
    }
public function make ( $ key ) { // Check if set if ( ! isset ( $ this -> keys [ $ key ] ) ) { throw new \ InvalidArgumentException ( 'Identifier "' . $ key . '" is not defined.' ) ; } // Check if it is a simple value (string, int etc) that // should be returned if ( ! is_object ( $ this -> raw [ $ key ] ) || ! method_exists ( $ this -> raw [ $ key ] , '__invoke' ) ) { return $ this -> raw [ $ key ] ; } if ( $ this -> types [ $ key ] === self :: TYPE_SINGLETON ) { if ( isset ( $ this -> resolved [ $ key ] ) ) { return $ this -> resolved [ $ key ] ; } $ this -> locked [ $ key ] = true ; return $ this -> resolved [ $ key ] = $ this -> raw [ $ key ] ( $ this ) ; } // Return multiton return $ this -> raw [ $ key ] ( $ this ) ; }
Get something from the container

@param $key string Identifier
@return mixed
Get something from the container