themichaelhall/bluemvc-core

View on GitHub

Showing 29 of 34 total issues

Function updateResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateResponse(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response, string $viewPath, string $action, ViewItemCollectionInterface $viewItems): void
    {
        $viewRenderers = $application->getViewRenderers();
        if (count($viewRenderers) === 0) {
            throw new MissingViewRendererException('No view renderer was added to application.');
Severity: Minor
Found in src/View.php - About 35 mins 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

Avoid too many return statements within this method.
Open

                    return true;
Severity: Major
Found in src/Traits/ControllerTrait.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in src/Traits/ControllerTrait.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return true;
      Severity: Major
      Found in src/Traits/ControllerTrait.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return new RouteMatch($this->getControllerClassName(), $action, $parameters);
        Severity: Major
        Found in src/Route.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return true;
          Severity: Major
          Found in src/Traits/ControllerTrait.php - About 30 mins to fix

            Function findActionMethod has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function findActionMethod(ReflectionClass $reflectionClass, string $action, bool $isCaseSensitive): ?ReflectionMethod
                {
                    // Methods can not begin with a digit, prepend underscore to make it possible.
                    if (strlen($action) > 0 && ctype_digit($action[0])) {
                        $action = '_' . $action;
            Severity: Minor
            Found in src/Traits/ControllerTrait.php - About 25 mins 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

            Function handleResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function handleResult(mixed $result, string $actionName): void
                {
                    $application = $this->getApplication();
                    $request = $this->getRequest();
                    $response = $this->getResponse();
            Severity: Minor
            Found in src/Controller.php - About 25 mins 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

            Function splitPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function splitPath(string $path): array
                {
                    if ($path === '') {
                        return [];
                    }
            Severity: Minor
            Found in src/Route.php - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language