Showing 187 of 191 total issues
TokenStream
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class TokenStream implements ArrayAccess, Countable, SeekableIterator
{
/**
* The items contained in the collection.
*
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 _export
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function _export($path, $tree, $coverage)
{
$s = (object) [];
$statementMap = (object) [];
$statementIndex = 0;
Kahlan
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Kahlan
{
public const VERSION = '5.2.6';
/**
Function _console
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function _console()
{
return Filters::run($this, 'console', [], function ($chain) {
$collection = $this->reporters();
- 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
Suite
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Suite
{
/**
* The PHP constraint to respect
*
Function stats
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function stats()
{
if ($this->_stats !== null) {
return $this->_stats;
}
- 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 stats
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stats()
{
if ($this->_stats !== null) {
return $this->_stats;
}
Function _parseArgs
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function _parseArgs()
{
$cpt = 0;
$value = $name = '';
$args = [];
- 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 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;
Terminal
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Terminal extends Reporter
{
/**
* Indicates if the console cursor in on a new line.
*
Function end
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function end($summary)
{
$toString = function ($instance) {
return 'an instance of `' . get_class($instance) . '`';
};
- 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 find
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function find($message, $index = 0, $times = 0, &$args = [])
{
$success = false;
$messages = !is_array($message) ? [$message] : $message;
Method _monkeyPatch
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _monkeyPatch($node, $parent, $index)
{
if (!preg_match_all($this->_regex, $node->body, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
return;
}
Method _help
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _help()
{
$terminal = $this->terminal();
if (!$this->commandLine()->get('no-header')) {
$terminal->write($terminal->kahlan() ."\n\n");
Function method
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function method($path, $closure = null)
{
if ($this->_needToBePatched) {
$layer = Double::classname();
Monkey::patch($this->_reference, $layer);
- 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 method
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function method($path, $closure = null)
{
if ($this->_needToBePatched) {
$layer = Double::classname();
Monkey::patch($this->_reference, $layer);
Method _export
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function _export($path, $tree, $coverage)
{
$result = [
'TN:',
'SF:' . $path
Method end
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function end($summary)
{
$toString = function ($instance) {
return 'an instance of `' . get_class($instance) . '`';
};
Method _findFileWithExtension
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;