Inject/Injector.php
public function build($concrete,$params = array()){
        //if closure
        if($concrete instanceof Closure){
            return $this->call($concrete,$params);
//            return $concrete($this,$params);
        }
        //reflect
        $ref = new ReflectionClass($concrete);
        if(!$ref->isInstantiable()) throw new InjectorException("$concrete is not instantiable");
        $constructor = $ref->getConstructor();
        if(is_null($constructor)) return new $concrete;
        //constructor
        $params_in_constructor = $constructor->getParameters();
        $args = $this->apply($params_in_constructor,$params);
        return $ref->newInstanceArgs($args);
    }
public function build($concrete,$params = array()){
        //if closure
        if($concrete instanceof Closure){
            return $this->call($concrete,$params);
//            return $concrete($this,$params);
        }
        //reflect
        $ref = new ReflectionClass($concrete);
        if(!$ref->isInstantiable()) throw new InjectorException("$concrete is not instantiable");
        $constructor = $ref->getConstructor();
        if(is_null($constructor)) return new $concrete;
        //constructor
        $params_in_constructor = $constructor->getParameters();
        $args = $this->apply($params_in_constructor,$params);
        return $ref->newInstanceArgs($args);
    }
build concrete (a Closure or an object)
@param $concrete
@param array $params
@return object
@throws InjectorException