/**
  * Creates a Descriptor from the provided data.
  *
  * @param FileReflector $data
  *
  * @return FileDescriptor
  */
 public function create($data)
 {
     $fileDescriptor = new FileDescriptor($data->getHash());
     $fileDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: $data->getDefaultPackageName());
     $packages = new Collection();
     $package = $this->extractPackageFromDocBlock($data->getDocBlock());
     if (!$package) {
         $package = $data->getDefaultPackageName();
     }
     $tag = new TagDescriptor('package');
     $tag->setDescription($package);
     $packages->add($tag);
     $fileDescriptor->getTags()->set('package', $packages);
     $fileDescriptor->setName(basename($data->getFilename()));
     $fileDescriptor->setPath($data->getFilename());
     $fileDescriptor->setSource($data->getContents());
     $fileDescriptor->setIncludes(new Collection($data->getIncludes()));
     $fileDescriptor->setNamespaceAliases(new Collection($data->getNamespaceAliases()));
     $this->assembleDocBlock($data->getDocBlock(), $fileDescriptor);
     $this->addMarkers($data->getMarkers(), $fileDescriptor);
     $this->addConstants($data->getConstants(), $fileDescriptor);
     $this->addFunctions($data->getFunctions(), $fileDescriptor);
     $this->addClasses($data->getClasses(), $fileDescriptor);
     $this->addInterfaces($data->getInterfaces(), $fileDescriptor);
     $this->addTraits($data->getTraits(), $fileDescriptor);
     return $fileDescriptor;
 }
 /**
  * Creates a Descriptor from the provided data.
  *
  * @param FileReflector $data
  *
  * @return FileDescriptor
  */
 public function create($data)
 {
     $fileDescriptor = new FileDescriptor($data->getHash());
     $fileDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: $data->getDefaultPackageName());
     $fileDescriptor->setName(basename($data->getFilename()));
     $fileDescriptor->setPath($data->getFilename());
     $fileDescriptor->setSource($data->getContents());
     $fileDescriptor->setIncludes(new Collection($data->getIncludes()));
     $fileDescriptor->setNamespaceAliases(new Collection($data->getNamespaceAliases()));
     $this->assembleDocBlock($data->getDocBlock(), $fileDescriptor);
     $this->overridePackageTag($data, $fileDescriptor);
     $this->addMarkers($data->getMarkers(), $fileDescriptor);
     $this->addConstants($data->getConstants(), $fileDescriptor);
     $this->addFunctions($data->getFunctions(), $fileDescriptor);
     $this->addClasses($data->getClasses(), $fileDescriptor);
     $this->addInterfaces($data->getInterfaces(), $fileDescriptor);
     $this->addTraits($data->getTraits(), $fileDescriptor);
     return $fileDescriptor;
 }
 /**
  * @covers phpDocumentor\Descriptor\FileDescriptor::setPath
  * @covers phpDocumentor\Descriptor\FileDescriptor::getPath
  */
 public function testSetAndGetPath()
 {
     $this->assertSame('', $this->fixture->getPath());
     $this->fixture->setPath(self::EXAMPLE_PATH);
     $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath());
 }