getName() public method

public getName ( ) : string
return string
Ejemplo n.º 1
0
 public function addImplementor(AbstractUnitObject $unit)
 {
     if ($this->getRootNode()->queryOne(sprintf('phpdox:implementor[@full = "%s"]', $unit->getName())) !== NULL) {
         return;
     }
     $implementor = $this->getRootNode()->appendElementNS(self::XMLNS, 'implementor');
     $this->setName($unit->getName(), $implementor);
 }
Ejemplo n.º 2
0
 private function addUnresolved(AbstractUnitObject $unit, $missingUnit)
 {
     $unitName = $unit->getName();
     if (isset($this->unresolved[$unitName])) {
         if (!is_array($this->unresolved[$unitName])) {
             $this->unresolved[$unitName] = array($this->unresolved[$unitName]);
         }
         $this->unresolved[$unitName][] = $missingUnit;
     } else {
         $this->unresolved[$unitName] = $missingUnit;
     }
     $unit->markDependencyAsUnresolved($missingUnit);
     $this->project->registerForSaving($unit);
 }
Ejemplo n.º 3
0
 public function importTraitExports(AbstractUnitObject $trait, TraitUseObject $use)
 {
     $container = $this->rootNode->queryOne(sprintf('phpdox:trait[@full="%s"]', $trait->getName()));
     if ($container instanceof fDOMElement) {
         $container->parentNode->removeChild($container);
     }
     $container = $this->rootNode->appendElementNS(self::XMLNS, 'trait');
     $this->setName($trait->getName(), $container);
     if ($trait->hasExtends()) {
         foreach ($trait->getExtends() as $name) {
             $extends = $container->appendElementNS(self::XMLNS, 'extends');
             $this->setName($name, $extends);
         }
     }
     if ($trait->usesTraits()) {
         foreach ($trait->getUsedTraits() as $name) {
             $used = $container->appendElementNS(self::XMLNS, 'uses');
             $this->setName($name, $used);
         }
     }
     foreach ($trait->getConstants() as $constant) {
         $container->appendChild($this->dom->importNode($constant->export(), TRUE));
     }
     foreach ($trait->getExportedMembers() as $member) {
         $memberNode = $this->dom->importNode($member->export(), TRUE);
         $this->adjustStaticResolution($memberNode);
         $container->appendChild($memberNode);
     }
     foreach ($trait->getExportedMethods() as $method) {
         $methodName = $method->getName();
         $methodNode = $this->dom->importNode($method->export(), TRUE);
         if (!$use->isExcluded($methodName)) {
             $container->appendChild($methodNode);
         }
         $this->adjustStaticResolution($methodNode);
         $aliasNode = NULL;
         if ($use->isAliased($methodName)) {
             $aliasNode = $methodNode->cloneNode(true);
             $aliasNode->setAttribute('original', $aliasNode->getAttribute('name'));
             $aliasNode->setAttribute('name', $use->getAliasedName($methodName));
             if ($use->hasAliasedModifier($methodName)) {
                 $aliasNode->setAttribute('visibility', $use->getAliasedModifier($methodName));
             }
             $container->appendChild($aliasNode);
         }
     }
 }
Ejemplo n.º 4
0
 private function addUnresolved(AbstractUnitObject $unit, $missingUnit)
 {
     $unitName = $unit->getName();
     if (!isset($this->unresolved[$unitName])) {
         $this->unresolved[$unitName] = array();
     }
     $this->unresolved[$unitName][] = $missingUnit;
     $this->project->registerForSaving($unit);
 }
Ejemplo n.º 5
0
 public function registerForSaving(AbstractUnitObject $unit)
 {
     $this->saveUnits[$unit->getName()] = $unit;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
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);
                }
            }

            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) {
                $methodNode = $this->dom->importNode($method->export(), TRUE);
                $parent->appendChild( $methodNode );
                if ($this->hasMethod($method->getName())) {
                    $unitMethod = $this->getMethod($method->getName());
                    if ($unitMethod->hasInheritDoc()) {
                        $unitMethod->inhertDocBlock($method);
                    }
                }
            }
        }