Tinker   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 12
c 1
b 0
f 1
dl 0
loc 37
ccs 0
cts 10
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 16 3
1
<?php
2
3
namespace App\Commands\Php;
4
5
use App\Commands\BaseCommand;
6
use App\Models\PhpVersion;
7
use App\Models\Site;
8
9
class Tinker extends BaseCommand
10
{
11
    /**
12
     * The signature of the command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'php:tinker';
17
18
    /**
19
     * The description of the command.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Open tinker in a Laravel project';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return void
29
     */
30
    public function handle(): void
31
    {
32
        if (!$site = Site::resolveFromPathOrCurrentWorkingDirectory()) {
33
            $this->error('Please run this command in a project directory');
34
35
            return;
36
        }
37
38
        $version = optional($site)->php_version ?: PhpVersion::defaultVersion();
39
40
        $this->info("PHP Version: {$version->version_number}");
41
42
        $this->dockerCompose
43
            ->runContainer("php_cli_{$version->safe}")
44
            ->bash('php artisan tinker')
45
            ->perform();
46
    }
47
}
48