nstack-io /
php-sdk
| 1 | <?php |
||
| 2 | |||
| 3 | namespace NStack\Models; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Class EmailValidation |
||
| 7 | * |
||
| 8 | * @package NStack\Models |
||
| 9 | * @author Tiago Araujo <[email protected]> |
||
| 10 | */ |
||
| 11 | class EmailValidation extends Model |
||
| 12 | { |
||
| 13 | /** @var boolean */ |
||
| 14 | protected $ok; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * parse |
||
| 18 | * |
||
| 19 | * @param array $data |
||
| 20 | * @author Tiago Araujo <[email protected]> |
||
| 21 | */ |
||
| 22 | 1 | public function parse(array $data) |
|
| 23 | { |
||
| 24 | 1 | $this->ok = (int)$data['ok']; |
|
|
0 ignored issues
–
show
|
|||
| 25 | 1 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * toArray |
||
| 29 | * |
||
| 30 | * @return array |
||
| 31 | * @author Tiago Araujo <[email protected]> |
||
| 32 | */ |
||
| 33 | public function toArray(): array |
||
| 34 | { |
||
| 35 | return ['ok' => $this->ok]; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return bool |
||
| 40 | */ |
||
| 41 | public function isOk(): bool |
||
| 42 | { |
||
| 43 | return $this->ok; |
||
| 44 | } |
||
| 45 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.