maurobonfietti/api-rest-slimphp

View on GitHub

Showing 4 of 4 total issues

Method getTasksByPage has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        int $userId,
        int $page,
        int $perPage,
        ?string $name,
        ?string $description,
Severity: Minor
Found in src/Service/Task/TaskService.php - About 45 mins to fix

    Method getTasksByPage has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            int $userId,
            int $page,
            int $perPage,
            ?string $name,
            ?string $description,
    Severity: Minor
    Found in src/Repository/TaskRepository.php - About 45 mins to fix

      Method getResultsWithPagination has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              string $query,
              int $page,
              int $perPage,
              array $params,
              int $total
      Severity: Minor
      Found in src/Repository/BaseRepository.php - About 35 mins to fix

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

            private function validateTask(array $input, int $taskId): Task
            {
                $task = $this->getTaskFromDb($taskId, (int) $input['decoded']->sub);
                $data = json_decode((string) json_encode($input), false);
                if (! isset($data->name) && ! isset($data->status)) {
        Severity: Minor
        Found in src/Service/Task/TaskService.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