protected function createFileDescriptorCreationMock()
 {
     $fileDescriptor = m::mock('phpDocumentor\\Descriptor\\FileDescriptor');
     $fileDescriptor->shouldReceive('setErrors');
     $fileDescriptor->shouldReceive('getPath')->andReturn('abc');
     $fileAssembler = m::mock('stdClass');
     $fileAssembler->shouldReceive('setBuilder')->withAnyArgs();
     $fileAssembler->shouldReceive('create')->with('phpDocumentor\\Reflection\\FileReflector')->andReturn($fileDescriptor);
     $this->assemblerFactory->shouldReceive('get')->with('phpDocumentor\\Reflection\\FileReflector')->andReturn($fileAssembler);
 }
 /**
  * Registers the Assemblers used to convert Reflection objects to Descriptors.
  *
  * @param AssemblerFactory   $factory
  * @param \Cilex\Application $app
  *
  * @return AssemblerFactory
  */
 public function attachAssemblersToFactory(AssemblerFactory $factory, Application $app)
 {
     // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line
     $fileMatcher = function ($criteria) {
         return $criteria instanceof FileReflector;
     };
     $constantMatcher = function ($criteria) {
         return $criteria instanceof ConstantReflector || $criteria instanceof ClassConstant;
     };
     $traitMatcher = function ($criteria) {
         return $criteria instanceof TraitReflector;
     };
     $classMatcher = function ($criteria) {
         return $criteria instanceof ClassReflector;
     };
     $interfaceMatcher = function ($criteria) {
         return $criteria instanceof InterfaceReflector;
     };
     $propertyMatcher = function ($criteria) {
         return $criteria instanceof ClassReflector\PropertyReflector;
     };
     $methodMatcher = function ($criteria) {
         return $criteria instanceof ClassReflector\MethodReflector;
     };
     $argumentMatcher = function ($criteria) {
         return $criteria instanceof FunctionReflector\ArgumentReflector;
     };
     $functionMatcher = function ($criteria) {
         return $criteria instanceof FunctionReflector;
     };
     $authorMatcher = function ($criteria) {
         return $criteria instanceof AuthorTag;
     };
     $deprecatedMatcher = function ($criteria) {
         return $criteria instanceof DeprecatedTag;
     };
     $exampleMatcher = function ($criteria) {
         return $criteria instanceof ExampleTag;
     };
     $linkMatcher = function ($criteria) {
         return $criteria instanceof LinkTag;
     };
     $methodTagMatcher = function ($criteria) {
         return $criteria instanceof MethodTag;
     };
     $propertyTagMatcher = function ($criteria) {
         return $criteria instanceof PropertyTag;
     };
     $paramMatcher = function ($criteria) {
         return $criteria instanceof ParamTag;
     };
     $throwsMatcher = function ($criteria) {
         return $criteria instanceof ThrowsTag;
     };
     $returnMatcher = function ($criteria) {
         return $criteria instanceof ReturnTag;
     };
     $usesMatcher = function ($criteria) {
         return $criteria instanceof UsesTag;
     };
     $seeMatcher = function ($criteria) {
         return $criteria instanceof SeeTag;
     };
     $sinceMatcher = function ($criteria) {
         return $criteria instanceof SinceTag;
     };
     $varMatcher = function ($criteria) {
         return $criteria instanceof VarTag;
     };
     $versionMatcher = function ($criteria) {
         return $criteria instanceof Tag\VersionTag;
     };
     $typeCollectionMatcher = function ($criteria) {
         return $criteria instanceof TypeCollection;
     };
     $tagFallbackMatcher = function ($criteria) {
         return $criteria instanceof Tag;
     };
     // @codingStandardsIgnoreEnd
     $argumentAssembler = new ArgumentAssembler();
     $factory->register($fileMatcher, new FileAssembler());
     $factory->register($constantMatcher, new ConstantAssembler());
     $factory->register($traitMatcher, new TraitAssembler());
     $factory->register($classMatcher, new ClassAssembler());
     $factory->register($interfaceMatcher, new InterfaceAssembler());
     $factory->register($propertyMatcher, new PropertyAssembler());
     $factory->register($argumentMatcher, $argumentAssembler);
     $factory->register($methodMatcher, new MethodAssembler($argumentAssembler));
     $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler));
     $factory->register($authorMatcher, new AuthorAssembler());
     $factory->register($deprecatedMatcher, new DeprecatedAssembler());
     $factory->register($exampleMatcher, new ExampleAssembler($app['parser.example.finder']));
     $factory->register($linkMatcher, new LinkAssembler());
     $factory->register($methodTagMatcher, new MethodTagAssembler());
     $factory->register($propertyTagMatcher, new PropertyTagAssembler());
     $factory->register($varMatcher, new VarAssembler());
     $factory->register($paramMatcher, new ParamAssembler());
     $factory->register($throwsMatcher, new ThrowsAssembler());
     $factory->register($returnMatcher, new ReturnAssembler());
     $factory->register($usesMatcher, new UsesAssembler());
     $factory->register($seeMatcher, new SeeAssembler());
     $factory->register($sinceMatcher, new SinceAssembler());
     $factory->register($versionMatcher, new VersionAssembler());
     $factory->register($typeCollectionMatcher, new TypeCollectionAssembler());
     $factory->registerFallback($tagFallbackMatcher, new GenericTagAssembler());
     return $factory;
 }
 /**
  * Attempts to find an assembler matching the given data.
  *
  * @param mixed $data
  *
  * @return AssemblerAbstract
  */
 public function getAssembler($data)
 {
     return $this->assemblerFactory->get($data);
 }
 /**
  * Registers the Assemblers used to convert Reflection objects to Descriptors.
  *
  * @param AssemblerFactory $factory
  *
  * @return AssemblerFactory
  */
 public function attachAssemblersToFactory(AssemblerFactory $factory)
 {
     $fileMatcher = function ($criteria) {
         return $criteria instanceof FileReflector;
     };
     $constantMatcher = function ($criteria) {
         return $criteria instanceof ConstantReflector || $criteria instanceof ClassConstant;
     };
     $classMatcher = function ($criteria) {
         return $criteria instanceof ClassReflector;
     };
     $interfaceMatcher = function ($criteria) {
         return $criteria instanceof InterfaceReflector;
     };
     $traitMatcher = function ($criteria) {
         return $criteria instanceof TraitReflector;
     };
     $propertyMatcher = function ($criteria) {
         return $criteria instanceof ClassReflector\PropertyReflector;
     };
     $methodMatcher = function ($criteria) {
         return $criteria instanceof ClassReflector\MethodReflector;
     };
     $argumentMatcher = function ($criteria) {
         return $criteria instanceof FunctionReflector\ArgumentReflector;
     };
     $functionMatcher = function ($criteria) {
         return $criteria instanceof FunctionReflector;
     };
     $authorMatcher = function ($criteria) {
         return $criteria instanceof AuthorTag;
     };
     $linkMatcher = function ($criteria) {
         return $criteria instanceof LinkTag;
     };
     $methodTagMatcher = function ($criteria) {
         return $criteria instanceof MethodTag;
     };
     $propertyTagMatcher = function ($criteria) {
         return $criteria instanceof PropertyTag;
     };
     $paramMatcher = function ($criteria) {
         return $criteria instanceof ParamTag;
     };
     $throwsMatcher = function ($criteria) {
         return $criteria instanceof ThrowsTag;
     };
     $returnMatcher = function ($criteria) {
         return $criteria instanceof ReturnTag;
     };
     $usesMatcher = function ($criteria) {
         return $criteria instanceof UsesTag;
     };
     $seeMatcher = function ($criteria) {
         return $criteria instanceof SeeTag;
     };
     $sinceMatcher = function ($criteria) {
         return $criteria instanceof SinceTag;
     };
     $varMatcher = function ($criteria) {
         return $criteria instanceof VarTag;
     };
     $versionMatcher = function ($criteria) {
         return $criteria instanceof Tag\VersionTag;
     };
     $tagFallbackMatcher = function ($criteria) {
         return $criteria instanceof Tag;
     };
     $factory->register($fileMatcher, new FileAssembler());
     $factory->register($constantMatcher, new ConstantAssembler());
     $factory->register($classMatcher, new ClassAssembler());
     $factory->register($interfaceMatcher, new InterfaceAssembler());
     $factory->register($traitMatcher, new TraitAssembler());
     $factory->register($propertyMatcher, new PropertyAssembler());
     $factory->register($methodMatcher, new MethodAssembler());
     $factory->register($argumentMatcher, new ArgumentAssembler());
     $factory->register($functionMatcher, new FunctionAssembler());
     $factory->register($authorMatcher, new AuthorAssembler());
     $factory->register($linkMatcher, new LinkAssembler());
     $factory->register($methodTagMatcher, new MethodTagAssembler());
     $factory->register($propertyTagMatcher, new PropertyTagAssembler());
     $factory->register($paramMatcher, new ParamAssembler());
     $factory->register($throwsMatcher, new ThrowsAssembler());
     $factory->register($returnMatcher, new ReturnAssembler());
     $factory->register($usesMatcher, new UsesAssembler());
     $factory->register($seeMatcher, new SeeAssembler());
     $factory->register($sinceMatcher, new SinceAssembler());
     $factory->register($varMatcher, new VarAssembler());
     $factory->register($versionMatcher, new VersionAssembler());
     $factory->registerFallback($tagFallbackMatcher, new GenericTagAssembler());
     return $factory;
 }