Completed
Push — master ( e2da69...8c59c4 )
by Manel
14:48 queued 11:51
created

EnrollmentMobileServiceProvider::defineRoutes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Scool\EnrollmentMobile\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
/**
8
     * Class EnrollmentServiceProvider
9
     * @package Scool\Enrollment\Providers
10
     */
11
    class EnrollmentMobileServiceProvider extends ServiceProvider
12
    {
13
        public function register()
14
        {
15
            if (!defined('SCOOL_ENROLLMENT_MOBILE_PATH')) {
16
                define('SCOOL_ENROLLMENT_MOBILE_PATH', realpath(__DIR__.'/../../'));
17
            }
18
19
            //$this->app->register(NamesServiceProvider::class);
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
20
21
            $this->app->bind(\Scool\EnrollmentMobile\Repositories\EnrollmentRepository::class, \Scool\EnrollmentMobile\Repositories\EnrollmentRepositoryEloquent::class);
22
23
//            $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...
24
//                return new CacheableStatsRepository(new StatsRepository());
25
//            });
26
        }
27
28
        public function boot()
29
        {
30
            $this->defineRoutes();
31
            $this->loadMigrations();
32
            $this->publishFactories();
33
            $this->publishConfig();
34
            $this->publishTests();
35
        }
36
37
        protected function defineRoutes()
38
        {
39
            if (!$this->app->routesAreCached()) {
40
                $router = app('router');
41
                $router->group(['namespace' => 'Scool\EnrollmentMobile\Http\Controllers'], function () {
42
                    require __DIR__.'/../Http/routes.php';
43
                });
44
            }
45
        }
46
47
48
        public function loadMigrations()
49
        {
50
            $this->loadMigrationsFrom(__DIR__.'/../../database/migrations');
51
            //$this->loadMigrationsFrom(SCOOL_ENROLLMENT_MOBILE_PATH.'/database/migrations');
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
52
        }
53
54
        public function publishFactories()
55
        {
56
            $this->publishes(
57
          [
58
              SCOOL_ENROLLMENT_MOBILE_PATH . '/database/factories/EnrollmentMobileFactory.php' =>
59
            database_path().'/factories/EnrollmentMobileFactory.php'],
60
            "scool_enrollment_mobile"
61
        );
62
        }
63
64
        public function publishTests()
65
        {
66
            $this->publishes(
67
        [
68
            SCOOL_ENROLLMENT_MOBILE_PATH .
69
            '/tests/EnrollmentMobileTest.php' => 'tests/EnrollmentMobileTest.php'
70
        ], "scool_enrollment_mobile"
71
        );
72
        }
73
        private function publishConfig()
74
        {
75
            $this->publishes(
76
                [ SCOOL_ENROLLMENT_MOBILE_PATH . '/config/enrollment.php' =>
77
                    database_path().'/factories/EnrollmentMobileFactory.php'], "scool_enrollment_mobile"
78
            );
79
            $this->mergeConfigFrom(
80
                [
0 ignored issues
show
Documentation introduced by
array(SCOOL_ENROLLMENT_M... . 'enrollment_mobile') is of type array<string,string>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
81
                SCOOL_ENROLLMENT_MOBILE_PATH . '/config/enrollment_mobile.php'
82
            => config_path() . 'enrollment_mobile'
83
                ],"scool_enrollment_mobile"
84
            );
85
        }
86
    }
87