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