Function resolve
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
public function resolve(Resolver $resolver, bool $createMethod = false): mixed
{
if (($this->options['abstract'] ?? false)) {
throw new ContainerResolutionException(\sprintf('Resolving an abstract definition %s is not allowed.', $this->id));
}
- 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 build
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
protected function build(Resolver $resolver, p\BuilderFactory $builder, bool $createMethod): p\Node\Expr|p\Node\Stmt\ClassMethod
{
$defNode = $builder->method($resolver::createMethod($this->id))->makeProtected();
$defTyped = $defNodes = [];
- 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 build
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function build(Resolver $resolver, p\BuilderFactory $builder, bool $createMethod): p\Node\Expr|p\Node\Stmt\ClassMethod
{
$defNode = $builder->method($resolver::createMethod($this->id))->makeProtected();
$defTyped = $defNodes = [];
Method resolve
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolve(Resolver $resolver, bool $createMethod = false): mixed
{
if (($this->options['abstract'] ?? false)) {
throw new ContainerResolutionException(\sprintf('Resolving an abstract definition %s is not allowed.', $this->id));
}
Function setContainer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function setContainer(Container $container, string $id, bool $anonymous = false)
{
$this->container = $container;
$this->id = $id;
- 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 methodExists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function methodExists(mixed $entity, string $method): bool
{
if (\is_string($entity)) {
return \method_exists($entity, $method);
}
- 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;