| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 2 | Features | 2 |
| 1 | <?php |
||
| 17 | public function createUser(array $data) |
||
| 18 | { |
||
| 19 | if (is_array($data)) { |
||
| 20 | $passwordHashed = password_hash($data['password'], PASSWORD_BCRYPT); |
||
| 21 | |||
| 22 | $user = User::create([ |
||
| 23 | 'firstname' => $data['firstname'], |
||
| 24 | 'lastname' => $data['lastname'], |
||
| 25 | 'username' => $data['username'], |
||
| 26 | 'password' => $passwordHashed, |
||
| 27 | 'email' => $data['email'], |
||
| 28 | 'created_at' => date('Y-m-d h:i:s'), |
||
| 29 | 'updated_at' => date('Y-m-d h:i:s'), |
||
| 30 | ]); |
||
| 31 | |||
| 32 | if ($user->id) { |
||
|
|
|||
| 33 | return true; |
||
| 34 | } |
||
| 35 | |||
| 36 | return false; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.