PaymentsServiceProvider   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 111
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 7
Bugs 1 Features 0
Metric Value
wmc 13
c 7
b 1
f 0
lcom 1
cbo 3
dl 0
loc 111
ccs 0
cts 82
cp 0
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
B register() 0 24 2
A boot() 0 10 1
A defineRoutes() 0 9 2
A loadMigrations() 0 4 1
A loadViews() 0 4 1
A publishFactories() 0 6 1
A publishVueComponents() 0 6 1
A publishConfig() 0 9 1
A publishTests() 0 8 1
A registerNameServiceProvider() 0 4 1
A registerStatefulEloquentServiceProvider() 0 4 1
1
<?php
2
3
namespace Scool\EnrollmentMobile\Providers;
4
5
use Acacha\Names\Providers\NamesServiceProvider;
6
use Acacha\Stateful\Providers\StatefulServiceProvider;
7
use Illuminate\Support\ServiceProvider;
8
use Scool\EnrollmentMobile\ScoolEnrollmentMobile;
9
10
/**
11
     * Class EnrollmentServiceProvider
12
     * @package Scool\Enrollment\Providers
13
     */
14
    class PaymentsServiceProvider extends ServiceProvider
15
    {
16
        public function register()
17
        {
18
            if (!defined('SCOOL_ENROLLMENT_MOBILE_PATH')) {
19
                define('SCOOL_ENROLLMENT_MOBILE_PATH', realpath(__DIR__.'/../../'));
20
            }
21
            $this->registerNameServiceProvider();
22
23
            $this->registerStatefulEloquentServiceProvider();
24
25
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentRepositoryEloquent::class);
26
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\ClassroomRepository::class, \Scool\EnrollmentMobile\Repositories\ClassroomRepositoryEloquent::class);
27
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\CourseRepository::class, \Scool\EnrollmentMobile\Repositories\CourseRepositoryEloquent::class);
28
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentStudySubmoduleRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentStudySubmoduleRepositoryEloquent::class);
29
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\CycleRepository::class, \Scool\EnrollmentMobile\Repositories\CycleRepositoryEloquent::class);
30
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\FamilyRepository::class, \Scool\EnrollmentMobile\Repositories\FamilyRepositoryEloquent::class);
31
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\ModuleRepository::class, \Scool\EnrollmentMobile\Repositories\ModuleRepositoryEloquent::class);
32
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\SubmoduleRepository::class, \Scool\EnrollmentMobile\Repositories\SubmoduleRepositoryEloquent::class);
33
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\SubmoduleTypeRepository::class, \Scool\EnrollmentMobile\Repositories\SubmoduleTypeRepositoryEloquent::class);
34
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\PersonRepository::class, \Scool\EnrollmentMobile\Repositories\PersonRepositoryEloquent::class);
35
        //:end-bindings:
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
36
//            $this->app->bind(StatsRepositoryInterface::class,function() {
37
//                return new CacheableStatsRepository(new StatsRepository());
38
//            });
39
        }
40
41
        public function boot()
42
        {
43
            $this->defineRoutes();
44
            $this->loadMigrations();
45
            $this->publishFactories();
46
            $this->publishConfig();
47
            $this->publishTests();
48
            $this->publishVueComponents();
49
            $this->loadViews();
50
        }
51
52
        protected function defineRoutes()
53
        {
54
            if (!$this->app->routesAreCached()) {
55
                $router = app('router');
56
                $router->group(['namespace' => 'Scool\EnrollmentMobile\Http\Controllers'], function () {
57
                    require __DIR__.'/../Http/routes.php';
58
                });
59
            }
60
        }
61
62
63
        public function loadMigrations()
64
        {
65
            $this->loadMigrationsFrom(SCOOL_ENROLLMENT_MOBILE_PATH . '/database/migrations');
66
        }
67
68
        private function loadViews()
69
        {
70
            $this->loadViewsFrom(SCOOL_ENROLLMENT_MOBILE_PATH . '/resources/views', 'enrollment_mobile');
71
        }
72
73
74
        public function publishFactories()
75
        {
76
            $this->publishes(
77
                ScoolEnrollmentMobile::factories(), "enrollment_mobile"
78
        );
79
        }
80
81
        public function publishVueComponents()
82
        {
83
            $this->publishes(
84
                ScoolEnrollmentMobile::vue(), "enrollment_mobile"
85
            );
86
        }
87
88
        private function publishConfig()
89
        {
90
            $this->publishes(
91
                    ScoolEnrollmentMobile::configs(), "enrollment_mobile"
92
                );
93
            $this->mergeConfigFrom(
94
                SCOOL_ENROLLMENT_MOBILE_PATH . '/config/payment.php', 'enrollment_mobile'
95
            );
96
        }
97
98
        public function publishTests()
99
        {
100
            $this->publishes(
101
                [
102
                    SCOOL_ENROLLMENT_MOBILE_PATH .'/tests/EnrollmentMobileTest.php' => 'tests/EnrollmentMobileTest.php'
103
                ], "enrollment_mobile"
104
            );
105
        }
106
107
        /*
108
         * Register acacha/names Service Provider.
109
         *
110
         */
111
        protected function registerNameServiceProvider()
112
        {
113
            $this->app->register(NamesServiceProvider::class);
114
        }
115
116
        /*
117
         * Register acacha/stateful-eloquent Service Provider.
118
         *
119
         */
120
        protected function registerStatefulEloquentServiceProvider()
121
        {
122
            $this->app->register(StatefulServiceProvider::class);
123
        }
124
    }
125