Completed
Push — master ( 92878a...1246df )
by Elf
03:22
created

AppServiceProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 50
ccs 0
cts 24
cp 0
rs 10
c 1
b 0
f 0
wmc 6
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A setLocaleForCarbon() 0 4 1
A register() 0 4 1
A getServiceProviders() 0 14 3
1
<?php
2
3
namespace ElfSundae\Laravel\Support\Providers;
4
5
use Carbon\Carbon;
6
use Illuminate\Support\ServiceProvider;
7
8
class AppServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap any application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->setLocaleForCarbon();
18
    }
19
20
    /**
21
     * Set locale for Carbon.
22
     */
23
    protected function setLocaleForCarbon()
24
    {
25
        return Carbon::setLocale($this->app['config']->get('support.carbon_locale'), $this->app->getLocale());
0 ignored issues
show
Unused Code introduced by
The call to Carbon::setLocale() has too many arguments starting with $this->app->getLocale().

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
26
    }
27
28
    /**
29
     * Register any application services.
30
     *
31
     * @return void
32
     */
33
    public function register()
34
    {
35
        array_map([$this->app, 'register'], $this->getServiceProviders());
36
    }
37
38
    /**
39
     * Get service providers to be registered.
40
     *
41
     * @return array
42
     */
43
    protected function getServiceProviders()
44
    {
45
        $providers = [];
46
47
        if (is_app('admin') || $this->app->runningInConsole()) {
48
            array_push(
49
                $providers,
50
                \ElfSundae\Laravel\Datatables\DatatablesServiceProvider::class,
51
                \Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class
52
            );
53
        }
54
55
        return $providers;
56
    }
57
}
58