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')); }
/** * @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; }
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)); } }
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'); }
/** * @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 isProtected() { return $this->node->getAttribute('visibility', 'public') == 'protected'; }
public function getName() { return $this->ctx->getAttribute('name'); }
/** * @return string */ public function getName() { return $this->element->getAttribute('name'); }
/** * @return bool */ public function getVisibility() { return $this->element->getAttribute('visibility'); }
public function getValue() { return $this->node->getAttribute('value'); }
/** * @return string */ public function getNamespace() { return $this->rootNode->getAttribute('namespace'); }