/** * Creates a new Descriptor from the given Reflector. * * @param ExampleTag $data * * @throws \InvalidArgumentException if the provided parameter is not of type ExampleTag; the interface won't let * up typehint the signature. * * @return ExampleDescriptor */ public function create($data) { if (!$data instanceof ExampleTag) { throw new \InvalidArgumentException('The ExampleAssembler expected an ExampleTag object to base the descriptor on'); } $descriptor = new ExampleDescriptor($data->getName()); $descriptor->setFilePath((string) $data->getFilePath()); $descriptor->setStartingLine($data->getStartingLine()); $descriptor->setLineCount($data->getLineCount()); $descriptor->setDescription($data->getDescription()); $descriptor->setExample($this->finder->find($descriptor)); return $descriptor; }