| Conditions | 3 |
| Paths | 2 |
| Total Lines | 30 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function handle(): void |
||
| 32 | { |
||
| 33 | $site = Site::resolveFromPathOrCurrentWorkingDirectoryOrFail($this->argument('site')); |
||
| 34 | |||
| 35 | $currentNginxConf = $site->nginx_conf; |
||
| 36 | |||
| 37 | $nginxFileLocations = collect(view()->getFinder()->getPaths()) |
||
| 38 | ->map(function ($location) { |
||
| 39 | return $location.'/nginx'; |
||
| 40 | })->toArray(); |
||
| 41 | |||
| 42 | $types = collect(iterator_to_array( |
||
| 43 | Finder::create() |
||
| 44 | ->in($nginxFileLocations) |
||
| 45 | ->directories() |
||
| 46 | ))->mapWithKeys(function (\SplFileInfo $file) use ($currentNginxConf) { |
||
| 47 | $conf = $file->getFilename(); |
||
| 48 | return [$conf => $conf . ($conf == $currentNginxConf ? ' (current)' : '')]; |
||
| 49 | })->sort()->toArray(); |
||
| 50 | |||
| 51 | $option = $this->menu( |
||
|
|
|||
| 52 | 'Available Nginx Types', |
||
| 53 | $types |
||
| 54 | )->open(); |
||
| 55 | |||
| 56 | if (! $option) { |
||
| 57 | return; |
||
| 58 | } |
||
| 59 | |||
| 60 | $site->setNginxType($option); |
||
| 61 | } |
||
| 63 |