| Conditions | 7 |
| Paths | 48 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 41 | public function __construct(array $data = []) |
||
| 42 | { |
||
| 43 | foreach ($data as $key => $value) { |
||
| 44 | $attribute = camel_case($key); |
||
| 45 | |||
| 46 | if (property_exists($this, $attribute)) { |
||
| 47 | $this->{$attribute} = $value; |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | if (empty($this->iss)) { |
||
| 52 | $this->iss = Config::get('app.url'); |
||
| 53 | } |
||
| 54 | |||
| 55 | if (empty($this->iat)) { |
||
| 56 | $this->iat = Carbon::now()->timestamp; |
||
| 57 | } |
||
| 58 | |||
| 59 | if (empty($this->iat)) { |
||
| 60 | $this->exp = $this->iat + (Config::get('jwt.ttl') * 60); // turns minute into second |
||
|
|
|||
| 61 | } |
||
| 62 | |||
| 63 | if (empty($this->jti)) { |
||
| 64 | $this->jti = md5("{$this->sub}.{$this->iat}." . rand(1000, 1999)); |
||
| 65 | } |
||
| 66 | } |
||
| 67 | |||
| 100 | } |
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.