File Coverage.php
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Kahlan\Reporter;
use Kahlan\Jit\ClassLoader;
use Kahlan\Reporter\Coverage\Collector;
Function _getMetricsReport
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
{
$list = [];
foreach ($children as $child) {
$type = $child->type();
- 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
Method _renderMetricsReport
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _renderMetricsReport($metricsReport, $labelWidth, $lineWidth, $depth)
{
$nbChilden = count($metricsReport);
$index = 0;
foreach ($metricsReport as $name => $data) {
Function _renderCoverage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function _renderCoverage($metrics)
{
$stats = $metrics->data();
foreach ($stats['files'] as $file) {
$this->write("File: {$file}" . "\n\n");
- 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
Method _renderCoverage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _renderCoverage($metrics)
{
$stats = $metrics->data();
foreach ($stats['files'] as $file) {
$this->write("File: {$file}" . "\n\n");
Method _renderMetrics
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _renderMetrics($metrics, $verbosity)
{
$maxLabelWidth = null;
if ($verbosity === 1) {
return;
Method _getMetricsReport
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
{
$list = [];
foreach ($children as $child) {
$type = $child->type();
Method stop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stop($summary)
{
if (!$this->_verbosity) {
return;
}
Function _renderMetricsReport
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _renderMetricsReport($metricsReport, $labelWidth, $lineWidth, $depth)
{
$nbChilden = count($metricsReport);
$index = 0;
foreach ($metricsReport as $name => $data) {
- 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
Method _getMetricsReport
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)