Conditions | 5 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5.009 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | 3 | public function handle(): int |
|
39 | { |
||
40 | 3 | $guardName = $this->argument('guard'); |
|
41 | 3 | if (!is_string($guardName) && !is_null($guardName)) { |
|
42 | throw new InvalidArgumentException('Not valid "guard" parameter.'); |
||
43 | } |
||
44 | |||
45 | /** @var JWTGuard $guard */ |
||
46 | 3 | $guard = Auth::guard($guardName); |
|
47 | 2 | $blockList = $guard->blockList(); |
|
48 | |||
49 | 2 | if ($blockList instanceof HasObsoleteRecords) { |
|
50 | 1 | if ($blockList->removeObsoleteRecords()) { |
|
51 | 1 | $this->info('Pruned'); |
|
52 | |||
53 | 1 | return 0; |
|
54 | } |
||
55 | |||
56 | 1 | $this->error('Prune error'); |
|
57 | |||
58 | 1 | return 1; |
|
59 | } |
||
60 | |||
61 | 1 | $this->warn('Blocklist has not interface "HasOutdatedRecords"'); |
|
62 | |||
63 | 1 | return 0; |
|
64 | } |
||
66 |