protected function createServiceObject(/*# string */ $id, array $arguments)
    {
        // class definition
        $def   = &$this->services[$id]['class'];
        $class = $def[0];

        // prepare constructor arguments
        $args  = empty($arguments) ?
            (isset($def[1]) ? $def[1] : []) : $arguments;

        try {
            // objects
            if (is_object($class)) {
                // closure with arguments
                if ($class instanceof \Closure) {
                    return $this->executeCallable($class, $args);

                // other object
                } else {
                    return $class;
                }

            // (pseudo) callable with arguments
            } elseif (is_array($class[0])) {
                return $this->executeCallable($class[0], $args);

            // instantiation with arguments
            } else {
                // reference value #changed
                if (false !== ($ref = $this->isReference($class))) {
                    $class = $this->getReferenceValue($ref);
                    if (is_object($class)) {
                        return $class;
                    }
                }

                return $this->constructObject($class, $args);
            }
        } catch (\Exception $e) {
            throw new LogicException($e->getMessage(), $e->getCode(), $e);
        }
    }
protected function createServiceObject(/*# string */ $id, array $arguments)
    {
        // class definition
        $def   = &$this->services[$id]['class'];
        $class = $def[0];

        // prepare constructor arguments
        $args  = empty($arguments) ?
            (isset($def[1]) ? $def[1] : []) : $arguments;

        try {
            // objects
            if (is_object($class)) {
                // closure with arguments
                if ($class instanceof \Closure) {
                    return $this->executeCallable($class, $args);

                // other object
                } else {
                    return $class;
                }

            // (pseudo) callable with arguments
            } elseif (is_array($class[0])) {
                return $this->executeCallable($class[0], $args);

            // instantiation with arguments
            } else {
                // reference value #changed
                if (false !== ($ref = $this->isReference($class))) {
                    $class = $this->getReferenceValue($ref);
                    if (is_object($class)) {
                        return $class;
                    }
                }

                return $this->constructObject($class, $args);
            }
        } catch (\Exception $e) {
            throw new LogicException($e->getMessage(), $e->getCode(), $e);
        }
    }
protected function createServiceObject ( /*# string */ $ id , array $ arguments ) { // class definition $ def = & $ this -> services [ $ id ] [ 'class' ] ; $ class = $ def [ 0 ] ; // prepare constructor arguments $ args = empty ( $ arguments ) ? ( isset ( $ def [ 1 ] ) ? $ def [ 1 ] : [ ] ) : $ arguments ; try { // objects if ( is_object ( $ class ) ) { // closure with arguments if ( $ class instanceof \ Closure ) { return $ this -> executeCallable ( $ class , $ args ) ; // other object } else { return $ class ; } // (pseudo) callable with arguments } elseif ( is_array ( $ class [ 0 ] ) ) { return $ this -> executeCallable ( $ class [ 0 ] , $ args ) ; // instantiation with arguments } else { // reference value #changed if ( false !== ( $ ref = $ this -> isReference ( $ class ) ) ) { $ class = $ this -> getReferenceValue ( $ ref ) ; if ( is_object ( $ class ) ) { return $ class ; } } return $ this -> constructObject ( $ class , $ args ) ; } } catch ( \ Exception $ e ) { throw new LogicException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Create service object from service definition

@param  string $id service id
@param  array $arguments
@return object
@throws LogicException if something goes wrong
@access protected
Create service object from service definition