Conditions | 5 |
Paths | 1 |
Total Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Tests | 21 |
CRAP Score | 5.0488 |
Changes | 0 |
1 | <?php |
||
35 | 3 | public function install(): void |
|
36 | { |
||
37 | 3 | $this->require('vlucas/phpdotenv'); |
|
38 | |||
39 | 3 | $this->task( |
|
|
|||
40 | 3 | 'Creating .env', |
|
41 | function () { |
||
42 | 3 | if (! File::exists(base_path('.env'))) { |
|
43 | 3 | return File::put(base_path('.env'), 'CONSUMER_KEY='); |
|
44 | } |
||
45 | |||
46 | return false; |
||
47 | 3 | } |
|
48 | ); |
||
49 | |||
50 | 3 | $this->task( |
|
51 | 3 | 'Creating .env.example', |
|
52 | function () { |
||
53 | 3 | if (! File::exists(base_path('.env.example'))) { |
|
54 | 3 | return File::put(base_path('.env.example'), 'CONSUMER_KEY='); |
|
55 | } |
||
56 | |||
57 | return false; |
||
58 | 3 | } |
|
59 | ); |
||
60 | |||
61 | 3 | $this->task( |
|
62 | 3 | 'Updating .gitignore', |
|
63 | function () { |
||
64 | 3 | $gitignorePath = base_path('.gitignore'); |
|
65 | 3 | if (File::exists($gitignorePath)) { |
|
66 | 3 | $contents = File::get($gitignorePath); |
|
67 | 3 | $neededLine = '.env'; |
|
68 | 3 | if (! Str::contains($contents, $neededLine)) { |
|
69 | 3 | File::append($gitignorePath, $neededLine . PHP_EOL); |
|
70 | |||
71 | 3 | return true; |
|
72 | } |
||
73 | } |
||
74 | |||
75 | return false; |
||
76 | 3 | } |
|
80 |