|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Djoudi\LaravelH5p; |
|
4
|
|
|
|
|
5
|
|
|
use Djoudi\LaravelH5p\Commands\MigrationCommand; |
|
6
|
|
|
use Djoudi\LaravelH5p\Commands\ResetCommand; |
|
7
|
|
|
use Djoudi\LaravelH5p\Helpers\H5pHelper; |
|
8
|
|
|
|
|
9
|
|
|
class LaravelH5pServiceProvider extends \Illuminate\Support\ServiceProvider |
|
10
|
|
|
{ |
|
11
|
|
|
protected $defer = false; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* The event listener mappings for the application. |
|
15
|
|
|
* |
|
16
|
|
|
* @var array |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $listen = [ |
|
19
|
|
|
'Djoudi\LaravelH5p\Events\H5pEvent' => [ |
|
20
|
|
|
'Djoudi\LaravelH5p\Listeners\H5pNotification', |
|
21
|
|
|
], |
|
22
|
|
|
]; |
|
23
|
|
|
|
|
24
|
|
|
public function register() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->app->singleton('LaravelH5p', function ($app) { |
|
27
|
|
|
$LaravelH5p = new LaravelH5p($app); |
|
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
return $LaravelH5p; |
|
30
|
|
|
}); |
|
31
|
|
|
|
|
32
|
|
|
$this->app->bind('H5pHelper', function () { |
|
33
|
|
|
return new H5pHelper(); |
|
34
|
|
|
}); |
|
35
|
|
|
|
|
36
|
|
|
$this->app->singleton('command.laravel-h5p.migration', function ($app) { |
|
|
|
|
|
|
37
|
|
|
return new MigrationCommand(); |
|
38
|
|
|
}); |
|
39
|
|
|
|
|
40
|
|
|
$this->app->singleton('command.laravel-h5p.reset', function ($app) { |
|
|
|
|
|
|
41
|
|
|
return new ResetCommand(); |
|
42
|
|
|
}); |
|
43
|
|
|
|
|
44
|
|
|
$this->commands([ |
|
45
|
|
|
'command.laravel-h5p.migration', |
|
46
|
|
|
'command.laravel-h5p.reset', |
|
47
|
|
|
]); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Bootstrap the application services. |
|
52
|
|
|
* |
|
53
|
|
|
* @return void |
|
54
|
|
|
*/ |
|
55
|
|
|
public function boot(\Illuminate\Routing\Router $router) |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
$this->loadRoutesFrom(__DIR__.'/../../routes/laravel-h5p.php'); |
|
58
|
|
|
|
|
59
|
|
|
// config |
|
60
|
|
|
$this->publishes([ |
|
61
|
|
|
__DIR__.'/../../config/laravel-h5p.php' => config_path('laravel-h5p.php'), |
|
62
|
|
|
], 'config'); |
|
63
|
|
|
$this->mergeConfigFrom( |
|
64
|
|
|
__DIR__.'/../../config/laravel-h5p.php', 'laravel-h5p' |
|
65
|
|
|
); |
|
66
|
|
|
|
|
67
|
|
|
// language |
|
68
|
|
|
$this->publishes([ |
|
69
|
|
|
__DIR__.'/../../lang/en/laravel-h5p.php' => resource_path('lang/en/laravel-h5p.php'), |
|
70
|
|
|
], 'language'); |
|
71
|
|
|
$this->publishes([ |
|
72
|
|
|
__DIR__.'/../../lang/fr/laravel-h5p.php' => resource_path('lang/fr/laravel-h5p.php'), |
|
73
|
|
|
], 'language'); |
|
74
|
|
|
$this->publishes([ |
|
75
|
|
|
__DIR__.'/../../lang/ar/laravel-h5p.php' => resource_path('lang/ar/laravel-h5p.php'), |
|
76
|
|
|
], 'language'); |
|
77
|
|
|
|
|
78
|
|
|
// views |
|
79
|
|
|
$this->publishes([ |
|
80
|
|
|
__DIR__.'/../../views/h5p' => resource_path('views/h5p'), |
|
81
|
|
|
], 'resources'); |
|
82
|
|
|
|
|
83
|
|
|
// migrations |
|
84
|
|
|
$this->publishes([ |
|
85
|
|
|
__DIR__.'/../../migrations/' => database_path('migrations'), |
|
86
|
|
|
], 'migrations'); |
|
87
|
|
|
|
|
88
|
|
|
// h5p |
|
89
|
|
|
$this->publishes([ |
|
90
|
|
|
__DIR__.'/../../assets' => public_path('assets/vendor/laravel-h5p'), |
|
91
|
|
|
app_path('/../vendor/h5p/h5p-core/fonts') => public_path('assets/vendor/h5p/h5p-core/fonts'), |
|
92
|
|
|
app_path('/../vendor/h5p/h5p-core/images') => public_path('assets/vendor/h5p/h5p-core/images'), |
|
93
|
|
|
app_path('/../vendor/h5p/h5p-core/js') => public_path('assets/vendor/h5p/h5p-core/js'), |
|
94
|
|
|
app_path('/../vendor/h5p/h5p-core/styles') => public_path('assets/vendor/h5p/h5p-core/styles'), |
|
95
|
|
|
app_path('/../vendor/h5p/h5p-editor/ckeditor') => public_path('assets/vendor/h5p/h5p-editor/ckeditor'), |
|
96
|
|
|
app_path('/../vendor/h5p/h5p-editor/images') => public_path('assets/vendor/h5p/h5p-editor/images'), |
|
97
|
|
|
app_path('/../vendor/h5p/h5p-editor/language') => public_path('assets/vendor/h5p/h5p-editor/language'), |
|
98
|
|
|
app_path('/../vendor/h5p/h5p-editor/libs') => public_path('assets/vendor/h5p/h5p-editor/libs'), |
|
99
|
|
|
app_path('/../vendor/h5p/h5p-editor/scripts') => public_path('assets/vendor/h5p/h5p-editor/scripts'), |
|
100
|
|
|
app_path('/../vendor/h5p/h5p-editor/styles') => public_path('assets/vendor/h5p/h5p-editor/styles'), |
|
101
|
|
|
], 'public'); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function provides() |
|
105
|
|
|
{ |
|
106
|
|
|
return [ |
|
107
|
|
|
'command.laravel-h5p.migration', |
|
108
|
|
|
'command.laravel-h5p.reset', |
|
109
|
|
|
]; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.