EscolaLMS/Consultations

View on GitHub
src/Services/Contracts/ConsultationServiceContract.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Class "ConsultationServiceContract" has 33 methods, which is greater than 20 authorized. Split it into smaller classes.
Open

interface ConsultationServiceContract

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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;

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

Parameter $dto has undeclared type \EscolaLms\Consultations\Dto\ConsultationUserTermDto
Open

    public function rejectTerm(int $consultationTermId, ConsultationUserTermDto $dto): bool;

Parameter $dto has undeclared type \EscolaLms\Consultations\Dto\FinishTermDto
Open

    public function finishTerm(int $consultationTermId, FinishTermDto $dto): bool;

Parameter $consultationDto has undeclared type \EscolaLms\Consultations\Dto\ConsultationDto
Open

    public function update(int $id, ConsultationDto $consultationDto): Consultation;

Parameter $orderDto has undeclared type ?\EscolaLms\Core\Dtos\OrderDto
Open

    public function getConsultationsList(array $search = [], bool $onlyActive = false, OrderDto $orderDto = null): Builder;

Parameter $consultationDto has undeclared type \EscolaLms\Consultations\Dto\ConsultationDto
Open

    public function store(ConsultationDto $consultationDto): Consultation;

Return type of generateDateTo() is undeclared type ?\Carbon\Carbon
Open

    public function generateDateTo(string $dateTo, string $duration): ?Carbon;

Return type of getConsultationTermsForTutor() is undeclared type \Illuminate\Support\Collection
Open

    public function getConsultationTermsForTutor(): Collection;

Parameter $dto has undeclared type \EscolaLms\Consultations\Dto\ConsultationSaveScreenDto
Open

    public function saveScreen(ConsultationSaveScreenDto $dto): void;

Parameter $dto has undeclared type \EscolaLms\Consultations\Dto\ConsultationUserTermDto
Open

    public function approveTerm(int $consultationTermId, ConsultationUserTermDto $dto): bool;

Parameter $dto has undeclared type \EscolaLms\Consultations\Dto\ConsultationUserTermDto
Open

    public function generateJitsi(int $consultationTermId, ConsultationUserTermDto $dto): array;

Return type of forCurrentUserResponse() is undeclared type \Illuminate\Http\Resources\Json\AnonymousResourceCollection
Open

    public function forCurrentUserResponse(ListConsultationsRequest $listConsultationsRequest): AnonymousResourceCollection;

Return type of getConsultationsListForCurrentUser() is undeclared type \Illuminate\Database\Eloquent\Builder
Open

    public function getConsultationsListForCurrentUser(array $search = []): Builder;

Parameter $dto has undeclared type \EscolaLms\Consultations\Dto\ChangeTermConsultationDto
Open

    public function changeTerm(int $consultationTermId, ChangeTermConsultationDto $dto): bool;

Parameter $request has undeclared type \Illuminate\Foundation\Http\FormRequest
Open

    public function updateModelFieldsFromRequest(Consultation $consultation, FormRequest $request): void;

Return type of getConsultationTermsByConsultationId() is undeclared type \Illuminate\Support\Collection
Open

    public function getConsultationTermsByConsultationId(int $consultationId, array $search = []): Collection;

Return type of getConsultationsList() is undeclared type \Illuminate\Database\Eloquent\Builder
Open

    public function getConsultationsList(array $search = [], bool $onlyActive = false, OrderDto $orderDto = null): Builder;

Avoid excessively long variable names like $listConsultationsRequest. Keep variable name length under 20.
Open

    public function forCurrentUserResponse(ListConsultationsRequest $listConsultationsRequest): AnonymousResourceCollection;

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 delete(int $id): ?bool;

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 update(int $id, ConsultationDto $consultationDto): Consultation;

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;

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

Line exceeds 120 characters; contains 124 characters
Open

    public function forCurrentUserResponse(ListConsultationsRequest $listConsultationsRequest): AnonymousResourceCollection;

Line exceeds 120 characters; contains 129 characters
Open

    public function setStatus(ConsultationUserPivot $consultationTerm, string $status, string $executedAt): ConsultationUserTerm;

Line exceeds 120 characters; contains 123 characters
Open

    public function getConsultationsList(array $search = [], bool $onlyActive = false, OrderDto $orderDto = null): Builder;

Line exceeds 120 characters; contains 129 characters
Open

    public function canGenerateJitsi(?string $executedAt, ?string $status, ?string $duration, ?Consultation $consultation): bool;

Line exceeds 120 characters; contains 141 characters
Open

    public function setReminderStatus(ConsultationUserPivot $consultationTerm, string $status, ?ConsultationUserTerm $userTerm = null): void;

There are no issues that match your filters.

Category
Status