| Total Complexity | 8 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class User extends Model implements Authenticatable |
||
| 10 | { |
||
| 11 | protected $folder = 'users'; |
||
| 12 | |||
| 13 | protected $required_fields = [ |
||
| 14 | 'identifier' |
||
| 15 | ]; |
||
| 16 | |||
| 17 | public function findById(string $file_name): ModelInterface |
||
| 18 | { |
||
| 19 | $instance = new static(); |
||
| 20 | |||
| 21 | $instance->setFileName($file_name); |
||
| 22 | $instance->set('identifier', $file_name); |
||
| 23 | |||
| 24 | return $instance; |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function find(string $file_name): ModelInterface |
||
| 28 | { |
||
| 29 | $instance = new static(); |
||
| 30 | $instance->setFileName($file_name); |
||
| 31 | $instance->set('identifier', $file_name); |
||
| 32 | |||
| 33 | return $instance; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getAuthIdentifierName() |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getAuthIdentifier() |
||
| 42 | { |
||
| 43 | return $this->filename(); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getAuthPassword() |
||
| 47 | { |
||
| 48 | return $this->get('password'); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getRememberToken() |
||
| 54 | } |
||
| 55 | |||
| 56 | public function setRememberToken($value) |
||
| 59 | } |
||
| 60 | |||
| 61 | public function getRememberTokenName() |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: