public function create($definition, array $args = array())
    {
        $className = $definition;

        if(is_array($definition))
        {
            $className = $definition['class'];

            if(isset($definition['arguments']))
                $args = array_merge($args, $definition['arguments']);
        }
        else
        {
            $className = $definition;
        }

        $className = $this->buildClassName($className);

        // class name does not exists in the given path.
        if(!class_exists($className))
            throw new \Exedra\Exception\NotFoundException('Class named ['.$className.'] does not exists.');

        if(count($args))
        {
            $reflection	= new \ReflectionClass($className);

            $instance	= $reflection->newInstanceArgs($args);
        }
        else
        {
            $instance	= new $className;
        }

        return $instance;
    }
public function create($definition, array $args = array())
    {
        $className = $definition;

        if(is_array($definition))
        {
            $className = $definition['class'];

            if(isset($definition['arguments']))
                $args = array_merge($args, $definition['arguments']);
        }
        else
        {
            $className = $definition;
        }

        $className = $this->buildClassName($className);

        // class name does not exists in the given path.
        if(!class_exists($className))
            throw new \Exedra\Exception\NotFoundException('Class named ['.$className.'] does not exists.');

        if(count($args))
        {
            $reflection	= new \ReflectionClass($className);

            $instance	= $reflection->newInstanceArgs($args);
        }
        else
        {
            $instance	= new $className;
        }

        return $instance;
    }
public function create ( $ definition , array $ args = array ( ) ) { $ className = $ definition ; if ( is_array ( $ definition ) ) { $ className = $ definition [ 'class' ] ; if ( isset ( $ definition [ 'arguments' ] ) ) $ args = array_merge ( $ args , $ definition [ 'arguments' ] ) ; } else { $ className = $ definition ; } $ className = $ this -> buildClassName ( $ className ) ; // class name does not exists in the given path. if ( ! class_exists ( $ className ) ) throw new \ Exedra \ Exception \ NotFoundException ( 'Class named [' . $ className . '] does not exists.' ) ; if ( count ( $ args ) ) { $ reflection = new \ ReflectionClass ( $ className ) ; $ instance = $ reflection -> newInstanceArgs ( $ args ) ; } else { $ instance = new $ className ; } return $ instance ; }
Create the instance
@param string|array relative classname|definition
@param array constructorParam
@return Object
Create the instance