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

UploadServiceProvider::handlePublishes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
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