Skip to content

Commit

Permalink
added Console App Support
Browse files Browse the repository at this point in the history
  • Loading branch information
gevorgmansuryan committed Aug 27, 2018
1 parent 4e2580f commit c7dad83
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,21 @@ public function dispatch()
call_user_func($route->callable, $rule);
}

try {
if ($request = $rule->parseRequest($this->urlManager, $app->request)) {
$params = ArrayHelper::merge($request, [$event]);
foreach ($route->getMiddleware() as $callBack) {
if (is_callable($callBack)) {
call_user_func_array($callBack, $params);
} else {
call_user_func_array([$callBack, 'handle'], $params);
if (Yii::$app instanceof \yii\web\Application) {
try {
if ($request = $rule->parseRequest($this->urlManager, $app->request)) {
$params = ArrayHelper::merge($request, [$event]);
foreach ($route->getMiddleware() as $callBack) {
if (is_callable($callBack)) {
call_user_func_array($callBack, $params);
} else {
call_user_func_array([$callBack, 'handle'], $params);
}
}
}
} catch (UrlNormalizerRedirectException $e) {
//ignore this at this time
}
} catch (UrlNormalizerRedirectException $e) {
//ignore this at this time
}

$this->urlManager->addRules([$rule], true);
Expand Down

0 comments on commit c7dad83

Please sign in to comment.