Function findClasses
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
private function findClasses(string $namespace, string $pattern, array $excludePatterns): array
{
$classNames = [];
$container = $this->container;
- 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 DefinitionBuilder.php
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/*
Function findResourcePath
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function findResourcePath(string $namespace): string
{
foreach (\spl_autoload_functions() as $classLoader) {
if (!\is_array($classLoader)) {
continue;
- 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
DefinitionBuilder
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class DefinitionBuilder implements ResetInterface
{
private ?string $definition = null, $directory = null;
private bool $trackDefaults = false, $condition = true;
Function doCreate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function doCreate(object $definition): void
{
$this->trackDefaults = false;
foreach ($this->defaults as $offset => $defaultMethods) {
- 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 findClasses
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function findClasses(string $namespace, string $pattern, array $excludePatterns): array
{
$classNames = [];
$container = $this->container;
Function namespaced
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function namespaced(string $namespace, string $resource = null, $exclude = null)
{
if (!$this->condition) {
return $this;
}
- 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 findClass
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function findClass(Container $container, string $class, string $path, string $pattern): ?string
{
if (!\preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/', $class)) {
return null;
}
- 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 __destruct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __destruct()
{
if (!empty($this->classes)) {
foreach ($this->classes as [$definition, $classes]) {
// prepare for deep cloning
- 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 __call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __call(string $name, array $arguments)
{
if (!$this->condition) {
return $this;
}
- 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"