Completed
Push — develop ( db3a75...b9d0ed )
by Abdelrahman
04:30 queued 03:28
created

ComposerServiceProvider::publishResources()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Composer\Providers;
6
7
use Illuminate\Support\ServiceProvider;
8
9
class ComposerServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * The commands to be registered.
13
     *
14
     * @var array
15
     */
16
    protected $commands = [
17
        PublishCommand::class => 'command.rinvex.composer.publish',
18
    ];
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function register()
24
    {
25
        // Merge config
26
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.composer');
27
28
        // Register console commands
29
        ! $this->app->runningInConsole() || $this->registerCommands();
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function boot()
36
    {
37
        // Publish Resources
38
        ! $this->app->runningInConsole() || $this->publishResources();
39
    }
40
41
    /**
42
     * Publish resources.
43
     *
44
     * @return void
45
     */
46
    protected function publishResources(): void
47
    {
48
        $this->publishes([realpath(__DIR__.'/../../config/config.php') => config_path('rinvex.composer.php')], 'rinvex-composer-config');
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 137 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
49
    }
50
51
    /**
52
     * Register console commands.
53
     *
54
     * @return void
55
     */
56
    protected function registerCommands(): void
57
    {
58
        // Register artisan commands
59
        foreach ($this->commands as $key => $value) {
60
            $this->app->singleton($value, $key);
61
        }
62
63
        $this->commands(array_values($this->commands));
64
    }
65
}
66