original_string: public function addObjectResource($object)
      {
          if ($this->trackResources) {
              if (\is_object($object)) {
                  $object = \get_class($object);
              }
              if (!isset($this->classReflectors[$object])) {
                  $this->classReflectors[$object] = new \ReflectionClass($object);
              }
              $class = $this->classReflectors[$object];
  
              foreach ($class->getInterfaceNames() as $name) {
                  if (null === $interface = &$this->classReflectors[$name]) {
                      $interface = new \ReflectionClass($name);
                  }
                  $file = $interface->getFileName();
                  if (false !== $file && file_exists($file)) {
                      $this->fileExists($file);
                  }
              }
              do {
                  $file = $class->getFileName();
                  if (false !== $file && file_exists($file)) {
                      $this->fileExists($file);
                  }
                  foreach ($class->getTraitNames() as $name) {
                      $this->addObjectResource($name);
                  }
              } while ($class = $class->getParentClass());
          }
  
          return $this;
      }
code: public function addObjectResource($object)
      {
          if ($this->trackResources) {
              if (\is_object($object)) {
                  $object = \get_class($object);
              }
              if (!isset($this->classReflectors[$object])) {
                  $this->classReflectors[$object] = new \ReflectionClass($object);
              }
              $class = $this->classReflectors[$object];
  
              foreach ($class->getInterfaceNames() as $name) {
                  if (null === $interface = &$this->classReflectors[$name]) {
                      $interface = new \ReflectionClass($name);
                  }
                  $file = $interface->getFileName();
                  if (false !== $file && file_exists($file)) {
                      $this->fileExists($file);
                  }
              }
              do {
                  $file = $class->getFileName();
                  if (false !== $file && file_exists($file)) {
                      $this->fileExists($file);
                  }
                  foreach ($class->getTraitNames() as $name) {
                      $this->addObjectResource($name);
                  }
              } while ($class = $class->getParentClass());
          }
  
          return $this;
      }
code_tokens: public function addObjectResource ( $ object ) { if ( $ this -> trackResources ) { if ( \ is_object ( $ object ) ) { $ object = \ get_class ( $ object ) ; } if ( ! isset ( $ this -> classReflectors [ $ object ] ) ) { $ this -> classReflectors [ $ object ] = new \ ReflectionClass ( $ object ) ; } $ class = $ this -> classReflectors [ $ object ] ; foreach ( $ class -> getInterfaceNames ( ) as $ name ) { if ( null === $ interface = & $ this -> classReflectors [ $ name ] ) { $ interface = new \ ReflectionClass ( $ name ) ; } $ file = $ interface -> getFileName ( ) ; if ( false !== $ file && file_exists ( $ file ) ) { $ this -> fileExists ( $ file ) ; } } do { $ file = $ class -> getFileName ( ) ; if ( false !== $ file && file_exists ( $ file ) ) { $ this -> fileExists ( $ file ) ; } foreach ( $ class -> getTraitNames ( ) as $ name ) { $ this -> addObjectResource ( $ name ) ; } } while ( $ class = $ class -> getParentClass ( ) ) ; } return $ this ; }
docstring: Adds the object class hierarchy as resources.
  
  @param object|string $object An object instance or class name
  
  @return $this
docstring_tokens: Adds the object class hierarchy as resources .