Showing 6 of 6 total issues
Function registry
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
Open
private function registry(string $type): array
{
// only register once
if (array_key_exists($type, $this->registry)) {
return $this->registry[$type];
- 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 registry
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function registry(string $type): array
{
// only register once
if (array_key_exists($type, $this->registry)) {
return $this->registry[$type];
File Autoloader.php
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
namespace Bnomei;
Method __construct
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(array $options = [])
{
$this->options = array_merge_recursive([
// we can not read the kirby options since we are loading
// while kirby is booting, but once spyc is removed we can
Consider simplifying this complex logical expression. Open
Open
if ($options['key'] === 'classname') {
$this->registry[$type][$key] = $class;
} elseif ($options['key'] === 'route') {
// Author: @tobimori
$pattern = strtolower($file->getRelativePathname());
Avoid too many return
statements within this method. Open
Open
return $this->registry[$type];