Showing 28 of 66 total issues
Router
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Router implements ContainerInjectableInterface
{
use ContainerInjectableTrait;
File RouteHandler.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Anax\Route;
use Anax\Commons\ContainerInjectableInterface;
Method handleAsControllerAction
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleAsControllerAction(array $callable)
{
$class = $callable[0];
$action = $callable[1];
$args = $callable[2];
Function handleAsControllerAction
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function handleAsControllerAction(array $callable)
{
$class = $callable[0];
$action = $callable[1];
$args = $callable[2];
- 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 handleAsInvocableClass
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function handleAsInvocableClass(string $class)
{
$obj = new $class();
// $class = $callable[0];
$action = "__invoke";
- 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 handleAsInvocableClass
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleAsInvocableClass(string $class)
{
$obj = new $class();
// $class = $callable[0];
$action = "__invoke";
Method match
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function match(
?string $mount,
?string $relativePath,
?string $absolutePath,
?string $query,
Function match
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function match(
?string $mount,
?string $relativePath,
?string $absolutePath,
?string $query,
- 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 handle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function handle(
?string $method,
?string $path,
$action,
array $arguments = [],
- 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 handle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function handle($path, $method = null)
{
try {
$match = false;
foreach ($this->routes as $route) {
- 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 handle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(
?string $method,
?string $path,
$action,
array $arguments = [],
Method isControllerAction
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function isControllerAction(
?string $method,
?string $path,
string $class
) {
Function isControllerAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function isControllerAction(
?string $method,
?string $path,
string $class
) {
- 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
Consider simplifying this complex logical expression. Open
if ($di
&& is_array($action)
&& isset($action[0])
&& isset($action[1])
&& is_string($action[0])
Method match
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
?string $mount,
?string $relativePath,
?string $absolutePath,
?string $query,
?array $methodSupported,
Consider simplifying this complex logical expression. Open
if (is_array($action)
&& isset($action[0])
&& isset($action[1])
&& is_string($action[0])
&& is_string($action[1])
Method handle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
?string $method,
?string $path,
$action,
array $arguments = [],
ContainerInterface $di = null
Method addRoute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$method,
$mount = null,
$path = null,
$handler = null,
string $info = null
Method set
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$method = null,
$mount = null,
$path = null,
$handler = null,
string $info = null
Function getHandlerType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getHandlerType(
$action,
ContainerInterface $di = null
) {
if (is_null($action)) {
- 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"