original_string: protected function buildPackageTree(\DOMDocument $dom)
      {
          $xpath = new \DOMXPath($dom);
          $packages = array('global' => true);
          $qry = $xpath->query('//@package');
          for ($i = 0; $i < $qry->length; $i++) {
              if (isset($packages[$qry->item($i)->nodeValue])) {
                  continue;
              }
  
              $packages[$qry->item($i)->nodeValue] = true;
          }
  
          $packages = $this->generateNamespaceTree(array_keys($packages));
          $this->generateNamespaceElements($packages, $dom->documentElement, 'package');
      }
code: protected function buildPackageTree(\DOMDocument $dom)
      {
          $xpath = new \DOMXPath($dom);
          $packages = array('global' => true);
          $qry = $xpath->query('//@package');
          for ($i = 0; $i < $qry->length; $i++) {
              if (isset($packages[$qry->item($i)->nodeValue])) {
                  continue;
              }
  
              $packages[$qry->item($i)->nodeValue] = true;
          }
  
          $packages = $this->generateNamespaceTree(array_keys($packages));
          $this->generateNamespaceElements($packages, $dom->documentElement, 'package');
      }
code_tokens: protected function buildPackageTree ( \ DOMDocument $ dom ) { $ xpath = new \ DOMXPath ( $ dom ) ; $ packages = array ( 'global' => true ) ; $ qry = $ xpath -> query ( '//@package' ) ; for ( $ i = 0 ; $ i < $ qry -> length ; $ i ++ ) { if ( isset ( $ packages [ $ qry -> item ( $ i ) -> nodeValue ] ) ) { continue ; } $ packages [ $ qry -> item ( $ i ) -> nodeValue ] = true ; } $ packages = $ this -> generateNamespaceTree ( array_keys ( $ packages ) ) ; $ this -> generateNamespaceElements ( $ packages , $ dom -> documentElement , 'package' ) ; }
docstring: Collects all packages and subpackages, and adds a new section in the
  DOM to provide an overview.
  
  @param \DOMDocument $dom Packages are extracted and a summary inserted
  in this object.
  
  @return void
docstring_tokens: Collects all packages and subpackages and adds a new section in the DOM to provide an overview .