Skip to content

Commit

Permalink
Clean up code that supported using non-Shell objects.
Browse files Browse the repository at this point in the history
I think we can remove support for running non-Shell shell commands now.
  • Loading branch information
markstory committed Apr 20, 2014
1 parent 4000c2f commit f6cf866
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Console/ShellDispatcher.php
Expand Up @@ -164,28 +164,8 @@ protected function _dispatch() {
$command = $this->args[0];
}

if ($Shell instanceof Shell) {
$Shell->initialize();
return $Shell->runCommand($command, $this->args);
}

$methods = array_diff(get_class_methods($Shell), get_class_methods('Cake\Console\Shell'));
$added = in_array($command, $methods);
$private = $command[0] === '_' && method_exists($Shell, $command);

if (!$private) {
if ($added) {
$this->shiftArgs();
$Shell->startup();
return $Shell->{$command}();
}
if (method_exists($Shell, 'main')) {
$Shell->startup();
return $Shell->main();
}
}

throw new Error\MissingShellMethodException(['shell' => $shell, 'method' => $command]);
$Shell->initialize();
return $Shell->runCommand($command, $this->args);
}

/**
Expand Down

0 comments on commit f6cf866

Please sign in to comment.