示例#1
0
 public function getLogfilePath()
 {
     $history = $this->context->queryOne('cfg:history');
     if (!$history || $history->getAttribute('cache') == '') {
         return $this->generator->getProjectConfig()->getWorkDirectory() . '/gitlog.xml';
     }
     return $history->getAttribute('cache');
 }
示例#2
0
 public function getCoveragePath() {
     $basedirDefault = dirname($this->context->ownerDocument->baseURI);
     $path = $basedirDefault . '/build/logs';
     if ($this->context->parentNode->hasAttribute('base')) {
         $path = $this->context->parentNode->getAttribute('base');
     }
     if ($path != '') { $path .= '/'; }
     $coverage = $this->context->queryOne('cfg:coverage');
     if ($coverage && $coverage->hasAttribute('path')) {
         $path .= $coverage->getAttribute('path');
     } else {
         $path .= 'coverage';
     }
     return $path;
 }
示例#3
0
 /**
  * @return fDOMElement
  */
 private function getInlineContainer() {
     $node = $this->ctx->queryOne('phpdox:inline');
     if ($node !== NULL) {
         return $node;
     }
     return $this->ctx->appendElementNS(self::XMLNS, 'inline');
 }
示例#4
0
 public function testAppendingATextAsTextnode()
 {
     $node = $this->node->appendTextNode('test & demo');
     $found = $this->node->queryOne('text()');
     $this->assertSame($node, $found);
     $this->assertEquals('test & demo', $node->nodeValue);
 }
示例#5
0
 /**
  * @param AbstractUnitObject $unit
  */
 public function importExports(AbstractUnitObject $unit, $container = 'parent')
 {
     $parent = $this->rootNode->queryOne(sprintf('//phpdox:%s[@full="%s"]', $container, $unit->getName()));
     if ($parent instanceof fDOMElement) {
         $parent->parentNode->removeChild($parent);
     }
     $parent = $this->rootNode->appendElementNS(self::XMLNS, $container);
     $parent->setAttribute('full', $unit->getName());
     $parent->setAttribute('namepsace', $unit->getNamespace());
     $parent->setAttribute('name', $unit->getLocalName());
     if ($unit->hasExtends()) {
         foreach ($unit->getExtends() as $name) {
             $extends = $parent->appendElementNS(self::XMLNS, 'extends');
             $this->setName($name, $extends);
         }
     }
     foreach ($unit->getConstants() as $constant) {
         $parent->appendChild($this->dom->importNode($constant->export(), TRUE));
     }
     foreach ($unit->getExportedMembers() as $member) {
         $parent->appendChild($this->dom->importNode($member->export(), TRUE));
     }
     foreach ($unit->getExportedMethods() as $method) {
         $parent->appendChild($this->dom->importNode($method->export(), TRUE));
     }
 }
示例#6
0
 /**
  * @param $containerName
  * @param $elementName
  *
  * @return fDOMElement
  */
 protected function addToContainer($containerName, $elementName)
 {
     $container = $this->rootNode->queryOne('phpdox:' . $containerName);
     if (!$container) {
         $container = $this->rootNode->appendElementNS(self::XMLNS, $containerName);
     }
     return $container->appendElementNS(self::XMLNS, $elementName);
 }
示例#7
0
 /**
  * @param $methodName
  *
  * @return mixed
  * @throws TraitUseException
  */
 private function getAliasNode($methodName)
 {
     $node = $this->ctx->queryOne(sprintf('phpdox:alias[@method = "%s"]', $methodName));
     if (!$node) {
         throw new TraitUseException(sprintf("Method %s not aliased", $methodName), TraitUseException::NotAliased);
     }
     return $node;
 }
示例#8
0
 public function getLogFilePath()
 {
     $basedirDefault = dirname($this->context->ownerDocument->baseURI);
     $path = $basedirDefault . '/build/logs';
     if ($this->context->parentNode->hasAttribute('base')) {
         $path = $this->context->parentNode->getAttribute('base');
     }
     if ($path != '') {
         $path .= '/';
     }
     $file = $this->context->queryOne('cfg:file');
     if ($file && $file->hasAttribute('name')) {
         $path .= $file->getAttribute('name');
     } else {
         $path .= 'phploc.xml';
     }
     return $path;
 }
示例#9
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;
 }
示例#10
0
 /**
  * @param fDOMElement $element
  * @return string|null
  */
 protected function readType(fDOMElement $node)
 {
     // <root type="array" of="object"><type full="{FQCN}"/></root>
     $type = $this->normalizeType($node->getAttribute('type'));
     $subNode = $node->queryOne('src:type');
     $detailing = $this->normalizeType($subNode ? $subNode->getAttribute('full') : $node->getAttribute('of'));
     if (null !== $detailing) {
         if ('object' === $type) {
             $type = $detailing;
         } else {
             if ('array' === $type) {
                 $pieces = explode('|', $detailing);
                 foreach ($pieces as &$piece) {
                     $piece .= '[]';
                 }
                 $type = implode('|', $pieces);
             }
         }
     }
     return $type;
 }
示例#11
0
 /**
  * @return string|null
  */
 public function getType()
 {
     $node = $this->element->queryOne('src:docblock/src:var');
     return $node ? $this->readType($node) : null;
 }