PhpDefault::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace App\Commands\Php;
4
5
use App\Commands\BaseCommand;
6
use App\Models\PhpVersion;
7
8
class PhpDefault extends BaseCommand
9
{
10
    /**
11
     * The signature of the command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'php:default';
16
17
    /**
18
     * The description of the command.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Set the default PHP version';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return void
28
     */
29
    public function handle(): void
30
    {
31
        $option = $this->menu(
32
            'Available PHP versions',
33
            PhpVersion::pluck('version_number', 'id')->toArray()
34
        )->open();
35
36
        if (!$option) {
37
            return;
38
        }
39
40
        PhpVersion::setDefaultVersion($option);
41
42
        $this->call('make-files');
43
    }
44
}
45