示例#1
0
 public function testSettingMultipleAttributesFromArray()
 {
     $attrs = array('a1' => 'v1', 'a2' => 'v2');
     $this->node->setAttributes($attrs);
     $this->assertEquals('v1', $this->node->getAttribute('a1'));
     $this->assertEquals('v2', $this->node->getAttribute('a2'));
 }
示例#2
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;
 }
示例#3
0
 private function adjustStaticResolution(fDOMElement $ctx)
 {
     $container = $ctx->queryOne('.//phpdox:docblock/phpdox:return|.//phpdox:docblock/phpdox:var');
     if (!$container || $container->getAttribute('resolution') !== 'static') {
         return;
     }
     $type = $container->queryOne('phpdox:type');
     if (!$type) {
         return;
     }
     foreach (array('full', 'namespace', 'name') as $attribute) {
         $type->setAttribute($attribute, $this->rootNode->getAttribute($attribute));
     }
 }
示例#4
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;
 }
示例#5
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');
 }
示例#7
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);
 }
示例#8
0
 public function isProtected()
 {
     return $this->node->getAttribute('visibility', 'public') == 'protected';
 }
示例#9
0
 public function getName() {
     return $this->ctx->getAttribute('name');
 }
示例#10
0
 /**
  * @return string
  */
 public function getName()
 {
     return $this->element->getAttribute('name');
 }
示例#11
0
文件: Method.php 项目: renanbr/phpact
 /**
  * @return bool
  */
 public function getVisibility()
 {
     return $this->element->getAttribute('visibility');
 }
示例#12
0
 public function getValue()
 {
     return $this->node->getAttribute('value');
 }
示例#13
0
 /**
  * @return string
  */
 public function getNamespace() {
     return $this->rootNode->getAttribute('namespace');
 }