Esempio n. 1
0
        /**
         * @param DocBlock $docblock
         */
        public function setDocBlock(DocBlock $docblock) {
            $docNode = $docblock->asDom($this->ctx->ownerDocument);

            if ($this->ctx->hasChildNodes()) {
                $this->ctx->insertBefore($docNode, $this->ctx->firstChild);
                return;
            }
            $this->ctx->appendChild($docNode);
        }
Esempio n. 2
0
 private function getGeneralBuildInfo()
 {
     if ($this->buildInfo != NULL) {
         return $this->buildInfo;
     }
     $dom = new fDOMDocument();
     $this->buildInfo = $dom->createDocumentFragment();
     $dateNode = $dom->createElementNS(self::XMLNS, 'date');
     $this->buildInfo->appendChild($dateNode);
     $date = new \DateTime('now');
     $dateNode->setAttribute('unix', $date->getTimestamp());
     $dateNode->setAttribute('date', $date->format('d-m-Y'));
     $dateNode->setAttribute('time', $date->format('H:i:s'));
     $dateNode->setAttribute('iso', $date->format('c'));
     $dateNode->setAttribute('rfc', $date->format('r'));
     $phpdoxNode = $dom->createElementNS(self::XMLNS, 'phpdox');
     $this->buildInfo->appendChild($phpdoxNode);
     $phpdoxNode->setAttribute('version', $this->version->getVersion());
     $phpdoxNode->setAttribute('info', $this->version->getInfoString());
     $phpdoxNode->setAttribute('generated', $this->version->getGeneratedByString());
     $phpdoxNode->setAttribute('phar', defined('PHPDOX_PHAR') ? 'yes' : 'no');
     foreach ($this->enrichers as $enricher) {
         $enricherNode = $phpdoxNode->appendElementNS(self::XMLNS, 'enricher');
         $enricherNode->setAttribute('type', $enricher);
     }
     $phpNode = $dom->createElementNS(self::XMLNS, 'php');
     $this->buildInfo->appendChild($phpNode);
     $phpNode->setAttribute('version', PHP_VERSION);
     $phpNode->setAttribute('os', PHP_OS);
     foreach (get_loaded_extensions(true) as $extension) {
         $extNode = $dom->createElementNS(self::XMLNS, 'zendextension');
         $extNode->setAttribute('name', $extension);
         $phpNode->appendChild($extNode);
     }
     foreach (get_loaded_extensions(false) as $extension) {
         $extNode = $dom->createElementNS(self::XMLNS, 'extension');
         $extNode->setAttribute('name', $extension);
         $phpNode->appendChild($extNode);
     }
     return $this->buildInfo;
 }
Esempio n. 3
0
 /**
  * @param fDOMElement $node
  * @param             $type
  *
  * @return fDOMElement
  */
 protected function getEnrichtmentContainer(fDOMElement $node, $type)
 {
     $dom = $node->ownerDocument;
     $container = $node->queryOne('phpdox:enrichments');
     if (!$container) {
         $container = $dom->createElementNS(self::XMLNS, 'enrichments');
         $node->appendChild($container);
     }
     $enrichment = $container->queryOne($dom->prepareQuery('phpdox:enrichment[@type=:type]', array('type' => $type)));
     if (!$enrichment) {
         $enrichment = $dom->createElementNS(self::XMLNS, 'enrichment');
         $enrichment->setAttribute('type', $type);
         $container->appendChild($enrichment);
     }
     return $enrichment;
 }
Esempio n. 4
0
 /**
  * @param fDOMElement $element
  * @param string $elementName
  * @param Difference[] $differences
  * @param string $tagName
  */
 private function append(fDOMElement $unitElement, $elementName, DifferenceCollection $differences, $tagName)
 {
     $grouped = $this->groupDifferences($differences, $tagName);
     foreach ($grouped as $groupName => $subDifferences) {
         $parent = $unitElement->createElement($elementName);
         $parent->setAttribute('name', $groupName);
         foreach ($subDifferences as $name => $difference) {
             /* @var $difference \RenanBr\PhpAct\Difference\Difference */
             $element = $parent->createElement('difference');
             $element->appendXML($difference->getMessage());
             $isBcBreak = $difference->hasTag(Difference::BC_BREAK);
             $element->setAttribute('bcBreak', $isBcBreak ? 'true' : 'false');
             $parent->appendChild($element);
         }
         $unitElement->appendChild($parent);
     }
 }
Esempio n. 5
0
 private function loadFromCache(fDOMElement $fileNode, fDOMElement $enrichment)
 {
     $dom = $this->getCacheDom();
     $fields = array('path' => $fileNode->getAttribute('path'), 'file' => $fileNode->getAttribute('file'));
     $query = $dom->prepareQuery('//*[@path = :path and @file = :file]', $fields);
     $cacheNode = $dom->queryOne($query);
     if (!$cacheNode) {
         return false;
     }
     foreach ($cacheNode->childNodes as $child) {
         $enrichment->appendChild($enrichment->ownerDocument->importNode($child, true));
     }
     return true;
 }
Esempio n. 6
0
 /**
  * @param \TheSeer\phpDox\DocBlock\DocBlock $docblock
  */
 public function setDocBlock(DocBlock $docblock)
 {
     $docNode = $docblock->asDom($this->dom);
     $this->rootNode->appendChild($docNode);
 }