EscolaLMS/Consultations

View on GitHub
src/Services/ConsultationService.php

Summary

Maintainability
F
4 days
Test Coverage
B
81%

File ConsultationService.php has 521 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace EscolaLms\Consultations\Services;

use Auth;
Severity: Major
Found in src/Services/ConsultationService.php - About 1 day to fix

    ConsultationService has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ConsultationService implements ConsultationServiceContract
    {
        private ConsultationRepositoryContract $consultationRepositoryContract;
        private ConsultationUserRepositoryContract $consultationUserRepositoryContract;
        private JitsiServiceContract $jitsiServiceContract;
    Severity: Minor
    Found in src/Services/ConsultationService.php - About 4 hrs to fix

      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;
      Severity: Minor
      Found in src/Services/ConsultationService.php by phpmd

      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;
      Severity: Minor
      Found in src/Services/ConsultationService.php by phpmd

      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);
      Severity: Minor
      Found in src/Services/ConsultationService.php - About 2 hrs to fix

      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 */
      Severity: Minor
      Found in src/Services/ConsultationService.php - About 1 hr to fix

        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);
        Severity: Minor
        Found in src/Services/ConsultationService.php - About 1 hr to fix

          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 */
          Severity: Minor
          Found in src/Services/ConsultationService.php - About 1 hr to fix

            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(
            Severity: Minor
            Found in src/Services/ConsultationService.php - About 1 hr to fix

              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;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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]);
                      }
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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()),
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
                              }
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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,
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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,
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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());
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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)
                          ));
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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());
                      }
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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());
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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());
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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]);
                      });
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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)
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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());
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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,
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
                      });
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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()),
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              
              
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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])
                      );
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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");
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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),
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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.'));
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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');
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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));
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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]);
                      });
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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)
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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();
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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) {
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
              Severity: Critical
              Found in src/Services/ConsultationService.php by phan

              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);
              
              
              Severity: Major
              Found in src/Services/ConsultationService.php and 1 other location - About 6 hrs to fix
              src/Services/ConsultationService.php on lines 186..208

              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

              Further Reading

              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);
              
              
              Severity: Major
              Found in src/Services/ConsultationService.php and 1 other location - About 6 hrs to fix
              src/Services/ConsultationService.php on lines 162..184

              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

              Further Reading

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

                  protected ConsultationUserTermRepositoryContract $consultationUserTermRepository;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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,
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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,
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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);
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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,
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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(
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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(
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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;
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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
              Severity: Minor
              Found in src/Services/ConsultationService.php by phpmd

              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) {

              Expected 1 space after USE keyword; found 0
              Open

                      return DB::transaction(function () use($consultation, $consultationDto) {

              Expected 1 space after USE keyword; found 0
              Open

                      return DB::transaction(function () use($consultationDto) {

              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 159 characters
              Open

                                  : $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());

              Line exceeds 120 characters; contains 159 characters
              Open

                      $userTerms = $dto->getUserId() ? collect([$this->consultationUserTermRepository->getUserTermByUserIdAndExecutedAt($dto->getUserId(), $dto->getTerm())])

              Line exceeds 120 characters; contains 128 characters
              Open

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

              Line exceeds 120 characters; contains 135 characters
              Open

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

              Line exceeds 120 characters; contains 151 characters
              Open

                          : $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());

              Line exceeds 120 characters; contains 154 characters
              Open

                              $userTerm = $this->consultationUserTermRepository->update(['executed_status' => ConsultationTermStatusEnum::REJECT], $userTerm->getKey());

              Line exceeds 120 characters; contains 141 characters
              Open

                                      'executed_status' => $dto->getAccept() ? ConsultationTermStatusEnum::APPROVED : ConsultationTermStatusEnum::REPORTED,

              Line exceeds 120 characters; contains 122 characters
              Open

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

              Line exceeds 120 characters; contains 156 characters
              Open

                              $userTerm = $this->consultationUserTermRepository->update(['executed_status' => ConsultationTermStatusEnum::APPROVED], $userTerm->getKey());

              Line exceeds 120 characters; contains 159 characters
              Open

                      $userTerms = $dto->getUserId() ? collect([$this->consultationUserTermRepository->getUserTermByUserIdAndExecutedAt($dto->getUserId(), $dto->getTerm())])

              Line exceeds 120 characters; contains 149 characters
              Open

                          return $this->consultationUserTermRepository->updateUserTermByExecutedAt($consultationTerm, $executedAt, ['executed_status' => $status]);

              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()))) {

              Line exceeds 120 characters; contains 151 characters
              Open

                                  $terms = $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultation->getKey(), $executedAt);

              Line exceeds 120 characters; contains 140 characters
              Open

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

              Line exceeds 120 characters; contains 167 characters
              Open

                      $extension = $dto->getFile() instanceof UploadedFile ? $dto->getFile()->getClientOriginalExtension() : Str::between($dto->getFile(), 'data:image/', ';base64');

              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()),

              Line exceeds 120 characters; contains 172 characters
              Open

                      if ($consultationTerm->consultation->author->getKey() === $userId || in_array($userId, $consultationTerm->consultation->teachers()->pluck('users.id')->toArray())) {

              Line exceeds 120 characters; contains 136 characters
              Open

                      return $this->filterProposedTerms($consultationUserPivot->consultation_id, $consultationUserPivot->consultation->proposedTerms);

              Line exceeds 120 characters; contains 167 characters
              Open

                              $userTerms = $dto->getUserId() ? collect([$this->consultationUserTermRepository->getUserTermByUserIdAndExecutedAt($dto->getUserId(), $dto->getTerm())])

              Line exceeds 120 characters; contains 153 characters
              Open

                                  event(new ChangeTerm($consultationUserTerm->consultationUser->user, $consultationUserTerm->consultationUser, $consultationUserTerm));

              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;

              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();

              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())) {

              Line exceeds 120 characters; contains 125 characters
              Open

                      return $this->consultationUserTermRepository->allQueryBuilder(FilterConsultationTermsListDto::prepareFilters($data));

              Line exceeds 120 characters; contains 175 characters
              Open

                      $consultationUser = ConsultationUserPivot::query()->where('consultation_id', '=', $dto->getConsultationId())->where('id', '=', $dto->getUserTerminId())->firstOrFail();

              Line exceeds 120 characters; contains 158 characters
              Open

                      $userTerms = $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());

              Line exceeds 120 characters; contains 128 characters
              Open

                          $consultation->$key = FileHelper::getFilePath($file, ConstantEnum::DIRECTORY . "/{$consultation->getKey()}/images");

              Line exceeds 120 characters; contains 124 characters
              Open

                      Storage::putFileAs($folder, $dto->getFile(), Carbon::make($dto->getTimestamp())->getTimestamp() . '.' . $extension);

              Line exceeds 120 characters; contains 151 characters
              Open

                          : $this->consultationUserTermRepository->getAllUserTermsByConsultationIdAndExecutedAt($consultationTerm->consultation_id, $dto->getTerm());

              Line exceeds 120 characters; contains 123 characters
              Open

                          $consultation = $this->consultationRepositoryContract->updateModel($consultation, $consultationDto->toArray());

              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()),

              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'));

              Space before opening parenthesis of function call prohibited
              Open

                                  fn (User $teacher) => event(new ReminderTrainerAboutTerm(

              Multi-line function call not indented correctly; expected 20 spaces but found 24
              Open

                                      $userTerm->consultationUser,

              Space before opening parenthesis of function call prohibited
              Open

                          fn (ConsultationUserTerm $term) => Carbon::make($term->executed_at)

              Multi-line function call not indented correctly; expected 20 spaces but found 24
              Open

                                      $reminderStatus,

              Multi-line function call not indented correctly; expected 20 spaces but found 24
              Open

                                      $userTerm

              Multi-line function call not indented correctly; expected 20 spaces but found 24
              Open

                                      $teacher,

              Space before opening parenthesis of function call prohibited
              Open

                      if ($terms->first(fn (ConsultationUserPivot $userPivot) => $userPivot->user_id === $userId) !== null) {

              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();

              Space before opening parenthesis of function call prohibited
              Open

                      if ($terms->first(fn (ConsultationUserPivot $userPivot) => $userPivot->user_id === $userId) !== null) {

              There are no issues that match your filters.

              Category
              Status