Appointment
has 55 functions (exceeds 20 allowed). Consider refactoring. Open
class Appointment extends EloquentModel implements HasPresenter
{
/**
* The attributes that are mass assignable.
*
File Appointment.php
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Timegridio\Concierge\Models;
use Carbon\Carbon;
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.
*
- Read upRead up
- Exclude checks
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.
*
- 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 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.
*
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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']);
- 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 'isOnTimeToCancel'. Open
$diff = $this->start_at->diffInHours(Carbon::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();
}
}