Completed
Push — master ( 1e9766...2fc460 )
by recca
03:57
created

UploadServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 43.75%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 35
ccs 7
cts 16
cp 0.4375
rs 10
c 4
b 1
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A boot() 0 6 2
A handlePublishes() 0 6 1
1
<?php
2
3
namespace Recca0120\Upload;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class UploadServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap any application services.
11
     */
12
    public function boot()
13
    {
14
        if ($this->app->runningInConsole() === true) {
15
            $this->handlePublishes();
16
        }
17
    }
18
19
    /**
20
     * Register the service provider.
21
     */
22 1
    public function register()
23
    {
24 1
        $this->mergeConfigFrom(__DIR__.'/../config/upload.php', 'upload');
25
26 1
        $this->app->singleton(Filesystem::class, Filesystem::class);
27 1
        $this->app->singleton(UploadManager::class, function ($app) {
28 1
            return new UploadManager($app, $app['request'], $app->make(Filesystem::class));
29 1
        });
30 1
    }
31
32
    /**
33
     * handle publishes.
34
     */
35
    protected function handlePublishes()
36
    {
37
        $this->publishes([
38
            __DIR__.'/../config/upload.php' => config_path('upload.php'),
39
        ], 'config');
40
    }
41
}
42