Ejemplo n.º 1
0
 /**
  * Creates a Descriptor from the provided data.
  *
  * @param ConstantReflector $data
  *
  * @return ConstantDescriptor
  */
 public function create($data)
 {
     $constantDescriptor = new ConstantDescriptor();
     $constantDescriptor->setName($data->getShortName());
     $constantDescriptor->setValue($data->getValue());
     // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself
     $constantDescriptor->setNamespace('\\' . (strtolower($data->getNamespace()) == 'global' ? '' : $data->getNamespace()));
     $constantDescriptor->setFullyQualifiedStructuralElementName((trim($constantDescriptor->getNamespace(), '\\') ? $constantDescriptor->getNamespace() : '') . '\\' . $data->getShortName());
     $this->assembleDocBlock($data->getDocBlock(), $constantDescriptor);
     $constantDescriptor->setLine($data->getLinenumber());
     return $constantDescriptor;
 }
 /**
  * @covers phpDocumentor\Descriptor\ConstantDescriptor::getValue
  * @covers phpDocumentor\Descriptor\ConstantDescriptor::setValue
  */
 public function testSetAndGetValue()
 {
     $this->assertSame(null, $this->fixture->getValue());
     $this->fixture->setValue('a');
     $this->assertSame('a', $this->fixture->getValue());
 }