Completed
Push — master ( 58f732...eee5e3 )
by Manel
02:29
created

PaymentsServiceProvider   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 11
c 3
b 1
f 0
lcom 1
cbo 3
dl 0
loc 89
ccs 0
cts 62
cp 0
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 2
A boot() 0 8 1
A defineRoutes() 0 9 2
A loadMigrations() 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
            $this->app->register(NamesServiceProvider::class);
25
26
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentRepositoryEloquent::class);
27
28
//            $this->app->bind(StatsRepositoryInterface::class,function() {
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% 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...
29
//                return new CacheableStatsRepository(new StatsRepository());
30
//            });
31
        }
32
33
        public function boot()
34
        {
35
            $this->defineRoutes();
36
            $this->loadMigrations();
37
            $this->publishFactories();
38
            $this->publishConfig();
39
            $this->publishTests();
40
        }
41
42
        protected function defineRoutes()
43
        {
44
            if (!$this->app->routesAreCached()) {
45
                $router = app('router');
46
                $router->group(['namespace' => 'Scool\EnrollmentMobile\Http\Controllers'], function () {
47
                    require __DIR__.'/../Http/routes.php';
48
                });
49
            }
50
        }
51
52
53
        public function loadMigrations()
54
        {
55
            $this->loadMigrationsFrom(SCOOL_ENROLLMENT_MOBILE_PATH . '/database/migrations');
56
        }
57
58
        public function publishFactories()
59
        {
60
            $this->publishes(
61
                ScoolEnrollmentMobile::factories(), "scool_enrollment_mobile"
62
        );
63
        }
64
65
66
        private function publishConfig()
67
        {
68
            $this->publishes(
69
                    ScoolEnrollmentMobile::configs(), "scool_enrollment_mobile"
70
                );
71
            $this->mergeConfigFrom(
72
                SCOOL_ENROLLMENT_MOBILE_PATH . '/config/payment.php', 'scool_enrollment_mobile'
73
            );
74
        }
75
76
        public function publishTests()
77
        {
78
            $this->publishes(
79
                [
80
                    SCOOL_ENROLLMENT_MOBILE_PATH .'/tests/EnrollmentMobileTest.php' => 'tests/EnrollmentMobileTest.php'
81
                ], "scool_enrollment_mobile"
82
            );
83
        }
84
85
        /*
86
         * Register acacha/names Service Provider.
87
         *
88
         */
89
        protected function registerNameServiceProvider()
90
        {
91
            $this->app->register(NamesServiceProvider::class);
92
        }
93
94
        /*
95
         * Register acacha/stateful-eloquent Service Provider.
96
         *
97
         */
98
        protected function registerStatefulEloquentServiceProvider()
99
        {
100
            $this->app->register(StatefulServiceProvider::class);
101
        }
102
    }
103