public function makeInstance($className)
    {
        // class reflection
        $reflection = new ReflectionClass($className);
        // get the class constructor
        $constructor = $reflection->getConstructor();

        // if there is no constructor, just create and
        // return a new instance
        if (!$constructor) {
            return $reflection->newInstance();
        }

        // created and returns the new instance passing the
        // resolved parameters
        return $reflection->newInstanceArgs($this->resolveParameters($constructor->getParameters(), []));
    }
public function makeInstance($className)
    {
        // class reflection
        $reflection = new ReflectionClass($className);
        // get the class constructor
        $constructor = $reflection->getConstructor();

        // if there is no constructor, just create and
        // return a new instance
        if (!$constructor) {
            return $reflection->newInstance();
        }

        // created and returns the new instance passing the
        // resolved parameters
        return $reflection->newInstanceArgs($this->resolveParameters($constructor->getParameters(), []));
    }
public function makeInstance ( $ className ) { // class reflection $ reflection = new ReflectionClass ( $ className ) ; // get the class constructor $ constructor = $ reflection -> getConstructor ( ) ; // if there is no constructor, just create and // return a new instance if ( ! $ constructor ) { return $ reflection -> newInstance ( ) ; } // created and returns the new instance passing the // resolved parameters return $ reflection -> newInstanceArgs ( $ this -> resolveParameters ( $ constructor -> getParameters ( ) , [ ] ) ) ; }
Created a instance of a desired class.

@param $className
@return mixed
@throws SimplesRunTimeError
Created a instance of a desired class .