File ConsultationService.php
has 521 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace EscolaLms\Consultations\Services;
use Auth;
ConsultationService
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class ConsultationService implements ConsultationServiceContract
{
private ConsultationRepositoryContract $consultationRepositoryContract;
private ConsultationUserRepositoryContract $consultationUserRepositoryContract;
private JitsiServiceContract $jitsiServiceContract;
The class ConsultationService has 25 public methods. Consider refactoring ConsultationService to keep number of public methods under 10. Open
class ConsultationService implements ConsultationServiceContract
{
private ConsultationRepositoryContract $consultationRepositoryContract;
private ConsultationUserRepositoryContract $consultationUserRepositoryContract;
private JitsiServiceContract $jitsiServiceContract;
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class ConsultationService has an overall complexity of 84 which is very high. The configured complexity threshold is 50. Open
class ConsultationService implements ConsultationServiceContract
{
private ConsultationRepositoryContract $consultationRepositoryContract;
private ConsultationUserRepositoryContract $consultationUserRepositoryContract;
private JitsiServiceContract $jitsiServiceContract;
- Exclude checks
Function canGenerateJitsi
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function canGenerateJitsi(?string $executedAt, ?string $status, ?string $duration, ?Consultation $consultation = null): bool
{
$now = now();
if (isset($executedAt)) {
$dateTo = Carbon::make($executedAt);
- Read upRead up
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
Method generateJitsi
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateJitsi(int $consultationTermId, ConsultationUserTermDto $dto): array
{
/** @var ConsultationUserPivot $consultationTerm */
$consultationTerm = $this->consultationUserRepositoryContract->find($consultationTermId);
/** @var ConsultationUserTerm $term */
Method forCurrentUserResponse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function forCurrentUserResponse(
ListConsultationsRequest $listConsultationsRequest
): AnonymousResourceCollection {
$search = $listConsultationsRequest->except(['limit', 'skip', 'order', 'order_by', 'paginate']);
$consultations = $this->getConsultationsListForCurrentUser($search);
Method generateJitsiUrlForEmail
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateJitsiUrlForEmail(int $consultationTermId, int $userId, string $executedAt): ?string
{
/** @var ConsultationUserPivot $consultationTerm */
$consultationTerm = $this->consultationUserRepositoryContract->find($consultationTermId);
/** @var ConsultationUserTerm $term */
Method reminderAboutConsultation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reminderAboutConsultation(string $reminderStatus): void
{
/** @var ConsultationUserTerm $userTerm */
foreach ($this->getReminderData($reminderStatus) as $userTerm) {
event(new ReminderAboutTerm(
The class ConsultationService has a coupling between objects value of 49. Consider to reduce the number of dependencies under 13. Open
class ConsultationService implements ConsultationServiceContract
{
private ConsultationRepositoryContract $consultationRepositoryContract;
private ConsultationUserRepositoryContract $consultationUserRepositoryContract;
private JitsiServiceContract $jitsiServiceContract;
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The method getConsultationsList has a boolean flag argument $onlyActive, which is a certain sign of a Single Responsibility Principle violation. Open
public function getConsultationsList(array $search = [], bool $onlyActive = false, OrderDto $orderDto = null): Builder
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method setReminderStatus uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->consultationUserRepositoryContract->updateModel($consultationTerm, ['reminder_status' => $status]);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\EscolaLms\Jitsi\Helpers\StringHelper' in method 'generateJitsi'. Open
StringHelper::convertToJitsiSlug($consultationTerm->consultation->name, [], ConstantEnum::DIRECTORY, $consultationTerm->consultation_id, (string) Carbon::make($term->executed_at)->getTimestamp()),
- 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\FilterListDto' in method 'getConsultationsList'. Open
$criteria = FilterListDto::prepareFilters($search);
- 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 canGenerateJitsi uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return $status === ConsultationTermStatusEnum::APPROVED;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\EscolaLms\Consultations\Helpers\StrategyHelper' in method 'setRelations'. Open
StrategyHelper::useStrategyPattern(
$className,
'RelationsStrategy',
'setRelation',
$consultation,
- 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 reminderAboutConsultation uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
event(new ReminderTrainerAboutTerm(
$consultation->author,
$userTerm->consultationUser,
$reminderStatus,
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Carbon\Carbon' in method 'canGenerateJitsi'. Open
$dateTo = Carbon::make($executedAt);
- 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 '\Carbon\Carbon' in method 'getConsultationsListForCurrentUser'. Open
$search['active_to'] = isset($search['active_to']) ? Carbon::make($search['active_to']) : $now;
- 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\Models\User' in method 'generateJitsiUrlForEmail'. Open
$user = User::find($userId);
- 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 '\Illuminate\Support\Facades\DB' in method 'rejectTerm'. Open
DB::transaction(function () use ($userTerms, $authUser) {
/** @var ConsultationUserTerm $userTerm */
foreach ($userTerms as $userTerm) {
/** @var ConsultationUserTerm $userTerm */
$userTerm = $this->consultationUserTermRepository->update(['executed_status' => ConsultationTermStatusEnum::REJECT], $userTerm->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\Consultations\Http\Resources\ConsultationSimpleResource' in method 'forCurrentUserResponse'. Open
$consultationsCollection = ConsultationSimpleResource::collection($consultations->paginate(
$listConsultationsRequest->get('per_page') ??
config('escolalms_consultations.perPage', ConstantEnum::PER_PAGE)
));
- 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 forCurrentUserResponse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$consultationsCollection = ConsultationSimpleResource::collection($consultations->get());
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Illuminate\Support\Facades\DB' in method 'store'. Open
return DB::transaction(function () use($consultationDto) {
/** @var Consultation $consultation */
$consultation = $this->consultationRepositoryContract->create($consultationDto->toArray());
$this->setRelations($consultation, $consultationDto->getRelations());
$this->setFiles($consultation, $consultationDto->getFiles());
- 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 '\Illuminate\Support\Facades\DB' in method 'approveTerm'. Open
DB::transaction(function () use ($userTerms, $authUser) {
/** @var ConsultationUserTerm $userTerm */
foreach ($userTerms as $userTerm) {
/** @var ConsultationUserTerm $userTerm */
$userTerm = $this->consultationUserTermRepository->update(['executed_status' => ConsultationTermStatusEnum::APPROVED], $userTerm->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 '\Illuminate\Support\Facades\DB' in method 'setStatus'. Open
return DB::transaction(function () use ($status, $consultationTerm, $executedAt) {
return $this->consultationUserTermRepository->updateUserTermByExecutedAt($consultationTerm, $executedAt, ['executed_status' => $status]);
});
- 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 '\Illuminate\Support\Facades\DB' in method 'update'. Open
return DB::transaction(function () use($consultation, $consultationDto) {
$this->setFiles($consultation, $consultationDto->getFiles());
$consultation = $this->consultationRepositoryContract->updateModel($consultation, $consultationDto->toArray());
$this->setRelations($consultation, $consultationDto->getRelations());
return $consultation;
- 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 '\Carbon\Carbon' in method 'reportTerm'. Open
'executed_at' => Carbon::make($executedAt)
- 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\Http\Resources\ConsultationSimpleResource' in method 'forCurrentUserResponse'. Open
$consultationsCollection = ConsultationSimpleResource::collection($consultations->get());
- 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\Http\Resources\ConsultationSimpleResource' in method 'forCurrentUserResponse'. Open
ConsultationSimpleResource::extend(function (ConsultationSimpleResource $consultation) {
return [
'consultation_term_id' => $consultation->resource->consultation_user_id,
'name' => $consultation->resource->name,
'image_path' => $consultation->resource->image_path,
- 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 '\Carbon\Carbon' in method 'getConsultationsListForCurrentUser'. Open
$search['active_from'] = isset($search['active_from']) ? Carbon::make($search['active_from']) : $now;
- 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 '\Illuminate\Support\Facades\DB' in method 'delete'. Open
return DB::transaction(function () use($id) {
return $this->consultationRepositoryContract->delete($id);
});
- 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 'generateJitsiUrlForEmail'. Open
StringHelper::convertToJitsiSlug($consultationTerm->consultation->name, [], ConstantEnum::DIRECTORY, $consultationTerm->consultation_id, (string) Carbon::make($term->executed_at)->getTimestamp()),
- 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 '\Illuminate\Support\Facades\DB' in method 'changeTerm'. Open
DB::transaction(function () use ($consultationTermId, $dto) {
try {
/** @var ConsultationUserPivot $consultationTerm */
$consultationTerm = $this->consultationUserRepositoryContract->find($consultationTermId);
- 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
Avoid using static access to class '\EscolaLms\Consultations\Dto\FilterListDto' in method 'getConsultationsListForCurrentUser'. Open
$criteria = FilterListDto::prepareFilters($search);
- 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\Files\Helpers\FileHelper' in method 'setFiles'. Open
$consultation->$key = FileHelper::getFilePath($file, ConstantEnum::DIRECTORY . "/{$consultation->getKey()}/images");
- 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 '\Carbon\Carbon' in method 'forCurrentUserResponse'. Open
'executed_at' => Carbon::make($consultation->resource->executed_at),
- 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 '\Illuminate\Support\Facades\DB' in method 'reportTerm'. Open
return DB::transaction(function () use ($consultationTermId, $executedAt) {
/** @var ConsultationUserPivot $consultationTerm */
$consultationTerm = $this->consultationUserRepositoryContract->find($consultationTermId);
if ($this->termIsBusy($consultationTerm->consultation_id, $executedAt)) {
abort(400, __('Term is busy, change your term.'));
- 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 '\Carbon\Carbon' in method 'saveScreen'. Open
$termin = Carbon::make($userTerm->executed_at);
- 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 '\Illuminate\Support\Str' in method 'saveScreen'. Open
$extension = $dto->getFile() instanceof UploadedFile ? $dto->getFile()->getClientOriginalExtension() : Str::between($dto->getFile(), 'data:image/', ';base64');
- 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 'getReminderData'. Open
return $this->consultationUserTermRepository->allQueryBuilder(FilterConsultationTermsListDto::prepareFilters($data));
- 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 '\Illuminate\Support\Facades\DB' in method 'finishTerms'. Open
DB::transaction(function () use ($usersTerm, $finishedAt) {
$this->consultationUserTermRepository->updateModels($usersTerm, ['finished_at' => $finishedAt]);
});
- 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 '\Carbon\Carbon' in method 'getBusyTermsFormatDate'. Open
fn (ConsultationUserTerm $term) => Carbon::make($term->executed_at)
- 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 '\Carbon\Carbon' in method 'filterProposedTerms'. Open
return $proposedTerms->map(fn(ConsultationProposedTerm $proposedTerm) => Carbon::make($proposedTerm->proposed_at))->filter(fn (Carbon $proposedTerm) => !in_array($proposedTerm, $busyTerms))->toArray();
- 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 '\Illuminate\Support\Facades\Storage' in method 'saveScreen'. Open
Storage::putFileAs($folder, $dto->getFile(), Carbon::make($dto->getTimestamp())->getTimestamp() . '.' . $extension);
- 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 unused local variables such as '$value'. Open
foreach ($relations as $key => $value) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
syntax error, unexpected 'ConsultationRepositoryContract' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
Open
private ConsultationRepositoryContract $consultationRepositoryContract;
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function approveTerm(int $consultationTermId, ConsultationUserTermDto $dto): bool
{
/** @var ConsultationUserPivot $consultationTerm */
$consultationTerm = $this->consultationUserRepositoryContract->find($consultationTermId);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 220.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function rejectTerm(int $consultationTermId, ConsultationUserTermDto $dto): bool
{
/** @var ConsultationUserPivot $consultationTerm */
$consultationTerm = $this->consultationUserRepositoryContract->find($consultationTermId);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 220.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $consultationUserTermRepository. Keep variable name length under 20. Open
protected ConsultationUserTermRepositoryContract $consultationUserTermRepository;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationUserTermRepository. Keep variable name length under 20. Open
ConsultationUserTermRepositoryContract $consultationUserTermRepository,
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationRepositoryContract. Keep variable name length under 20. Open
ConsultationRepositoryContract $consultationRepositoryContract,
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationUserPivot. Keep variable name length under 20. Open
$consultationUserPivot = $this->consultationUserRepositoryContract->find($consultationTermId);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationUserRepositoryContract. Keep variable name length under 20. Open
ConsultationUserRepositoryContract $consultationUserRepositoryContract,
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationUserRepositoryContract. Keep variable name length under 20. Open
private ConsultationUserRepositoryContract $consultationUserRepositoryContract;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $filterConsultationTermsDto. Keep variable name length under 20. Open
$filterConsultationTermsDto = FilterConsultationTermsListDto::prepareFilters(
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $listConsultationsRequest. Keep variable name length under 20. Open
ListConsultationsRequest $listConsultationsRequest
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationsCollection. Keep variable name length under 20. Open
$consultationsCollection = ConsultationSimpleResource::collection($consultations->paginate(
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $consultationRepositoryContract. Keep variable name length under 20. Open
private ConsultationRepositoryContract $consultationRepositoryContract;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function update(int $id, ConsultationDto $consultationDto): Consultation
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function delete(int $id): ?bool
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function show(int $id): Consultation
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Expected 1 space after USE keyword; found 0 Open
return DB::transaction(function () use($id) {
- Exclude checks
Expected 1 space after USE keyword; found 0 Open
return DB::transaction(function () use($consultation, $consultationDto) {
- Exclude checks
Expected 1 space after USE keyword; found 0 Open
return DB::transaction(function () use($consultationDto) {
- 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 123 characters Open
'is_ended' => $this->isEnded($consultation->resource->executed_at, $consultation->resource->getDuration()),
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
: $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$userTerms = $dto->getUserId() ? collect([$this->consultationUserTermRepository->getUserTermByUserIdAndExecutedAt($dto->getUserId(), $dto->getTerm())])
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
public function setStatus(ConsultationUserPivot $consultationTerm, string $status, string $executedAt): ConsultationUserTerm
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
public function canGenerateJitsi(?string $executedAt, ?string $status, ?string $duration, ?Consultation $consultation = null): bool
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
: $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
$userTerm = $this->consultationUserTermRepository->update(['executed_status' => ConsultationTermStatusEnum::REJECT], $userTerm->getKey());
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
'executed_status' => $dto->getAccept() ? ConsultationTermStatusEnum::APPROVED : ConsultationTermStatusEnum::REPORTED,
- 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 156 characters Open
$userTerm = $this->consultationUserTermRepository->update(['executed_status' => ConsultationTermStatusEnum::APPROVED], $userTerm->getKey());
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$userTerms = $dto->getUserId() ? collect([$this->consultationUserTermRepository->getUserTermByUserIdAndExecutedAt($dto->getUserId(), $dto->getTerm())])
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
return $this->consultationUserTermRepository->updateUserTermByExecutedAt($consultationTerm, $executedAt, ['executed_status' => $status]);
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
if ($consultation && (Auth::user()->getKey() === $consultation->author_id || in_array(Auth::user()->getKey(), $consultation->teachers()->pluck('users.id')->toArray()))) {
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$terms = $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultation->getKey(), $executedAt);
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
public function setReminderStatus(ConsultationUserPivot $consultationTerm, string $status, ?ConsultationUserTerm $userTerm = null): void
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$extension = $dto->getFile() instanceof UploadedFile ? $dto->getFile()->getClientOriginalExtension() : Str::between($dto->getFile(), 'data:image/', ';base64');
- Exclude checks
Line exceeds 120 characters; contains 208 characters Open
StringHelper::convertToJitsiSlug($consultationTerm->consultation->name, [], ConstantEnum::DIRECTORY, $consultationTerm->consultation_id, (string) Carbon::make($term->executed_at)->getTimestamp()),
- Exclude checks
Line exceeds 120 characters; contains 172 characters Open
if ($consultationTerm->consultation->author->getKey() === $userId || in_array($userId, $consultationTerm->consultation->teachers()->pluck('users.id')->toArray())) {
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
return $this->filterProposedTerms($consultationUserPivot->consultation_id, $consultationUserPivot->consultation->proposedTerms);
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$userTerms = $dto->getUserId() ? collect([$this->consultationUserTermRepository->getUserTermByUserIdAndExecutedAt($dto->getUserId(), $dto->getTerm())])
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
event(new ChangeTerm($consultationUserTerm->consultationUser->user, $consultationUserTerm->consultationUser, $consultationUserTerm));
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$search['active_from'] = isset($search['active_from']) ? Carbon::make($search['active_from'])->format('Y-m-d') : $now;
- Exclude checks
Line exceeds 120 characters; contains 209 characters Open
return $proposedTerms->map(fn(ConsultationProposedTerm $proposedTerm) => Carbon::make($proposedTerm->proposed_at))->filter(fn (Carbon $proposedTerm) => !in_array($proposedTerm, $busyTerms))->toArray();
- Exclude checks
Line exceeds 120 characters; contains 206 characters Open
if ($consultationTerm->consultation->author->getKey() === auth()->user()->getKey() || in_array(auth()->user()->getKey(), $consultationTerm->consultation->teachers()->pluck('users.id')->toArray())) {
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
return $this->consultationUserTermRepository->allQueryBuilder(FilterConsultationTermsListDto::prepareFilters($data));
- Exclude checks
Line exceeds 120 characters; contains 175 characters Open
$consultationUser = ConsultationUserPivot::query()->where('consultation_id', '=', $dto->getConsultationId())->where('id', '=', $dto->getUserTerminId())->firstOrFail();
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$userTerms = $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());
- 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 124 characters Open
Storage::putFileAs($folder, $dto->getFile(), Carbon::make($dto->getTimestamp())->getTimestamp() . '.' . $extension);
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
: $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$consultation = $this->consultationRepositoryContract->updateModel($consultation, $consultationDto->toArray());
- Exclude checks
Line exceeds 120 characters; contains 208 characters Open
StringHelper::convertToJitsiSlug($consultationTerm->consultation->name, [], ConstantEnum::DIRECTORY, $consultationTerm->consultation_id, (string) Carbon::make($term->executed_at)->getTimestamp()),
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
throw new ChangeTermException(__('Term is changed but not executed event because user or term is no exists'));
- Exclude checks
Space before opening parenthesis of function call prohibited Open
fn (User $teacher) => event(new ReminderTrainerAboutTerm(
- Exclude checks
Multi-line function call not indented correctly; expected 20 spaces but found 24 Open
$userTerm->consultationUser,
- Exclude checks
Space before opening parenthesis of function call prohibited Open
fn (ConsultationUserTerm $term) => Carbon::make($term->executed_at)
- Exclude checks
Multi-line function call not indented correctly; expected 20 spaces but found 24 Open
$reminderStatus,
- Exclude checks
Multi-line function call not indented correctly; expected 20 spaces but found 24 Open
$userTerm
- Exclude checks
Multi-line function call not indented correctly; expected 20 spaces but found 24 Open
$teacher,
- Exclude checks
Space before opening parenthesis of function call prohibited Open
if ($terms->first(fn (ConsultationUserPivot $userPivot) => $userPivot->user_id === $userId) !== null) {
- Exclude checks
Space before opening parenthesis of function call prohibited Open
return $proposedTerms->map(fn(ConsultationProposedTerm $proposedTerm) => Carbon::make($proposedTerm->proposed_at))->filter(fn (Carbon $proposedTerm) => !in_array($proposedTerm, $busyTerms))->toArray();
- Exclude checks
Space before opening parenthesis of function call prohibited Open
if ($terms->first(fn (ConsultationUserPivot $userPivot) => $userPivot->user_id === $userId) !== null) {
- Exclude checks