| Total Complexity | 3 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait CanMakePassword |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * The plain text version of the password. |
||
| 9 | * |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected string $text; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Create a new instance of a password model. |
||
| 16 | * |
||
| 17 | * @param string $name |
||
| 18 | * @param string $dynamic |
||
| 19 | * @param string $password |
||
| 20 | * @param string|null $text |
||
| 21 | * @return self |
||
| 22 | */ |
||
| 23 | public static function make(string $name, string $dynamic, string $password, string $text = null): self |
||
| 24 | { |
||
| 25 | $attributes = compact('name', 'dynamic', 'password'); |
||
| 26 | |||
| 27 | return (new self($attributes)) |
||
|
|
|||
| 28 | ->setText($text); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Set the plain text version of the password. |
||
| 33 | * Not included when serialized. |
||
| 34 | * |
||
| 35 | * @param string $value |
||
| 36 | * @return $this |
||
| 37 | */ |
||
| 38 | public function setText(string $value): self |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Retrieve the plain text version of the password. |
||
| 46 | * |
||
| 47 | * @return string|null |
||
| 48 | */ |
||
| 49 | public function text(): string|null |
||
| 52 | } |
||
| 53 | } |
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.