Code Duplication    Length = 5-6 lines in 2 locations

src/Command.php 2 locations

@@ 343-347 (lines=5) @@
340
                $this->parseArguments($args);
341
            } else {
342
                $this->args = (object) $args;
343
                foreach ($options as $name) {
344
                    if (!array_key_exists($name, $this->options))
345
                        throw new \Exception("Unknown option '{$name}'");
346
                    $this->options[$name] = true;
347
                }
348
            }
349
350
            if (null === $this->action)
@@ 375-380 (lines=6) @@
372
        }
373
374
        $arguments = [];
375
        foreach ($args as &$arg) {
376
            if (array_key_exists($arg, $this->options))
377
                $this->options[$arg] = true;
378
            else
379
                $arguments[] = $arg;
380
        }
381
        $arguments = T::join($arguments, ' ');
382
        $this->args = $this->syntax->parse($arguments);
383
    }