public function injector($classname, $method = null)
    {
        $params = [];
        $reflection = new \ReflectionClass($classname);

        if (is_null($method)) {
            $method = "__invoke";
        }

        $parameters = $reflection->getMethod($method)->getParameters();

        foreach ($parameters as $parameter) {
            $class = $parameter->getClass();

            if (is_null($class)) {
                continue;
            }

            $constructor = $class->getName();

            if (! class_exists($constructor, true)) {
                continue;
            }

            if (!in_array(strtolower($constructor), $this->getInjectorExceptedType())) {
                if (method_exists($constructor, 'getInstance')) {
                    $params[] = $constructor::getInstance();
                } else {
                    $params[] = new $constructor();
                }
            }
        }

        return $params;
    }
public function injector($classname, $method = null)
    {
        $params = [];
        $reflection = new \ReflectionClass($classname);

        if (is_null($method)) {
            $method = "__invoke";
        }

        $parameters = $reflection->getMethod($method)->getParameters();

        foreach ($parameters as $parameter) {
            $class = $parameter->getClass();

            if (is_null($class)) {
                continue;
            }

            $constructor = $class->getName();

            if (! class_exists($constructor, true)) {
                continue;
            }

            if (!in_array(strtolower($constructor), $this->getInjectorExceptedType())) {
                if (method_exists($constructor, 'getInstance')) {
                    $params[] = $constructor::getInstance();
                } else {
                    $params[] = new $constructor();
                }
            }
        }

        return $params;
    }
public function injector ( $ classname , $ method = null ) { $ params = [ ] ; $ reflection = new \ ReflectionClass ( $ classname ) ; if ( is_null ( $ method ) ) { $ method = "__invoke" ; } $ parameters = $ reflection -> getMethod ( $ method ) -> getParameters ( ) ; foreach ( $ parameters as $ parameter ) { $ class = $ parameter -> getClass ( ) ; if ( is_null ( $ class ) ) { continue ; } $ constructor = $ class -> getName ( ) ; if ( ! class_exists ( $ constructor , true ) ) { continue ; } if ( ! in_array ( strtolower ( $ constructor ) , $ this -> getInjectorExceptedType ( ) ) ) { if ( method_exists ( $ constructor , 'getInstance' ) ) { $ params [ ] = $ constructor :: getInstance ( ) ; } else { $ params [ ] = new $ constructor ( ) ; } } } return $ params ; }
Make any class injection

@param string $classname
@param string $method

@return array

@throws
Make any class injection