getLocalName() public method

public getLocalName ( ) : string
return string
Exemplo n.º 1
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('namespace', $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);
         }
     }
     if ($unit->hasImplements()) {
         foreach ($unit->getImplements() as $name) {
             $implements = $parent->appendElementNS(self::XMLNS, 'implements');
             $this->setName($name, $implements);
         }
     }
     if ($unit->usesTraits()) {
         foreach ($unit->getUsedTraits() as $name) {
             $uses = $parent->appendElementNS(self::XMLNS, 'uses');
             $this->setName($name, $uses);
         }
     }
     foreach ($unit->getConstants() as $constant) {
         $parent->appendChild($this->dom->importNode($constant->export(), TRUE));
     }
     foreach ($unit->getExportedMembers() as $member) {
         $memberNode = $this->dom->importNode($member->export(), TRUE);
         $this->adjustStaticResolution($memberNode);
         $parent->appendChild($memberNode);
     }
     foreach ($unit->getExportedMethods() as $method) {
         $methodNode = $this->dom->importNode($method->export(), TRUE);
         $this->adjustStaticResolution($methodNode);
         $parent->appendChild($methodNode);
         if ($this->hasMethod($method->getName())) {
             $unitMethod = $this->getMethod($method->getName());
             if ($unitMethod->hasInheritDoc()) {
                 $unitMethod->inhertDocBlock($method);
             }
         }
     }
 }
Exemplo n.º 2
0
 private function saveUnit(array $map, array $reportUnits, AbstractUnitObject $unit)
 {
     $indexNode = $this->index->findUnitNodeByName($unit->getNamespace(), $unit->getLocalName());
     if (!$indexNode) {
         throw new ProjectException(sprintf("Internal Error: Unit '%s' not found in index (ns: %s, n: %s).", $unit->getName(), $unit->getNamespace(), $unit->getLocalName()), ProjectException::UnitNotFoundInIndex);
     }
     $name = str_replace('\\', '_', $unit->getName());
     $dom = $unit->export();
     $dom->formatOutput = TRUE;
     $dom->preserveWhiteSpace = FALSE;
     $fname = $map[$dom->documentElement->localName] . '/' . $name . '.xml';
     try {
         $dom->save($this->xmlDir . '/' . $fname);
     } catch (fDOMException $e) {
         throw new ProjectException(sprintf("Internal Error: Unit '%s' could not be saved (ns: %s, n: %s).", $unit->getName(), $unit->getNamespace(), $unit->getLocalName()), ProjectException::UnitCouldNotBeSaved, $e);
     }
     if ($indexNode->hasAttribute('xml')) {
         $reportUnits = array_merge($reportUnits, $this->findAffectedUnits($fname));
     } else {
         $indexNode->setAttribute('xml', $fname);
     }
     return $reportUnits;
 }
Exemplo n.º 3
0
 /**
  * @param AbstractUnitObject $unit
  */
 private function addUnit(AbstractUnitObject $unit, $type)
 {
     $root = $this->getRootElement();
     if (!$this->findUnitNodeByName($unit->getNamespace(), $unit->getLocalName())) {
         $unitNode = $root->appendElementNS('http://xml.phpdox.net/src', $type);
         $unitNode->setAttribute('name', $unit->getLocalName());
         $src = $unit->getSourceFilename();
         if ($src != '') {
             $unitNode->setAttribute('src', $src->getRelative($this->srcDir, FALSE));
         }
         $desc = $unit->getCompactDescription();
         if ($desc != '') {
             $unitNode->setAttribute('description', $desc);
         }
         $xpath = 'phpdox:namespace[@name="' . $unit->getNamespace() . '"]';
         $ctx = $root->queryOne($xpath);
         if (!$ctx) {
             $ctx = $root->appendElementNS('http://xml.phpdox.net/src', 'namespace');
             $ctx->setAttribute('name', $unit->getNamespace());
         }
         $ctx->appendChild($unitNode);
     }
 }
Exemplo n.º 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));
     }
 }