/**
* Have the appropriate worker execute a command
*
* @param Command $command
* @return mixed
*/
public function execute(Command $command)
{
$worker = $this->getWorker($command->getName());
$args = $command->getArguments();
foreach ($worker->getRequiredParameters() as $param) {
if (!array_key_exists($param, $args)) {
throw new InvalidArgumentException("Command '" . $command->getName() . "' requires parameter '" . $param . "''");
}
}
return $worker->execute($args);
}