src/frogsystem/spawn/Container.php
public function make($concrete, array $args = [])
    {
        // build only from strings
        if (!is_object($concrete) && !is_scalar($concrete) && !is_null($concrete)) {
            throw new Exceptions\InvalidArgumentException();
        }

        // get reflection and parameters
        $reflection = new \ReflectionClass($concrete);
        $constructor = $reflection->getConstructor();

        // Return new instance
        $arguments = $constructor ? $this->inject($constructor, $args) : [];
        return $reflection->newInstanceArgs($arguments);
    }
public function make($concrete, array $args = [])
    {
        // build only from strings
        if (!is_object($concrete) && !is_scalar($concrete) && !is_null($concrete)) {
            throw new Exceptions\InvalidArgumentException();
        }

        // get reflection and parameters
        $reflection = new \ReflectionClass($concrete);
        $constructor = $reflection->getConstructor();

        // Return new instance
        $arguments = $constructor ? $this->inject($constructor, $args) : [];
        return $reflection->newInstanceArgs($arguments);
    }
public function make ( $ concrete , array $ args = [ ] ) { // build only from strings if ( ! is_object ( $ concrete ) && ! is_scalar ( $ concrete ) && ! is_null ( $ concrete ) ) { throw new Exceptions \ InvalidArgumentException ( ) ; } // get reflection and parameters $ reflection = new \ ReflectionClass ( $ concrete ) ; $ constructor = $ reflection -> getConstructor ( ) ; // Return new instance $ arguments = $ constructor ? $ this -> inject ( $ constructor , $ args ) : [ ] ; return $ reflection -> newInstanceArgs ( $ arguments ) ; }
Make a new instance of a concrete using Dependency Injection.
@param $concrete
@param array $args
@return mixed
@throws Exceptions\InvalidArgumentException
Make a new instance of a concrete using Dependency Injection .