Function _coverage
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function _coverage($file, $coverage)
{
$result = [];
$root = $this->parse($file);
foreach ($root->lines['content'] as $num => $content) {
- 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
File Collector.php
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Kahlan\Reporter\Coverage;
use Kahlan\Jit\Parser;
use Kahlan\Dir\Dir;
Method _coverage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _coverage($file, $coverage)
{
$result = [];
$root = $this->parse($file);
foreach ($root->lines['content'] as $num => $content) {
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($config = [])
{
$defaults = [
'driver' => null,
'path' => [],
Function addFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addFile($file, $coverage)
{
$file = $this->realpath($file);
if (!$this->collectable($file)) {
return;
- 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
Function _processMetrics
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function _processMetrics($file, $node, $coverage)
{
$metrics = [
'loc' => 0,
'nlloc' => 0,
- 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
Function _processNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function _processNode($file, $node, $coverage, $path)
{
if ($node->type === 'namespace') {
$path = "{$path}" . $node->name . '\\';
$this->_processTree($file, $node->tree, $coverage, $path);
- 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"