Showing 1,011 of 1,011 total issues
Avoid using static access to class 'EscolaLms\Consultations\Http\Resources\ConsultationTermResource' in method 'toArray'. Open
'busy_terms' => ConsultationTermResource::collection($consultationServiceContract->getBusyTermsFormatDate($this->resource->consultation->getKey())),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\EscolaLms\Jitsi\Helpers\StringHelper' in method 'generateJitsi'. Open
StringHelper::convertToJitsiSlug($consultationTerm->consultation->name),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\EscolaLms\Consultations\Dto\FilterConsultationTermsListDto' in method 'getConsultationTermsByConsultationId'. Open
$filterConsultationTermsDto = FilterConsultationTermsListDto::prepareFilters(
array_merge($search, ['consultation_id' => $consultationId])
);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
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();
- 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
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
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
ConsultationSimpleResource::collection($consultations), __('Consultations retrieved successfully')
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
ConsultationSimpleResource::collection($consultations), __('Consultations retrieved successfully')
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
fn (Builder $query) => $query->whereIn('categories.id', $this->value)
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
return $user->can(ConsultationsPermissionsEnum::CONSULTATION_LIST) || $user->can(ConsultationsPermissionsEnum::CONSULTATION_LIST_OWN);
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$query->whereIn('executed_status', [ConsultationTermStatusEnum::APPROVED, ConsultationTermStatusEnum::REPORTED]);
- Exclude checks
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;
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$dto->addToCriteria(new WhereCriterion($dto->model()->getTable() . '.executed_at', $dto->getDateTimeTo(), '<='));
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
'busy_terms' => ConsultationTermResource::collection($consultationServiceContract->getBusyTermsFormatDate($this->resource->getKey())),
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
public function getConsultationsList(array $search = [], bool $onlyActive = false, OrderDto $orderDto = null): Builder
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
|| ($user->can(ConsultationsPermissionsEnum::CONSULTATION_READ_OWN) && $consultation->author_id === $user->getKey());
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$consultation->$key = FileHelper::getFilePath($file, ConstantEnum::DIRECTORY . "/{$consultation->getKey()}/images");
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
public function changeTerm(ChangeTermConsultationRequest $changeTermConsultationRequest, int $consultationTermId): JsonResponse
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
return $this->consultationUserRepositoryContract->updateModel($consultationTerm, ['executed_status' => $status]);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
public function getConsultationsList(array $search = [], bool $onlyActive = false, OrderDto $orderDto = null): Builder;
- Exclude checks