timegridio/concierge

View on GitHub
src/Models/Appointment.php

Summary

Maintainability
C
1 day
Test Coverage

Appointment has 55 functions (exceeds 20 allowed). Consider refactoring.
Open

class Appointment extends EloquentModel implements HasPresenter
{
    /**
     * The attributes that are mass assignable.
     *
Severity: Major
Found in src/Models/Appointment.php - About 7 hrs to fix

    File Appointment.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Timegridio\Concierge\Models;
    
    use Carbon\Carbon;
    Severity: Minor
    Found in src/Models/Appointment.php - About 4 hrs to fix

      The class Appointment has 28 non-getter- and setter-methods. Consider refactoring Appointment to keep number of methods under 25.
      Open

      class Appointment extends EloquentModel implements HasPresenter
      {
          /**
           * The attributes that are mass assignable.
           *
      Severity: Minor
      Found in src/Models/Appointment.php by phpmd

      TooManyMethods

      Since: 0.1

      A class with too many 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'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class Appointment has 28 public methods. Consider refactoring Appointment to keep number of public methods under 10.
      Open

      class Appointment extends EloquentModel implements HasPresenter
      {
          /**
           * The attributes that are mass assignable.
           *
      Severity: Minor
      Found in src/Models/Appointment.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 Appointment has an overall complexity of 84 which is very high. The configured complexity threshold is 50.
      Open

      class Appointment extends EloquentModel implements HasPresenter
      {
          /**
           * The attributes that are mass assignable.
           *
      Severity: Minor
      Found in src/Models/Appointment.php by phpmd

      The class Appointment has 55 public methods and attributes. Consider reducing the number of public items to less than 45.
      Open

      class Appointment extends EloquentModel implements HasPresenter
      {
          /**
           * The attributes that are mass assignable.
           *
      Severity: Minor
      Found in src/Models/Appointment.php by phpmd

      ExcessivePublicCount

      Since: 0.1

      A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

      Example

      public class Foo {
          public $value;
          public $something;
          public $var;
          // [... more more public attributes ...]
      
          public function doWork() {}
          public function doMoreWork() {}
          public function doWorkAgain() {}
          // [... more more public methods ...]
      }

      Source https://phpmd.org/rules/codesize.html#excessivepubliccount

      Avoid using static access to class '\Carbon\Carbon' in method 'getFinishAtAttribute'.
      Open

                  return Carbon::parse($this->attributes['finish_at']);
      Severity: Minor
      Found in src/Models/Appointment.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 'isOnTimeToCancel'.
      Open

              $diff = $this->start_at->diffInHours(Carbon::now());
      Severity: Minor
      Found in src/Models/Appointment.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

      There are no issues that match your filters.

      Category
      Status