/**
  * Overrides the name and namespace of an element with a separated version of the class name.
  *
  * If a class is separated by underscores than the last part is set as name and the first parts are set as
  * namespace with the namespace separator instead of an underscore.
  *
  * @param DescriptorAbstract $value
  *
  * @return DescriptorAbstract|null
  */
 public function filter($value)
 {
     if ($value) {
         $namespace = $value->getNamespace() == '' ? '\\' . $this->namespacePrefix : $value->getNamespace();
         $value->setNamespace($this->namespaceFromLegacyNamespace($namespace, $value->getName()));
         $value->setName($this->classNameFromLegacyNamespace($value->getName()));
     }
     return $value;
 }
 /**
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::setName
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::getName
  */
 public function testSettingAndGettingName()
 {
     $this->assertSame('', $this->fixture->getName());
     $this->fixture->setName('name');
     $this->assertSame('name', $this->fixture->getName());
 }
Пример #3
0
 /**
  * Uses the currently selected node and transformation to assemble the destination path for the file.
  *
  * @param DescriptorAbstract $node
  * @param Transformation     $transformation
  *
  * @return string|false returns the destination location or false if generation should be aborted.
  */
 protected function getDestinationPath($node, Transformation $transformation)
 {
     $this->destinationPath = $this->destinationPath ?: sys_get_temp_dir() . DIRECTORY_SEPARATOR . md5($node->getName());
     return $this->destinationPath;
 }