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