Skip to content

Commit

Permalink
update ...
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Mar 19, 2018
1 parent f302428 commit 5dfec9b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function run()
$command = App::getBean('command');
$command->run();
} catch (\Throwable $e) {
output()->writeln(sprintf('<error>%s</error>', $e->getMessage()), true, false);
output()->writeln(sprintf('<error>%s</error>', $e->getTraceAsString()), true, true);
\output()->writeln(sprintf('<error>%s</error>', $e->getMessage()), true, false);
\output()->writeln(sprintf("Trace:\n%s", $e->getTraceAsString()), true, true);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Output/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Output implements OutputInterface
public function writeln($messages = '', $newline = true, $quit = false)
{
if (\is_array($messages)) {
$messages = implode($newline ? PHP_EOL : '', $messages);
$messages = \implode($newline ? PHP_EOL : '', $messages);
}

// 文字里面颜色标签翻译
Expand Down Expand Up @@ -111,7 +111,7 @@ private function writeItems(array $items, string $cmdStyle)

// 命令和描述
$maxLength = $this->getCmdMaxLength(array_keys($items));
$cmd = str_pad($cmd, $maxLength, ' ');
$cmd = \str_pad($cmd, $maxLength, ' ');
$cmd = "<$cmdStyle>$cmd</$cmdStyle>";
$message = self::LEFT_CHAR . $cmd . self::GAP_CHAR . $desc;

Expand Down
10 changes: 5 additions & 5 deletions src/Router/HandlerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ private function getBindParams(string $className, string $methodName): array
/**
* execute command by coroutine
*
* @param object $class
* @param mixed $class
* @param string $method
* @param bool $server
* @param array $bindParams
*/
private function executeCommandByCoroutine($class, string $method, bool $server, $bindParams)
{
Coroutine::create(function () use ($class, $method, $server, $bindParams) {
$this->beforeCommand(get_parent_class($class), $method, $server);
$this->beforeCommand(\get_parent_class($class), $method, $server);
PhpHelper::call([$class, $method], $bindParams);
$this->afterCommand($method, $server);
});
Expand All @@ -101,14 +101,14 @@ private function executeCommandByCoroutine($class, string $method, bool $server,
/**
* execute command
*
* @param object $class
* @param mixed $class
* @param string $method
* @param bool $server
* @param array $bindParams
*/
private function executeCommand($class, string $method, bool $server, $bindParams)
{
$this->beforeCommand(get_parent_class($class), $method, $server);
$this->beforeCommand(\get_parent_class($class), $method, $server);
PhpHelper::call([$class, $method], $bindParams);
$this->afterCommand($method, $server);
}
Expand Down Expand Up @@ -177,4 +177,4 @@ private function bootstrap()
}
}
}
}
}
12 changes: 6 additions & 6 deletions src/Router/HandlerMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class HandlerMapping implements HandlerMappingInterface
/**
* the default command
*/
private $deaultCommand = 'index';
private $defaultCommand = 'index';

/**
* the delimiter
Expand Down Expand Up @@ -83,7 +83,7 @@ public function register(array $commandMapping)
*/
public function isDefaultCommand(string $comamnd): bool
{
return $comamnd === $this->deaultCommand;
return $comamnd === $this->defaultCommand;
}

/**
Expand All @@ -109,7 +109,7 @@ private function getGroupAndCommand(): array
}

if (empty($command)) {
$command = $this->deaultCommand;
$command = $this->defaultCommand;
}

return [$group, $command];
Expand Down Expand Up @@ -153,8 +153,8 @@ private function registerRoute(string $className, array $routes, string $prefix,
$this->routes[$commandKey] = [$className, $methodName, $coroutine, $server];
}

$commandKey = $this->getCommandString($prefix, $this->deaultCommand);
$this->routes[$commandKey] = [$className, $this->deaultCommand];
$commandKey = $this->getCommandString($prefix, $this->defaultCommand);
$this->routes[$commandKey] = [$className, $this->defaultCommand];
}

/**
Expand Down Expand Up @@ -191,4 +191,4 @@ private function getCommandString(string $group, string $command): string
{
return sprintf('%s%s%s', $group, $this->delimiter, $command);
}
}
}

0 comments on commit 5dfec9b

Please sign in to comment.