| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class Country extends Model implements CountryContract |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Constructor. |
||
| 23 | * |
||
| 24 | * @param array $attributes additional attributes for model initialisation |
||
| 25 | * |
||
| 26 | * @return void |
||
| 27 | */ |
||
| 28 | public function __construct(array $attributes = []) |
||
| 29 | { |
||
| 30 | parent::__construct($attributes); |
||
| 31 | |||
| 32 | $this->setTable(config('pwweb.localisation.table_names.countries')); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * A country can have multiple languages. |
||
| 37 | * |
||
| 38 | * @return \Illuminate\Database\Eloquent\Relations\HasMany collection of languages used in the country |
||
| 39 | */ |
||
| 40 | public function languages(): HasMany |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Obtain a localised country name. |
||
| 52 | * |
||
| 53 | * @param string $value Original value. |
||
| 54 | * |
||
| 55 | * @return string Localised country name. |
||
| 56 | */ |
||
| 57 | public function getNameAttribute($value) |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.