Completed
Push — master ( 857394...f8b6bf )
by Mahmoud
03:15
created

MainServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 92
c 1
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 10 1
1
<?php
2
3
namespace App\Port\Provider;
4
5
use App\Port\Foundation\Portals\PortButler;
6
use App\Port\Foundation\Providers\FoundationServiceProvider;
7
use App\Port\Foundation\Traits\FractalTrait;
8
use App\Port\Foundation\Traits\QueryDebuggerTrait;
9
use App\Port\Loader\AutoLoaderTrait;
10
use App\Port\Provider\Abstracts\ServiceProviderAbstract;
11
use App\Port\Route\Providers\RoutesServiceProvider;
12
use Barryvdh\Cors\ServiceProvider as CorsServiceProvider;
13
use Dingo\Api\Provider\LaravelServiceProvider as DingoApiServiceProvider;
14
use Prettus\Repository\Providers\RepositoryServiceProvider;
15
use Vinkla\Hashids\Facades\Hashids;
16
use Vinkla\Hashids\HashidsServiceProvider;
17
18
/**
19
 * Class MainServiceProvider
20
 * The main Service Provider where all Service Providers gets registered
21
 * this is the only Service Provider that gets injected in the Config/app.php.
22
 *
23
 * A.K.A app/Providers/AppServiceProvider.php
24
 *
25
 * Class PortServiceProvider
26
 *
27
 * @author  Mahmoud Zalt <[email protected]>
28
 */
29
class MainServiceProvider extends ServiceProviderAbstract
30
{
31
    use FractalTrait;
32
    use AutoLoaderTrait;
33
34
    /**
35
     * Port Service Providers
36
     *
37
     * @var array
38
     */
39
    private $serviceProviders = [
0 ignored issues
show
Unused Code introduced by
The property $serviceProviders is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
40
        FoundationServiceProvider::class,
41
        DingoApiServiceProvider::class,
42
        CorsServiceProvider::class,
43
        RepositoryServiceProvider::class,
44
        RoutesServiceProvider::class,
45
        HashidsServiceProvider::class,
46
    ];
47
48
    /**
49
     * Port Aliases (mainly for third party packages)
50
     *
51
     * @var  array
52
     */
53
    protected $aliases = [
54
        'Hashids' => Hashids::class,
55
    ];
56
57
    /**
58
     * Port Config directories
59
     *
60
     * @var array
61
     */
62
    protected $portConfigsDirectories = [
63
        'Config/Configs',
64
        'Queue/Configs',
65
        'HashId/Configs',
66
    ];
67
68
    /**
69
     * Port Migration directories
70
     *
71
     * @var  array
72
     */
73
    protected $portMigrationsDirectories = [
74
        'Queue/Data/Migrations',
75
    ];
76
77
    /**
78
     * Port Console directories
79
     *
80
     * @var  array
81
     */
82
    protected $portConsolesDirectories = [
83
84
    ];
85
86
87
    /**
88
     * Port Views directories
89
     *
90
     * @var  array
91
     */
92
    protected $portViewsDirectories = [
93
94
    ];
95
96
    /**
97
     * Perform post-registration booting of services.
98
     */
99
    public function boot()
100
    {
101
        $this->bootLoaders();
102
103
        $this->overrideDefaultFractalSerializer();
104
    }
105
106
    /**
107
     * Register bindings in the container.
108
     */
109
    public function register()
110
    {
111
        $this->app->bind('PortButler', function () {
112
            return $this->app->make(PortButler::class);
113
        });
114
115
        $this->changeTheDefaultFactoriesPath();
116
117
        $this->registerLoaders();
118
    }
119
120
}
121