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'); }
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; }
/** * @return fDOMElement */ private function getInlineContainer() { $node = $this->ctx->queryOne('phpdox:inline'); if ($node !== NULL) { return $node; } return $this->ctx->appendElementNS(self::XMLNS, 'inline'); }
public function testAppendingATextAsTextnode() { $node = $this->node->appendTextNode('test & demo'); $found = $this->node->queryOne('text()'); $this->assertSame($node, $found); $this->assertEquals('test & demo', $node->nodeValue); }
/** * @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)); } }
/** * @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); }
/** * @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; }
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; }
/** * @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; }
/** * @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; }
/** * @return string|null */ public function getType() { $node = $this->element->queryOne('src:docblock/src:var'); return $node ? $this->readType($node) : null; }