@@ 76-89 (lines=14) @@ | ||
73 | ||
74 | // Parse the arguments for command names until we fail to find a |
|
75 | // matching command |
|
76 | foreach ($argumentsToTest as $name) { |
|
77 | if (!$namedCommands->contains($name)) { |
|
78 | break; |
|
79 | } |
|
80 | ||
81 | $nextCommand = $namedCommands->get($name); |
|
82 | ||
83 | if ($nextCommand->getConfig() instanceof OptionCommandConfig) { |
|
84 | break; |
|
85 | } |
|
86 | ||
87 | $currentCommand = $nextCommand; |
|
88 | $namedCommands = $currentCommand->getNamedSubCommands(); |
|
89 | } |
|
90 | ||
91 | if (!$currentCommand) { |
|
92 | return null; |
|
@@ 107-121 (lines=15) @@ | ||
104 | */ |
|
105 | private function processOptions(RawArgs $args, Command $currentCommand, array $optionsToTest) |
|
106 | { |
|
107 | foreach ($optionsToTest as $option) { |
|
108 | $commands = $currentCommand->getNamedSubCommands(); |
|
109 | ||
110 | if (!$commands->contains($option)) { |
|
111 | continue; |
|
112 | } |
|
113 | ||
114 | $nextCommand = $commands->get($option); |
|
115 | ||
116 | if (!$nextCommand->getConfig() instanceof OptionCommandConfig) { |
|
117 | break; |
|
118 | } |
|
119 | ||
120 | $currentCommand = $nextCommand; |
|
121 | } |
|
122 | ||
123 | return $this->processDefaultSubCommands($args, $currentCommand); |
|
124 | } |