| Conditions | 4 |
| Paths | 5 |
| Total Lines | 29 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function getWidgets() |
||
| 13 | { |
||
| 14 | $widgets = parent::getWidgets(); |
||
| 15 | $widgets['time']['warn'] = false; |
||
| 16 | // Request duration rather than Request Duration |
||
| 17 | $widgets['time']['tooltip'] = ucfirst(strtolower($widgets['time']['tooltip'])); |
||
| 18 | |||
| 19 | $upperThreshold = DebugBar::config()->warn_request_time_seconds; |
||
| 20 | $warningRatio = DebugBar::config()->warn_warning_ratio; |
||
| 21 | |||
| 22 | // Can be disabled by setting the value to false |
||
| 23 | if (!is_numeric($upperThreshold)) { |
||
| 24 | return $widgets; |
||
| 25 | } |
||
| 26 | |||
| 27 | $warningThreshold = $upperThreshold * $warningRatio; |
||
| 28 | if ($this->getRequestDuration() > $warningThreshold) { |
||
| 29 | $widgets['time']['indicator'] = 'PhpDebugBar.DebugBar.WarnableRequestTimeIndicator'; |
||
| 30 | $widgets['time']['warn'] = 'warning'; |
||
| 31 | $widgets['time']['warn_threshold_seconds'] = $warningThreshold; |
||
| 32 | } |
||
| 33 | |||
| 34 | if ($this->getRequestDuration() > $upperThreshold) { |
||
| 35 | $widgets['time']['warn'] = 'danger'; |
||
| 36 | $widgets['time']['warn_threshold_seconds'] = $upperThreshold; |
||
| 37 | } |
||
| 38 | |||
| 39 | return $widgets; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.