Showing 17 of 17 total issues
Function iterate
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function iterate (ContextInterface $parent)
{
$path = $parent->getName();
if (is_dir($path)) {
foreach (new \DirectoryIterator ($path) as $fileInfo)
- 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 getName
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function getName()
{
$name = '';
$separator = '';
- 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 getName
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getName()
{
$name = '';
$separator = '';
Method iterate
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function iterate (ContextInterface $parent)
{
$path = $parent->getName();
if (is_dir($path)) {
foreach (new \DirectoryIterator ($path) as $fileInfo)
Method generateIndexFile
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateIndexFile (ContextInterface $path)
{
// list directory
$files = [];
$dirs = [];
Function getContextsNumberOfIssues
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getContextsNumberOfIssues()
{
$list = [];
foreach ($this->getChildren() as $child)
- 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 methodMan
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function methodMan ($x, $y, $z)
{
// globals, over multiple lines
global $boom,
$bass;
Method getContextsNumberOfIssues
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getContextsNumberOfIssues()
{
$list = [];
foreach ($this->getChildren() as $child)
Function leaveNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function leaveNode (PhpParser\Node $node)
{
// check for "new" statements
if ($node instanceof Expr\New_ && !$this->inGlobalScope() && !$this->insideThrow)
{
- 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 leaveNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function leaveNode (PhpParser\Node $node)
{
if ($node instanceof Expr\ClassConstFetch && !$this->inGlobalScope())
{
$parentClass = $this->stack->findContextOfType(new CollectionSpecification);
- 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 enterNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function enterNode (PhpParser\Node $node)
{
if ($this->isClass($node))
{
// create new context, keep parent
- 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
Avoid too many return
statements within this method. Open
return false;
Function getIssues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getIssues ($recursive = false, ContextSpecificationInterface $filter = null)
{
$list = $this->issues;
if ($recursive === true)
- 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 isDirExcluded
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isDirExcluded ($path)
{
foreach ($this->excludedDirs as $needle)
{
if (empty($needle)) {
- 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 leaveNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function leaveNode (PhpParser\Node $node)
{
// check for empty catch statements
if ($node instanceof Stmt\Catch_)
{
- 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 hasIssues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function hasIssues ($recursive = false, ContextSpecificationInterface $filter = null)
{
if ($recursive === true)
{
foreach ($this->getChildrenRecursively($filter) as $child)
- 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 enterNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function enterNode (PhpParser\Node $node)
{
if ($node instanceof Stmt\ClassMethod)
{
// create new context, keep parent
- 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"