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

Commit

Permalink
Merge branch 'hotfix/220'
Browse files Browse the repository at this point in the history
Close #220
Fixes #219
  • Loading branch information
weierophinney committed Sep 8, 2016
2 parents 3231228 + aa23d88 commit 011eb67
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ All notable changes to this project will be documented in this file, in reverse
- [#217](https://github.com/zendframework/ZendDeveloperTools/pull/217) adds
support in the `SerializableException` for PHP 7 Throwables, including Error
types.
- [#220](https://github.com/zendframework/ZendDeveloperTools/pull/220) adds
support for displaying matched route parameters other than just the controller
and action.

### Deprecated

Expand Down
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 011eb67

Please sign in to comment.