Conditions | 5 |
Paths | 21 |
Total Lines | 34 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
51 | 5 | public function handle() |
|
52 | { |
||
53 | 5 | $all = $this->option('all'); |
|
54 | |||
55 | try { |
||
56 | 5 | if ($all) { |
|
57 | 2 | $this->info('Trying to renew both your keys...'); |
|
58 | |||
59 | 2 | $this->apiKey->renewPrimary(config('signere.primary_key')); |
|
60 | 1 | $this->apiKey->renewSecondary(config('signere.secondary_key')); |
|
61 | |||
62 | 1 | $this->info('Both your keys were renewed!'); |
|
63 | |||
64 | 1 | return; |
|
65 | } |
||
66 | |||
67 | 3 | $key = $this->option('key') ?: 'primary'; |
|
68 | 3 | $this->info("Trying to renew your {$key} key..."); |
|
69 | |||
70 | 3 | if ($key === 'secondary') { |
|
71 | 1 | $this->apiKey->renewSecondary(config('signere.secondary_key')); |
|
72 | } else { |
||
73 | 2 | $this->apiKey->renewPrimary(config('signere.primary_key')); |
|
74 | } |
||
75 | |||
76 | 3 | $this->info("Your {$key} key was renewed!"); |
|
77 | |||
78 | 3 | return; |
|
79 | 1 | } catch (Exception $e) { |
|
80 | 1 | $this->error("Renewing failed because: {$e->getMessage()}."); |
|
81 | |||
82 | 1 | return -1; |
|
83 | } |
||
84 | } |
||
85 | } |
||
86 |