EscolaLMS/Consultations

View on GitHub

Showing 1,241 of 1,241 total issues

The method prepareFilters() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

    public static function prepareFilters(array $search)
    {
        $dto = new self($search);
        $user = auth()->user();

Severity: Minor
Found in src/Dto/FilterListDto.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

Only one argument is allowed per line in a multi-line function call
Open

            fn (Builder $query) => $query->where('consultation_user.consultation_id', '=', $this->value)

Only one argument is allowed per line in a multi-line function call
Open

            fn (Builder $query) => $query->where('consultation_user.id', '=', $this->value)

Only one argument is allowed per line in a multi-line function call
Open

            ConsultationSimpleResource::collection($consultations), __('Consultations retrieved successfully')

Only one argument is allowed per line in a multi-line function call
Open

            fn (Builder $query) => $query->whereIn('categories.id', $this->value)

Only one argument is allowed per line in a multi-line function call
Open

            ConsultationSimpleResource::collection($consultations), __('Consultations retrieved successfully')

Only one argument is allowed per line in a multi-line function call
Open

            fn (Builder $query) => $query->where('consultation_user.id', '=', $this->value)

Only one argument is allowed per line in a multi-line function call
Open

            fn (Builder $query) => $query->where('consultation_user.consultation_id', '=', $this->value)

Line exceeds 120 characters; contains 206 characters
Open

    public function __construct(int $consultation_user_id, int $consultation_id, string $executed_at, string $status, string $duration, ?User $author, ?string $finished_at = null, ?Collection $users = null)

Line exceeds 120 characters; contains 142 characters
Open

                return Str::startsWith($logotypePath, ConstantEnum::DIRECTORY) ? $logotypePath : ConstantEnum::DIRECTORY . '/' .$logotypePath;
Severity: Minor
Found in src/Dto/ConsultationDto.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

            $dto->addToCriteria(new DateCriterion($dto->model()->getTable() . '.executed_at', $dto->getDateFrom(), '>='));

Line exceeds 120 characters; contains 127 characters
Open

            $dto->addToCriteria(new WhereCriterion($dto->model()->getTable() . '.executed_at', $dto->getDateTimeFrom(), '>='));

Line exceeds 120 characters; contains 137 characters
Open

            DB::statement('ALTER TABLE `consultation_user` DROP INDEX `consultation_user_unique`, ADD INDEX (user_id, consultation_id)');

Line exceeds 120 characters; contains 127 characters
Open

            return $this->imagePath === null ? '' : Str::after($this->imagePath, Str::after(env('AWS_URL'), 'https://') . '/');
Severity: Minor
Found in src/Dto/ConsultationDto.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

            $search['active_to'] = isset($search['active_to']) ? Carbon::make($search['active_to'])->format('Y-m-d') : $now;

Line exceeds 120 characters; contains 123 characters
Open

                'is_ended' => $this->isEnded($consultation->resource->executed_at, $consultation->resource->getDuration()),

Line exceeds 120 characters; contains 144 characters
Open

            'busy_terms' => ConsultationTermResource::collection($consultationServiceContract->getBusyTermsFormatDate($consultation->getKey())),

Line exceeds 120 characters; contains 129 characters
Open

            || ($user->can(ConsultationsPermissionsEnum::CONSULTATION_READ_OWN) && $consultation->author_id === $user->getKey());

Line exceeds 120 characters; contains 125 characters
Open

                    ->orWhereHas('teachers', fn (Builder $query) => $query->where('users.id', '=', auth()->user()->getKey()))

Line exceeds 120 characters; contains 196 characters
Open

            $userTerm = $result->first(fn (ConsultationUserTermResourceDto $dto) => $dto->consultation_id === $term->consultationUser->consultation_id && $term->executed_at === $dto->executed_at);
Severity
Category
Status
Source
Language