Completed
Push — master ( c854c2...bcd47a )
by David Martínez
02:02
created

TimetablesServiceProvider   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 9
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 74
ccs 0
cts 46
cp 0
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 2
A boot() 0 8 1
A publishTests() 0 7 1
A loadMigrations() 0 4 1
A publishFactories() 0 7 1
A publishConfig() 0 8 1
A defineRoutes() 0 9 2
1
<?php
2
3
namespace Scool\Timetables\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
/**
8
 * Created by PhpStorm.
9
 * User: alumne
10
 * Date: 22/11/16
11
 * Time: 17:34
12
 */
13
class TimetablesServiceProvider extends ServiceProvider
14
{
15
16
    public function register()
17
    {
18
        if(!defined('SCOOL_TIMETABLES_PATH')){
19
            define('SCOOL_TIMETABLES_PATH',realpath(__DIR__.'/../../'));
20
        }
21
22
        $this->app->bind(\Scool\Timetables\Repositories\AttendanceRepository::class, \Scool\Timetables\Repositories\AttendanceRepositoryEloquent::class);
23
24
    }
25
26
    public function boot()
27
    {
28
        $this->defineRoutes();
29
//        $this->loadMigrations();
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% 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...
30
//        $this->publishFactories();
31
//        $this->publishConfig();
32
        $this->publishTests();
33
    }
34
35
    private function publishTests()
36
    {
37
        $this->publishes(
38
            [SCOOL_TIMETABLES_PATH.'/tests/TimetablesTest.php' =>'tests/TimetablesTest.php'],
39
            'scool_timetables'
40
        );
41
    }
42
43
    /**
44
     * Load migrations.
45
     */
46
    private function loadMigrations()
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
47
    {
48
        $this->loadMigrationsFrom(SCOOL_TIMETABLES_PATH . '/database/migrations');
49
    }
50
    /**
51
     * Publish factories.
52
     */
53
    private function publishFactories()
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
54
    {
55
        $this->publishes(
56
            ScoolTimetables::factories(),"scool_timetables"
57
            //TODO -> paths in a class
58
        );
59
    }
60
61
62
    /**
63
     * Publish config.
64
     */
65
    private function publishConfig() {
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
66
        $this->publishes(
67
            ScoolTimetables::configs(),"scool_timetables"
68
        );
69
        $this->mergeConfigFrom(
70
            SCOOL_TIMETABLES_PATH . '/config/timetables.php', 'scool_timetables'
71
        );
72
    }
73
74
    /**
75
     * Define the Timetables routes.
76
     */
77
    protected function defineRoutes()
78
    {
79
        if (!$this->app->routesAreCached()) {
80
            $router = app('router');
81
            $router->group(['namespace' => 'Scool\Timetables\Http\Controllers'], function () {
82
                require __DIR__.'/../Http/routes.php';
83
            });
84
        }
85
    }
86
}