UploadServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
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 1
    public function boot()
13
    {
14 1
        if ($this->app->runningInConsole() === true) {
15 1
            $this->handlePublishes();
16
        }
17 1
    }
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
        $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 1
    protected function handlePublishes()
36
    {
37 1
        $this->publishes([
38 1
            __DIR__.'/../config/upload.php' => config_path('upload.php'),
39 1
        ], 'config');
40 1
    }
41
}
42