Passed
Pull Request — master (#17)
by ARCANEDEV
06:05
created

MediaServiceProvider::publishAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanesoft\Media;
6
7
use Arcanesoft\Foundation\Support\Providers\PackageServiceProvider;
8
9
/**
10
 * Class     MediaServiceProvider
11
 *
12
 * @package  Arcanesoft\Media
13
 * @author   ARCANEDEV <[email protected]>
14
 */
15
class MediaServiceProvider extends PackageServiceProvider
16
{
17
    /* -----------------------------------------------------------------
18
     |  Properties
19
     | -----------------------------------------------------------------
20
     */
21
22
    /**
23
     * The package name.
24
     *
25
     * @var  string
26
     */
27
    protected $package = 'media';
28
29
    /**
30
     * Merge multiple config files into one instance (package name as root key).
31
     *
32
     * @var bool
33 120
     */
34
    protected $multiConfigs = true;
35 120
36
    /* -----------------------------------------------------------------
37 120
     |  Main Methods
38 120
     | -----------------------------------------------------------------
39 120
     */
40 120
41 40
    /**
42 40
     * Register any application services.
43 120
     */
44
    public function register(): void
45 120
    {
46 120
        $this->registerConfig();
47 120
48
        $this->registerProviders([
49
            Providers\AuthServiceProvider::class,
50
            Providers\RouteServiceProvider::class,
51
        ]);
52 120
53
        $this->app->booting(function ($app) {
54 120
            /** @var  \Illuminate\Contracts\Config\Repository  $config */
55
            $config = $app['config'];
56
57 120
            $config->set('filesystems.disks', array_merge(
58 120
                $config->get('arcanesoft.media.filesystems.disks', []),
59 120
                $config->get('filesystems.disks', [])
60 120
            ));
61 120
        });
62 120
    }
63
64
    /**
65
     * Boot the service provider.
66
     */
67
    public function boot(): void
68
    {
69 3
        $this->loadTranslations();
70
        $this->loadViews();
71
72 3
        if ($this->app->runningInConsole()) {
73 1
            $this->publishAssets();
74
            $this->publishConfig();
75
            $this->publishTranslations();
76
            $this->publishViews();
77
        }
78
    }
79
}
80