示例#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
 /**
  * @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;
 }
示例#4
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));
     }
 }
示例#5
0
 /**
  * @return fDOMElement
  */
 private function getInlineContainer() {
     $node = $this->ctx->queryOne('phpdox:inline');
     if ($node !== NULL) {
         return $node;
     }
     return $this->ctx->appendElementNS(self::XMLNS, 'inline');
 }
示例#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
 /**
  * @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);
     }
 }
示例#9
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;
 }
示例#10
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;
 }
示例#11
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;
 }
示例#12
0
 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;
 }
示例#13
0
 /**
  * @return string|null
  */
 public function getType()
 {
     $node = $this->element->queryOne('src:docblock/src:var');
     return $node ? $this->readType($node) : null;
 }
示例#14
0
文件: Git.php 项目: beingsane/phpdox
 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;
 }
示例#15
0
 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');
 }
示例#17
0
 public function getValue()
 {
     return $this->node->getAttribute('value');
 }
示例#18
0
 /**
  * @param fDOMElement $element
  * @return Unit
  */
 protected function buildObject(fDOMElement $element)
 {
     $document = new fDOMDocument();
     $document->load($this->buildDirectory . '/' . $element->getAttribute('xml'));
     return new Unit($document);
 }
示例#19
0
 public function testInSameDocumentForwardsToOwnerDocumentAndReturnsCorrectValue()
 {
     $rc = $this->node->inSameDocument($this->node->firstChild);
     $this->assertTrue($rc);
 }
示例#20
0
 public function isProtected()
 {
     return $this->node->getAttribute('visibility', 'public') == 'protected';
 }
示例#21
0
 /**
  * @return bool
  */
 public function isRequired()
 {
     return !$this->element->hasAttribute('default') && !$this->element->hasAttribute('constant');
 }
示例#22
0
文件: Method.php 项目: renanbr/phpact
 /**
  * @return bool
  */
 public function getVisibility()
 {
     return $this->element->getAttribute('visibility');
 }