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

TimetablesServiceProvider::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 0
Metric Value
c 0
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\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
}