These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Scool\Timetables\Providers; |
||
4 | |||
5 | use Acacha\Names\Providers\NamesServiceProvider; |
||
6 | use Acacha\Stateful\Providers\StatefulServiceProvider; |
||
7 | use Illuminate\Support\ServiceProvider; |
||
8 | use Scool\Timetables\ScoolTimetables; |
||
9 | use Spatie\Permission\PermissionServiceProvider; |
||
10 | |||
11 | /** |
||
12 | * Created by PhpStorm. |
||
13 | * User: alumne |
||
14 | * Date: 22/11/16 |
||
15 | * Time: 17:34 |
||
16 | */ |
||
17 | class TimetablesServiceProvider extends ServiceProvider |
||
18 | { |
||
19 | public function register() |
||
20 | { |
||
21 | if (!defined('SCOOL_TIMETABLES_PATH')) { |
||
22 | define('SCOOL_TIMETABLES_PATH', realpath(__DIR__.'/../../')); |
||
23 | } |
||
24 | |||
25 | $this->registerNameServiceProvider(); |
||
26 | $this->registerPermissionServiceProvider(); |
||
27 | $this->registerStatefulEloquentServiceProvider(); |
||
28 | |||
29 | // $this->app->bind(\Scool\Timetables\Repositories\AttendanceRepository::class, \Scool\Timetables\Repositories\AttendanceRepositoryEloquent::class); |
||
0 ignored issues
–
show
|
|||
30 | // $this->app->bind(\Scool\Timetables\Repositories\DesiratumRepository::class, \Scool\Timetables\Repositories\DesiratumRepositoryEloquent::class); |
||
31 | $this->app->bind(\Scool\Timetables\Repositories\LessonRepository::class, |
||
32 | \Scool\Timetables\Repositories\LessonRepositoryEloquent::class); |
||
33 | //:end-bindings: |
||
34 | } |
||
35 | |||
36 | protected function registerNameServiceProvider() |
||
37 | { |
||
38 | $this->app->register(NamesServiceProvider::class); |
||
39 | } |
||
40 | |||
41 | protected function registerPermissionServiceProvider() |
||
42 | { |
||
43 | $this->app->register(PermissionServiceProvider::class); |
||
44 | } |
||
45 | |||
46 | public function boot() |
||
47 | { |
||
48 | $this->defineRoutes(); |
||
49 | $this->loadMigrations(); |
||
50 | $this->loadViews(); |
||
51 | $this->publishFactories(); |
||
52 | $this->publishConfig(); |
||
53 | $this->publishTests(); |
||
54 | $this->publishViews(); |
||
55 | } |
||
56 | |||
57 | private function publishTests() |
||
58 | { |
||
59 | $this->publishes( |
||
60 | [SCOOL_TIMETABLES_PATH.'/tests/TimetablesTest.php' =>'tests/TimetablesTest.php'], |
||
61 | 'scool_timetables' |
||
62 | ); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Load migrations. |
||
67 | */ |
||
68 | private function loadMigrations() |
||
69 | { |
||
70 | $this->loadMigrationsFrom(SCOOL_TIMETABLES_PATH . '/database/migrations'); |
||
71 | } |
||
72 | /** |
||
73 | * Publish factories. |
||
74 | */ |
||
75 | private function publishFactories() |
||
76 | { |
||
77 | $this->publishes( |
||
78 | ScoolTimetables::factories(), "scool_timetables" |
||
79 | ); |
||
80 | } |
||
81 | |||
82 | |||
83 | /** |
||
84 | * Publish config. |
||
85 | */ |
||
86 | private function publishConfig() |
||
87 | { |
||
88 | $this->publishes( |
||
89 | ScoolTimetables::configs(), "scool_timetables" |
||
90 | ); |
||
91 | $this->mergeConfigFrom( |
||
92 | SCOOL_TIMETABLES_PATH . '/config/timetables.php', 'scool_timetables' |
||
93 | ); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Define the Timetables routes. |
||
98 | */ |
||
99 | protected function defineRoutes() |
||
100 | { |
||
101 | if (!$this->app->routesAreCached()) { |
||
102 | $router = app('router'); |
||
103 | $router->group(['namespace' => 'Scool\Timetables\Http\Controllers'], function () { |
||
104 | require __DIR__.'/../Http/routes.php'; |
||
105 | }); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | private function registerStatefulEloquentServiceProvider() |
||
110 | { |
||
111 | $this->app->register(StatefulServiceProvider::class); |
||
112 | |||
113 | } |
||
114 | |||
115 | /** |
||
116 | * Load package views. |
||
117 | */ |
||
118 | private function loadViews() |
||
119 | { |
||
120 | $this->loadViewsFrom(SCOOL_TIMETABLES_PATH . '/resources/views', 'timetables'); |
||
121 | } |
||
122 | |||
123 | private function publishViews() |
||
124 | { |
||
125 | // $this->publishes( |
||
126 | // [SCOOL_TIMETABLES_PATH.'/resources/views/attendances/index.blade.php' =>'resources/views/vendor/timetables/attendances/index.blade.php'], |
||
127 | // 'scool_timetables' |
||
128 | // ); |
||
129 | } |
||
130 | } |
||
131 |
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.