protected function autoInjectDependendies(HasInjectMethods $object)
    {

        $reflection = new ReflectionClass($object);

        foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {

            // Method has to start with 'inject'
            if (strpos($method->getName(), 'inject') !== 0) {
                continue;
            }

            // All parameters has to be some sort of class and bound
            $parameters = $method->getParameters();

            foreach ($method->getParameters() as $parameter) {

                // No class|interface typehint, skip the method
                if (!$class = $parameter->getClass()) {
                    continue 2;
                }

                // class|interface typehint not bound, skip the method
                if (!$this->app->bound($class->getName())) {
                    continue 2;
                }
            }

            $this->app->call([$object, $method->getName()]);

        }

    }
protected function autoInjectDependendies(HasInjectMethods $object)
    {

        $reflection = new ReflectionClass($object);

        foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {

            // Method has to start with 'inject'
            if (strpos($method->getName(), 'inject') !== 0) {
                continue;
            }

            // All parameters has to be some sort of class and bound
            $parameters = $method->getParameters();

            foreach ($method->getParameters() as $parameter) {

                // No class|interface typehint, skip the method
                if (!$class = $parameter->getClass()) {
                    continue 2;
                }

                // class|interface typehint not bound, skip the method
                if (!$this->app->bound($class->getName())) {
                    continue 2;
                }
            }

            $this->app->call([$object, $method->getName()]);

        }

    }
protected function autoInjectDependendies ( HasInjectMethods $ object ) { $ reflection = new ReflectionClass ( $ object ) ; foreach ( $ reflection -> getMethods ( ReflectionMethod :: IS_PUBLIC ) as $ method ) { // Method has to start with 'inject' if ( strpos ( $ method -> getName ( ) , 'inject' ) !== 0 ) { continue ; } // All parameters has to be some sort of class and bound $ parameters = $ method -> getParameters ( ) ; foreach ( $ method -> getParameters ( ) as $ parameter ) { // No class|interface typehint, skip the method if ( ! $ class = $ parameter -> getClass ( ) ) { continue 2 ; } // class|interface typehint not bound, skip the method if ( ! $ this -> app -> bound ( $ class -> getName ( ) ) ) { continue 2 ; } } $ this -> app -> call ( [ $ object , $ method -> getName ( ) ] ) ; } }
Auto Inject all dependencies

@param HasInjectMethods $object
Auto Inject all dependencies