original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Resolve dependencies for given class.
  
  @param string $class An existing class.
  @param array  $rules Custom rules.
  
  @return object|null Instance of resolved class
docstring_tokens: Resolve dependencies for given class .