Test Failed
Pull Request — stable (#129)
by
unknown
02:21
created

Installer::getStub()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace LaravelZero\Framework\Commands\Component\Illuminate\Events;
4
5
use Illuminate\Filesystem\Filesystem;
6
use LaravelZero\Framework\Contracts\Commands\Component\Installer as InstallerContract;
7
use LaravelZero\Framework\Commands\Component\Installer as BaseInstaller;
8
9
class Installer extends BaseInstaller implements InstallerContract
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    protected $name = 'install:events';
15
16
    /**
17
     * {@inheritdoc}
18
     */
19
    protected $description = 'Installs the illuminate/events related generator commands';
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getComponentName(): string
25
    {
26
        return 'events';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function install(): bool
33
    {
34
        $this->installServiceProvider();
35
36
        $this->info('Base Component installed! For usage information please reference the Laravel Framework documentation, here: https://laravel.com/docs/5.5/events');
37
38
        return true;
39
    }
40
41
    /**
42
     * Installs the application-level EventServiceProvider where users can register their
43
     * custom events and event listeners.
44
     */
45
    protected function installServiceProvider()
46
    {
47
        $files = $this->laravel->make(Filesystem::class);
48
        $stub = str_replace(
49
            'DummyNamespace',
50
            $this->laravel->getNamespace() . '\Providers',
51
            $files->get($this->getStub())
52
        );
53
54
        $files->put($this->laravel->basePath('app') . '/Providers/' . 'EventServiceProvider.php', $stub);
0 ignored issues
show
Unused Code introduced by
The call to Application::basePath() has too many arguments starting with 'app'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
55
    }
56
57
    /**
58
     * Get the stub file for the generator.
59
     *
60
     * @return string
61
     */
62
    protected function getStub()
63
    {
64
        return __DIR__.'/stubs/event-service-provider.stub';
65
    }
66
}
67