示例#1
0
 /**
  * @return fDOMElement
  */
 private function getInlineContainer() {
     $node = $this->ctx->queryOne('phpdox:inline');
     if ($node !== NULL) {
         return $node;
     }
     return $this->ctx->appendElementNS(self::XMLNS, 'inline');
 }
示例#2
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));
     }
 }
示例#3
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);
 }
示例#4
0
 public function testAppendingANewElementWithinANamespace()
 {
     $node = $this->node->appendElementNS('test:uri', 'append', 'text');
     $this->dom->registerNamespace('t', 'test:uri');
     $this->assertInstanceOf('TheSeer\\fDOM\\fDOMElement', $node);
     $this->assertEquals(1, $this->node->query('count(t:append)'));
     $this->assertEquals('text', $node->nodeValue);
 }
 /**
  * @param $type
  */
 public function setType($type)
 {
     if (!in_array(mb_strtolower($type), $this->types)) {
         $parts = explode('\\', $type);
         $local = array_pop($parts);
         $namespace = join('\\', $parts);
         $unit = $this->ctx->appendElementNS(self::XMLNS, 'type');
         $unit->setAttribute('full', $type);
         $unit->setAttribute('namespace', $namespace);
         $unit->setAttribute('name', $local);
         $type = 'object';
     }
     $this->ctx->setAttribute('type', $type);
 }
示例#6
0
文件: Git.php 项目: beingsane/phpdox
 private function addCommit(fDOMElement $enrichment, array $tokens, array $block)
 {
     list($data, $text) = array_chunk($block, count($tokens));
     $data = array_combine($tokens, $data);
     $commit = $enrichment->appendElementNS(self::GITNS, 'commit');
     $commit->setAttribute('sha1', $data['H']);
     $author = $commit->appendElementNS(self::GITNS, 'author');
     $author->setAttribute('email', $data['aE']);
     $author->setAttribute('name', $data['aN']);
     $author->setAttribute('time', date('c', $data['at']));
     $author->setAttribute('unixtime', $data['at']);
     $commiter = $commit->appendElementNS(self::GITNS, 'commiter');
     $commiter->setAttribute('email', $data['cE']);
     $commiter->setAttribute('name', $data['cN']);
     $commiter->setAttribute('time', date('c', $data['ct']));
     $commiter->setAttribute('unixtime', $data['ct']);
     $message = $commit->appendElementNS(self::GITNS, 'message');
     $message->appendTextNode(trim(join("\n", $text)));
 }
示例#7
0
 public function addExclude($methodName)
 {
     $exclude = $this->ctx->appendElementNS(self::XMLNS, 'exclude');
     $exclude->setAttribute('method', $methodName);
 }