Installer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 2
eloc 15
c 4
b 0
f 0
dl 0
loc 38
ccs 8
cts 11
cp 0.7272
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A install() 0 18 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Laravel Zero.
7
 *
8
 * (c) Nuno Maduro <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace LaravelZero\Framework\Components\Queue;
15
16
use Illuminate\Support\Facades\File;
17
use LaravelZero\Framework\Components\AbstractInstaller;
18
19
/**
20
 * @internal
21
 */
22
final class Installer extends AbstractInstaller
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected $name = 'install:queue';
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected $description = 'Queues: Unified API across a variety of queue services';
33
34
    /**
35
     * The config file path.
36
     */
37
    private const CONFIG_FILE = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'queue.php';
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 1
    public function install(): void
43
    {
44 1
        $this->call('app:install', ['component' => 'database']);
45
46 1
        $this->require('illuminate/bus "^6.0"');
47 1
        $this->require('illuminate/queue "^6.0"');
48
49 1
        $this->task(
50 1
            'Creating default queue configuration',
51
            function () {
52 1
                if (! File::exists(config_path('queue.php'))) {
53
                    return File::copy(
54
                        static::CONFIG_FILE,
55
                        $this->app->configPath('queue.php')
56
                    );
57
                }
58
59 1
                return false;
60 1
            }
61
        );
62 1
    }
63
}
64