| Conditions | 3 |
| Paths | 1 |
| Total Lines | 31 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3.0839 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | 2 | public function install(): void |
|
| 44 | { |
||
| 45 | 2 | $this->require('hmazter/laravel-schedule-list "^2.0"'); |
|
| 46 | |||
| 47 | 2 | $this->task( |
|
| 48 | 2 | 'Creating default schedule list configuration', |
|
| 49 | function () { |
||
| 50 | 2 | if (! File::exists($this->app->configPath('schedule-list.php'))) { |
|
| 51 | return File::copy( |
||
| 52 | static::CONFIG_FILE, |
||
| 53 | $this->app->configPath('schedule-list.php') |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | |||
| 57 | 2 | return false; |
|
| 58 | 2 | } |
|
| 59 | ); |
||
| 60 | |||
| 61 | 2 | $this->task( |
|
| 62 | 2 | 'Setting application name in configuration', |
|
| 63 | function () { |
||
| 64 | 2 | if (! File::exists($this->app->configPath('schedule-list.php'))) { |
|
| 65 | return false; |
||
| 66 | } |
||
| 67 | |||
| 68 | 2 | $updatedConfig = File::get($this->app->configPath('schedule-list.php')); |
|
| 69 | 2 | $updatedConfig = str_replace('%APPLICATION_NAME%', Str::slug(config('app.name')), $updatedConfig); |
|
| 70 | |||
| 71 | 2 | return File::put( |
|
| 72 | 2 | $this->app->configPath('schedule-list.php'), |
|
| 73 | 2 | $updatedConfig |
|
| 74 | ); |
||
| 79 |