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

AppServiceProvider::getServiceProviders()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 8
nc 2
nop 0
dl 0
loc 14
ccs 0
cts 12
cp 0
crap 12
rs 9.4285
c 1
b 0
f 0
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