Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #220 from samsonasik/all-route-parameters
Browse files Browse the repository at this point in the history
implements #219: Show all routing parameters
  • Loading branch information
weierophinney committed Sep 8, 2016
2 parents 3231228 + 83ac341 commit 952b22e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 13 additions & 1 deletion src/Collector/RequestCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ public function collect(MvcEvent $mvcEvent)
'status' => $mvcEvent->getResponse()->getStatusCode(),
'route' => ($match === null) ? 'N/A' : $match->getMatchedRouteName(),
'action' => ($match === null) ? 'N/A' : $match->getParam('action', 'N/A'),
'controller' => ($match === null) ? 'N/A' : $match->getParam('controller', 'N/A')
'controller' => ($match === null) ? 'N/A' : $match->getParam('controller', 'N/A'),
'other_route_parameters' => ($match === null) ? 'N/A' : array_filter($match->getParams(), function ($key) {
return ! in_array($key, ['action', 'controller']);
}, ARRAY_FILTER_USE_KEY),
];
}

Expand Down Expand Up @@ -141,6 +144,15 @@ public function getControllerName()
return $this->data['controller'];
}

/**
* Returns parameters except controller and actions
* @return array
*/
public function getOtherParameters()
{
return $this->data['other_route_parameters'];
}

/**
* Returns the controller and action name if possible, otherwise N/A.
*
Expand Down
14 changes: 9 additions & 5 deletions view/zend-developer-tools/toolbar/request.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,29 @@ $color = ($statusCode < 400)
</span>
</div>
<div class="zdt-toolbar-detail zdt-toolbar-detail-overflow">
<span class="zdt-toolbar-info zdt-toolbar-info-redundant">
<span class="zdt-toolbar-info">
<span class="zdt-detail-label">Status code</span>
<span class="zdt-detail-value zdt-toolbar-bold zdt-toolbar-color-<?php echo $color; ?>">
<?php echo $statusCode; ?>
</span>
</span>
<span class="zdt-toolbar-info">
<span class="zdt-toolbar-info">
<span class="zdt-detail-label">Method</span>
<span class="zdt-detail-value"><?php echo $this->collector->getMethod(); ?></span>
</span>
<span class="zdt-toolbar-info zdt-toolbar-extra-info-redundant">
<span class="zdt-toolbar-info">
<span class="zdt-detail-label">Controller</span>
<span class="zdt-detail-value"><?php echo $this->collector->getControllerName(); ?></span>
</span>
<span class="zdt-toolbar-info zdt-toolbar-extra-info-redundant">
<span class="zdt-toolbar-info">
<span class="zdt-detail-label">Action</span>
<span class="zdt-detail-value"><?php echo $this->collector->getActionName(); ?></span>
</span>
<span class="zdt-toolbar-info zdt-toolbar-extra-info-redundant">
<span class="zdt-toolbar-info">
<span class="zdt-detail-label">Other Route Parameters</span>
<span class="zdt-detail-value"><?php var_dump( $this->collector->getOtherParameters() ); ?></span>
</span>
<span class="zdt-toolbar-info">
<span class="zdt-detail-label">Route</span>
<span class="zdt-detail-value"><?php echo $this->collector->getRouteName(); ?></span>
</span>
Expand Down

0 comments on commit 952b22e

Please sign in to comment.