Skip to content

Commit

Permalink
Merge pull request #8770 from open-sausages/pulls/4/correct-doc-for-e…
Browse files Browse the repository at this point in the history
…xec-metric-middleware

DOCS Correct documentation for ExecMetricMiddleware
  • Loading branch information
ScopeyNZ authored Jan 30, 2019
2 parents 2378d75 + 8ec9c50 commit 6f619fa
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 6f619fa

Please sign in to comment.