public function resolve(string $class, array $rules = [])
    {
        //reset tree;
        $this->tree = [];

        //merge rules passed as parameter with general rules
        $this->rules = \array_merge($this->rules, $rules);

        //build dependency tree
        $this->buildTree($class);

        //build objects
        $this->buildObjects();

        //return required class
        return $this->cache[$class] ?? null;
    }
public function resolve(string $class, array $rules = [])
    {
        //reset tree;
        $this->tree = [];

        //merge rules passed as parameter with general rules
        $this->rules = \array_merge($this->rules, $rules);

        //build dependency tree
        $this->buildTree($class);

        //build objects
        $this->buildObjects();

        //return required class
        return $this->cache[$class] ?? null;
    }
public function resolve ( string $ class , array $ rules = [ ] ) { //reset tree; $ this -> tree = [ ] ; //merge rules passed as parameter with general rules $ this -> rules = \ array_merge ( $ this -> rules , $ rules ) ; //build dependency tree $ this -> buildTree ( $ class ) ; //build objects $ this -> buildObjects ( ) ; //return required class return $ this -> cache [ $ class ] ?? null ; }
Resolve dependencies for given class.

@param string $class An existing class.
@param array  $rules Custom rules.

@return object|null Instance of resolved class
Resolve dependencies for given class .