| Conditions | 3 |
| Paths | 4 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | public function forget(string $key, string $value = null): bool |
||
| 49 | { |
||
| 50 | // Delete interest |
||
| 51 | $delete = Interest::where('key', $key); |
||
| 52 | |||
| 53 | if(isset($value)) |
||
| 54 | { |
||
| 55 | // Only delete this token |
||
| 56 | $delete->where('value', $value); |
||
| 57 | } |
||
| 58 | |||
| 59 | $delete->delete(); |
||
| 60 | |||
| 61 | // Check if our interest exist |
||
| 62 | $count = Interest::where('key', $key); |
||
| 63 | |||
| 64 | if(isset($value)) |
||
| 65 | { |
||
| 66 | $count->where('value', $value); |
||
| 67 | } |
||
| 68 | |||
| 69 | return $count->count() === 0; |
||
| 70 | } |
||
| 71 | } |
||
| 72 |