Conditions | 5 |
Paths | 6 |
Total Lines | 28 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
51 | 3 | public function handle() |
|
52 | { |
||
53 | 3 | $first = base_path('.env.example'); |
|
54 | 3 | $second = base_path('.env'); |
|
55 | |||
56 | 3 | if ($this->option('reverse')) { |
|
57 | 1 | $switch = $first; |
|
58 | 1 | $first = $second; |
|
59 | 1 | $second = $switch; |
|
60 | 1 | unset($switch); |
|
61 | } |
||
62 | |||
63 | 3 | $diffs = $this->sync->getDiff($first, $second); |
|
64 | |||
65 | 3 | if (count($diffs) === 0) { |
|
66 | 1 | $this->info(sprintf("Your %s file is already in sync with %s", basename($second), basename($first))); |
|
67 | 1 | return 0; |
|
68 | } |
||
69 | |||
70 | 2 | $this->info(sprintf("The following variables are not present in your %s file : ", basename($second))); |
|
71 | 2 | foreach ($diffs as $key => $diff) { |
|
72 | 2 | $this->info(sprintf("\t- %s = %s", $key, $diff)); |
|
73 | } |
||
74 | |||
75 | 2 | $this->info(sprintf("You can use `php artisan env:sync%s` to synchronise them", $this->option('reverse') ? ' --reverse' : '')); |
|
76 | |||
77 | 2 | return 1; |
|
78 | } |
||
79 | } |
||
80 |