Conditions | 3 |
Paths | 4 |
Total Lines | 21 |
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 | // Only delete this token |
||
55 | $delete->where('value', $value); |
||
56 | } |
||
57 | |||
58 | $delete->delete(); |
||
59 | |||
60 | // Check if our interest exist |
||
61 | $count = Interest::where('key', $key); |
||
62 | |||
63 | if (isset($value)) { |
||
64 | $count->where('value', $value); |
||
65 | } |
||
66 | |||
67 | return $count->count() === 0; |
||
68 | } |
||
69 | } |
||
70 |