Showing 6 of 6 total issues
AbstractPhpStruct
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractPhpStruct extends AbstractModel implements NamespaceInterface, DocblockInterface
{
use DocblockPart;
use LongDescriptionPart;
use QualifiedNamePart;
Method configureOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'generateEmptyDocblock' => false,
'enableSorting' => true,
Function write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function write(string $content): self
{
$lines = explode("\n", $content);
for ($i = 0, $c = count($lines); $i < $c; ++$i) {
if ($this->indentationLevel > 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 setTraits
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setTraits(array $traits)
{
$this->traits->clear();
foreach ($traits as $trait) {
if (is_string($trait)) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function build(AbstractModel $model): void
{
if (!$model instanceof PhpMethod) {
throw new \InvalidArgumentException('Method builder can build method classes only.');
}
- 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 compare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function compare($a, $b): int
{
// find first difference
$cmp1 = null;
$cmp2 = 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"