Skip to content

Commit

Permalink
Merge pull request #137 from mixinix/develop
Browse files Browse the repository at this point in the history
 	Improvement, debug bar Matched Route - Params
  • Loading branch information
lonnieezell authored Jul 1, 2016
2 parents 86ec550 + dd392ba commit ab76571
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
15 changes: 14 additions & 1 deletion system/Debug/Toolbar/Collectors/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,20 @@ public function display(): string
$output .= "<tr><td>Directory:</td><td>".htmlspecialchars($router->directory())."</td></tr>";
$output .= "<tr><td>Controller:</td><td>".htmlspecialchars($router->controllerName())."</td></tr>";
$output .= "<tr><td>Method:</td><td>".htmlspecialchars($router->methodName())."</td></tr>";
$output .= "<tr><td>Params:</td><td>".print_r($router->params(), true)."</td></tr>";

$method = new \ReflectionMethod($router->controllerName(), $router->methodName());
$params = $method->getParameters();

$output .= "<tr><td>Params:</td><td>".count($router->params())."/".count($params)."</td></tr>";

foreach($params as $key => $param)
{
$output .= '<tr class="route-params-item"><td>'.$param->getName()." :</td><td>";
$output .= isset($router->params()[$key])
? $router->params()[$key]
: "&lt;empty&gt;&nbsp| default: ".var_export($param->getDefaultValue(), true);
$output .= '</td></tr>';
}

$output .= "</table></tbody>";

Expand Down
9 changes: 9 additions & 0 deletions system/Debug/Toolbar/View/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,13 @@ body {
bottom: 9px;
border-radius: 3px;
background-color: #999;
}
#debug-bar .route-params,
#debug-bar .route-params-item {
vertical-align: top;
}
#debug-bar .route-params-item td:first-child {
padding-left: 1em;
text-align: right;
font-style: italic;
}

0 comments on commit ab76571

Please sign in to comment.