Completed
Push — master ( 7438e0...233486 )
by ARCANEDEV
03:24
created

MediaServiceProvider::getBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanesoft\Media;
2
3
use Arcanesoft\Core\Bases\PackageServiceProvider;
4
5
/**
6
 * Class     MediaServiceProvider
7
 *
8
 * @package  Arcanesoft\Media
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class MediaServiceProvider extends PackageServiceProvider
0 ignored issues
show
Bug introduced by
There is one abstract method getBasePath in this class; you could implement it, or declare this class as abstract.
Loading history...
12
{
13
    /* -----------------------------------------------------------------
14
     |  Properties
15
     | -----------------------------------------------------------------
16
     */
17
    /**
18
     * Package name.
19
     *
20
     * @var string
21
     */
22
    protected $package = 'media';
23
24
    /* -----------------------------------------------------------------
25
     |  Main Functions
26
     | -----------------------------------------------------------------
27
     */
28
    /**
29
     * Register the service provider.
30
     */
31 18
    public function register()
32
    {
33 18
        parent::register();
34
35 18
        $this->registerConfig();
36 18
        $this->registerSidebarItems();
37 18
        $this->registerProviders([
38 18
            Providers\PackagesServiceProvider::class,
39 12
            Providers\AuthorizationServiceProvider::class,
40 12
        ]);
41 18
        $this->registerConsoleServiceProvider(Providers\ConsoleServiceProvider::class);
42
43 18
        $this->syncFilesystemConfig();
44 18
        $this->registerMediaManager();
45 18
    }
46
47
    /**
48
     * Boot the service provider.
49
     */
50 18
    public function boot()
51
    {
52 18
        parent::boot();
53
54 18
        $this->registerProvider(Providers\RouteServiceProvider::class);
55
56
        // Publishes
57 18
        $this->publishConfig();
58 18
        $this->publishViews();
59 18
        $this->publishTranslations();
60 18
        $this->publishSidebarItems();
61 18
        $this->publishAssets();
62 18
    }
63
64
    /**
65
     * Get the services provided by the provider.
66
     *
67
     * @return array
68
     */
69 3
    public function provides()
70
    {
71
        return [
72 3
            Contracts\Media::class,
73 2
        ];
74
    }
75
76
    /* -----------------------------------------------------------------
77
     |  Other Methods
78
     | -----------------------------------------------------------------
79
     */
80
    /**
81
     * Sync the filesystem config.
82
     */
83 18
    private function syncFilesystemConfig()
84
    {
85 18
        foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) {
86 18
            $this->config()->set("filesystems.disks.$disk", $config);
87 12
        }
88 18
    }
89
90
    /**
91
     * Register the media manager.
92
     */
93 18
    private function registerMediaManager()
94
    {
95 18
        $this->singleton(Contracts\Media::class, Media::class);
96 18
    }
97
98
    /**
99
     * Publish the assets.
100
     */
101 18
    private function publishAssets()
102
    {
103 18
        $this->publishes([
104 18
            $this->getResourcesPath().DS.'assets'.DS.'js' => resource_path("assets/back/js/components/{$this->vendor}/{$this->package}"),
0 ignored issues
show
Bug introduced by
The method getResourcesPath() does not seem to exist on object<Arcanesoft\Media\MediaServiceProvider>.

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...
105 18
        ], 'assets-js');
106 18
    }
107
}
108