Exemple #1
0
 private function enrichByFile(fDOMDocument $dom)
 {
     if ($this->noGitAvailable) {
         return;
     }
     $fileNode = $dom->queryOne('//phpdox:file');
     if (!$fileNode) {
         return;
     }
     /** @var fDOMElement $enrichtment */
     $enrichtment = $this->getEnrichtmentContainer($dom->documentElement, 'git');
     if (!$this->config->doLogProcessing()) {
         $enrichtment->appendChild($dom->createComment('GitEnricher: Log processing disabled in configuration '));
         return;
     }
     if ($this->loadFromCache($fileNode, $enrichtment)) {
         return;
     }
     try {
         $count = 0;
         $limit = $this->config->getLogLimit();
         $log = $this->getLogHistory($fileNode->getAttribute('realpath'));
         $block = array();
         foreach ($log as $line) {
             if ($line == '[EOF]') {
                 $this->addCommit($enrichtment, $this->tokens, $block);
                 $block = array();
                 $count++;
                 if ($count > $limit) {
                     break;
                 }
                 continue;
             }
             $block[] = $line;
         }
         $this->addToCache($fileNode, $enrichtment);
     } catch (GitEnricherException $e) {
         $enrichtment->appendChild($dom->createComment('GitEnricher Error: ' . $e->getMessage()));
     }
 }