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; }
/** * @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 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)); } }
/** * @return fDOMElement */ private function getInlineContainer() { $node = $this->ctx->queryOne('phpdox:inline'); if ($node !== NULL) { return $node; } return $this->ctx->appendElementNS(self::XMLNS, 'inline'); }
/** * @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; }
/** * @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); } }
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; }
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; }
/** * @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; }
public function getActiveEnrichSources() { if (!is_array($this->enrichers)) { $this->enrichers = array(); foreach ($this->ctx->query('cfg:enrich/cfg:source[@type and (not(@enabled) or @enabled="true")]') as $ctx) { $this->enrichers[$ctx->getAttribute('type')] = new EnrichConfig($this, $ctx); } if (!isset($this->enrichers['build'])) { $ctx = $this->ctx->ownerDocument->createElementNS('http://xml.phpdox.net/config', 'source'); $ctx->setAttribute('type', 'build'); $this->enrichers['build'] = new EnrichConfig($this, $ctx); } } return $this->enrichers; }
/** * @return string|null */ public function getType() { $node = $this->element->queryOne('src:docblock/src:var'); return $node ? $this->readType($node) : null; }
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; }
private function importDirNode(fDOMElement $dir, $path) { $path .= $dir->getAttribute('name'); foreach($dir->query('phpdox:file') as $file) { $this->original[ $path . '/' . $file->getAttribute('name')] = $file; } foreach($dir->query('phpdox:dir') as $child) { $this->importDirNode($child, $path . '/'); } }
/** * @return string */ public function getType() { return $this->ctx->getAttribute('type'); }
public function getValue() { return $this->node->getAttribute('value'); }
/** * @param fDOMElement $element * @return Unit */ protected function buildObject(fDOMElement $element) { $document = new fDOMDocument(); $document->load($this->buildDirectory . '/' . $element->getAttribute('xml')); return new Unit($document); }
public function testInSameDocumentForwardsToOwnerDocumentAndReturnsCorrectValue() { $rc = $this->node->inSameDocument($this->node->firstChild); $this->assertTrue($rc); }
public function isProtected() { return $this->node->getAttribute('visibility', 'public') == 'protected'; }
/** * @return bool */ public function isRequired() { return !$this->element->hasAttribute('default') && !$this->element->hasAttribute('constant'); }
/** * @return bool */ public function getVisibility() { return $this->element->getAttribute('visibility'); }