AppServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace App\Providers;
12
13
use Illuminate\Config\Repository;
14
use Illuminate\Foundation\Application;
15
use Illuminate\Support\ServiceProvider;
16
17
/**
18
 * Class AppServiceProvider.
19
 */
20
class AppServiceProvider extends ServiceProvider
21
{
22
    /**
23
     * @var Application
24
     */
25
    protected $app;
26
27
    /**
28
     * @retrun void
29
     * @throws \InvalidArgumentException?query=is%3Aresolved
30
     */
31
    public function register(): void
32
    {
33
        $this->loadLocalProviders($this->app->make(Repository::class));
34
        $this->loadProductionProviders($this->app->make(Repository::class));
35
    }
36
37
    /**
38
     * @param  Repository $repository
39
     * @return void
40
     */
41 View Code Duplication
    private function loadProductionProviders(Repository $repository): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        if (! $this->app->isLocal()) {
44
            $providers = (array) $repository->get('app.production_providers', []);
45
46
            foreach ($providers as $provider) {
47
                $this->app->register($provider);
48
            }
49
        }
50
    }
51
52
    /**
53
     * @param  Repository $repository
54
     * @return void
55
     */
56 View Code Duplication
    private function loadLocalProviders(Repository $repository): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
    {
58
        if ($this->app->isLocal()) {
59
            $providers = (array) $repository->get('app.local_providers', []);
60
61
            foreach ($providers as $provider) {
62
                $this->app->register($provider);
63
            }
64
        }
65
    }
66
67
    /**
68
     * @return void
69
     */
70
    public function boot(): void
71
    {
72
        /**
73
         * @see https://laravel-news.com/laravel-5-4-key-too-long-error
74
         */
75
        \Schema::defaultStringLength(191);
76
    }
77
}
78