2 namespace Consolidation\AnnotatedCommand\Parser\Internal;
4 use Consolidation\AnnotatedCommand\Parser\CommandInfo;
7 * Create an appropriate CommandDocBlockParser.
9 class CommandDocBlockParserFactory
11 public static function parse(CommandInfo $commandInfo, \ReflectionMethod $reflection)
13 return static::create($commandInfo, $reflection)->parse();
16 private static function create(CommandInfo $commandInfo, \ReflectionMethod $reflection)
18 if (static::hasReflectionDocBlock3()) {
19 return new CommandDocBlockParser3($commandInfo, $reflection);
21 return new CommandDocBlockParser2($commandInfo, $reflection);
24 private static function hasReflectionDocBlock3()
26 return class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory');