Completed
Push — master ( f9cde8...a216df )
by Manel
05:45
created

PaymentsServiceProvider   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 7
Bugs 1 Features 0
Metric Value
wmc 12
lcom 1
cbo 3
dl 0
loc 103
ccs 0
cts 74
cp 0
rs 10
c 7
b 1
f 0

10 Methods

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