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