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
Open
public static function prepareFilters(array $search)
{
$dto = new self($search);
$user = auth()->user();
- Read upRead up
- Exclude checks
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
Open
fn (Builder $query) => $query->where('consultation_user.consultation_id', '=', $this->value)
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn (Builder $query) => $query->where('consultation_user.id', '=', $this->value)
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
ConsultationSimpleResource::collection($consultations), __('Consultations retrieved successfully')
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn (Builder $query) => $query->whereIn('categories.id', $this->value)
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
ConsultationSimpleResource::collection($consultations), __('Consultations retrieved successfully')
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn (Builder $query) => $query->where('consultation_user.id', '=', $this->value)
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
Open
fn (Builder $query) => $query->where('consultation_user.consultation_id', '=', $this->value)
- Exclude checks
Line exceeds 120 characters; contains 206 characters Open
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)
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
Open
return Str::startsWith($logotypePath, ConstantEnum::DIRECTORY) ? $logotypePath : ConstantEnum::DIRECTORY . '/' .$logotypePath;
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
$dto->addToCriteria(new DateCriterion($dto->model()->getTable() . '.executed_at', $dto->getDateFrom(), '>='));
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
Open
$dto->addToCriteria(new WhereCriterion($dto->model()->getTable() . '.executed_at', $dto->getDateTimeFrom(), '>='));
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
Open
DB::statement('ALTER TABLE `consultation_user` DROP INDEX `consultation_user_unique`, ADD INDEX (user_id, consultation_id)');
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
Open
return $this->imagePath === null ? '' : Str::after($this->imagePath, Str::after(env('AWS_URL'), 'https://') . '/');
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
Open
$search['active_to'] = isset($search['active_to']) ? Carbon::make($search['active_to'])->format('Y-m-d') : $now;
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
Open
'is_ended' => $this->isEnded($consultation->resource->executed_at, $consultation->resource->getDuration()),
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
Open
'busy_terms' => ConsultationTermResource::collection($consultationServiceContract->getBusyTermsFormatDate($consultation->getKey())),
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
Open
|| ($user->can(ConsultationsPermissionsEnum::CONSULTATION_READ_OWN) && $consultation->author_id === $user->getKey());
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
Open
->orWhereHas('teachers', fn (Builder $query) => $query->where('users.id', '=', auth()->user()->getKey()))
- Exclude checks
Line exceeds 120 characters; contains 196 characters Open
Open
$userTerm = $result->first(fn (ConsultationUserTermResourceDto $dto) => $dto->consultation_id === $term->consultationUser->consultation_id && $term->executed_at === $dto->executed_at);
- Exclude checks