divineniiquaye/flight-routing

View on GitHub
src/Handlers/RouteInvoker.php

Summary

Maintainability
D
2 days
Test Coverage
C
77%

Function resolveParameters has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    protected function resolveParameters(array $refParameters, array $arguments): array
    {
        $parameters = [];
        $nullable = 0;

Severity: Minor
Found in src/Handlers/RouteInvoker.php - About 6 hrs to fix

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 resolveParameters has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function resolveParameters(array $refParameters, array $arguments): array
    {
        $parameters = [];
        $nullable = 0;

Severity: Minor
Found in src/Handlers/RouteInvoker.php - About 1 hr to fix

    Function __invoke has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __invoke(mixed $handler, array $arguments): mixed
        {
            if (\is_string($handler)) {
                $handler = \ltrim($handler, '\\');
    
    
    Severity: Minor
    Found in src/Handlers/RouteInvoker.php - About 1 hr to fix

    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 resolveRoute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function resolveRoute(
            ServerRequestInterface $request,
            callable $resolver,
            mixed $handler,
            callable $arguments,
    Severity: Minor
    Found in src/Handlers/RouteInvoker.php - About 1 hr to fix

      Function resolveRoute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function resolveRoute(
              ServerRequestInterface $request,
              callable $resolver,
              mixed $handler,
              callable $arguments,
      Severity: Minor
      Found in src/Handlers/RouteInvoker.php - About 1 hr to fix

      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 __invoke has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __invoke(mixed $handler, array $arguments): mixed
          {
              if (\is_string($handler)) {
                  $handler = \ltrim($handler, '\\');
      
      
      Severity: Minor
      Found in src/Handlers/RouteInvoker.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return \json_encode($response, \JSON_THROW_ON_ERROR) ?: null;
        Severity: Major
        Found in src/Handlers/RouteInvoker.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return null;
          Severity: Major
          Found in src/Handlers/RouteInvoker.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $response;
            Severity: Major
            Found in src/Handlers/RouteInvoker.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status