PutHelperServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 3
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 5 1
A boot() 0 6 3
1
<?php
2
namespace Djunehor\PutHelper;
3
4
use Illuminate\Support\ServiceProvider;
5
use Illuminate\Support\Facades\Validator;
6
use Illuminate\Http\UploadedFile;
7
8
class PutHelperServiceProvider extends ServiceProvider
9
{
10
11
12
    /**
13
     * Register the application services.
14
     *
15
     * @return void
16
     */
17 5
    public function register()
18
    {
19 5
        $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel');
20 5
        $kernel->pushMiddleware(PutRequestMiddleware::class);
21 5
    }
22
23
    protected $message = ':attribute be a file';
24
25
    /**
26
     * Publishes all the config file this package needs to function.
27
     */
28 5
    public function boot()
29
    {
30
        Validator::extend('put_file', function ($attribute, $value, $parameters, $validator) {
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $validator is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31 1
            return (is_object($value) && ($value && get_class($value) == UploadedFile::class));
32 5
        }, $this->message);
33 5
    }
34
35
}
36