tapestry-cloud/tapestry

View on GitHub
src/Profiler.php

Summary

Maintainability
A
25 mins
Test Coverage
A
100%

Function report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function report()
    {
        $report = [];
        foreach ($this->items as $item) {
            $name = explode('_', $item['name']);
Severity: Minor
Found in src/Profiler.php - About 25 mins to fix

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 122 characters
Open

        // Filter out any clocks that have no start or finish time, this should probably throw an exception in debug mode?
Severity: Minor
Found in src/Profiler.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

                $report[$name]['memory_consumption'] = $report[$name]['FINISH_memory_use'] - $report[$name]['START_memory_use'];
Severity: Minor
Found in src/Profiler.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

                $report[$name]['execution_time'] = round(($report[$name]['FINISH_time'] - $report[$name]['START_time']), 3);
Severity: Minor
Found in src/Profiler.php by phpcodesniffer

Line exceeds 120 characters; contains 202 characters
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'];
Severity: Minor
Found in src/Profiler.php by phpcodesniffer

There are no issues that match your filters.

Category
Status