/** * 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()); }