src/Profiler.php
Function report
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function report()
{
$report = [];
foreach ($this->items as $item) {
$name = explode('_', $item['name']);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Line exceeds 120 characters; contains 124 characters Open
Open
$report[$name]['execution_time'] = round(($report[$name]['FINISH_time'] - $report[$name]['START_time']), 3);
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
Open
$report[$name]['memory_consumption'] = $report[$name]['FINISH_memory_use'] - $report[$name]['START_memory_use'];
- Exclude checks
Line exceeds 120 characters; contains 202 characters Open
Open
$report[$name]['memory_peak'] = ($report[$name]['START_memory_peak'] < $report[$name]['FINISH_memory_peak']) ? $report[$name]['FINISH_memory_peak'] : $report[$name]['START_memory_peak'];
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
// Filter out any clocks that have no start or finish time, this should probably throw an exception in debug mode?
- Exclude checks