Skip to content

Commit

Permalink
DOCS Correct documentation for ExecMetricMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rainville committed Jan 30, 2019
1 parent 2378d75 commit 8ec9c50
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Control/Middleware/ExecMetricMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
use SilverStripe\Dev\Debug;

/**
* Secures requests by only allowing a whitelist of Host values
* Display execution metricts for the current request if in dev mode and `execmetric` is provided as a request variable.
*/
class ExecMetricMiddleware implements HTTPMiddleware
{
/**
* @inheritdoc
*/

public function process(HTTPRequest $request, callable $delegate)
{
if (!$this->showMetric($request)) {
Expand All @@ -38,6 +36,11 @@ public function process(HTTPRequest $request, callable $delegate)
}
}

/**
* Check if execution metric should be shown.
* @param HTTPRequest $request
* @return bool
*/
private function showMetric(HTTPRequest $request)
{
return Director::isDev() && array_key_exists('execmetric', $request->getVars());
Expand Down

0 comments on commit 8ec9c50

Please sign in to comment.