Passed
Branch develop (0af400)
by Nuno
02:22
created

Installer::install()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2.0811

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 8
cts 11
cp 0.7272
rs 9.6666
c 0
b 0
f 0
cc 2
nc 1
nop 0
crap 2.0811
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
final class Installer extends AbstractInstaller
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected $name = 'install:queue';
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected $description = 'The Laravel Queue component. Provides a unified API across a variety of different queue services.';
30
31
    /**
32
     * The config file path.
33
     */
34
    private const CONFIG_FILE = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'queue.php';
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 1
    public function install(): void
40
    {
41 1
        $this->call('app:install', ['component' => 'database']);
42
43 1
        $this->require('illuminate/bus "5.6.*"');
44 1
        $this->require('illuminate/queue "5.6.*"');
45
46 1
        $this->task(
0 ignored issues
show
Bug introduced by
The method task() does not exist on LaravelZero\Framework\Components\Queue\Installer. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
        $this->/** @scrutinizer ignore-call */ 
47
               task(
Loading history...
47 1
            'Creating default queue configuration',
48
            function () {
49 1
                if (! File::exists(config_path('queue.php'))) {
50
                    return File::copy(
51
                        static::CONFIG_FILE,
52
                        $this->app->configPath('queue.php')
0 ignored issues
show
Bug introduced by
The method configPath() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
                        $this->app->/** @scrutinizer ignore-call */ 
53
                                    configPath('queue.php')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
                    );
54
                }
55
56 1
                return false;
57 1
            }
58
        );
59 1
    }
60
}
61