| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function get(): ?string |
||
| 22 | { |
||
| 23 | if (!$this->has()) { |
||
| 24 | return null; |
||
| 25 | } |
||
| 26 | |||
| 27 | try { |
||
| 28 | //Somehow I got this error: unserialize(): Error at offset 0 of 2 bytes |
||
| 29 | //I needed to change decrypt(value, unserialize = false); |
||
| 30 | return app('encrypter')->decrypt($this->getCookie(), false); |
||
| 31 | } catch (DecryptException $e) { |
||
| 32 | //Somehow the middleware for decrypting does not kick in here... |
||
| 33 | //but it even fails if we use php artisan <something> (weird) |
||
| 34 | //if it happes we can simply give it normally back |
||
| 35 | return $this->getCookie(); |
||
| 36 | } catch (\Exception $e) { |
||
| 37 | //So I don't return a cookie in that case |
||
| 38 | return null; |
||
| 39 | } |
||
| 56 |