Issues (119)

src/LaravelH5p/LaravelH5pServiceProvider.php (4 issues)

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);
0 ignored issues
show
The call to Djoudi\LaravelH5p\LaravelH5p::__construct() has too many arguments starting with $app. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            $LaravelH5p = /** @scrutinizer ignore-call */ new LaravelH5p($app);

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.

Loading history...
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) {
0 ignored issues
show
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
        $this->app->singleton('command.laravel-h5p.migration', function (/** @scrutinizer ignore-unused */ $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
            return new MigrationCommand();
38
        });
39
40
        $this->app->singleton('command.laravel-h5p.reset', function ($app) {
0 ignored issues
show
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

40
        $this->app->singleton('command.laravel-h5p.reset', function (/** @scrutinizer ignore-unused */ $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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)
0 ignored issues
show
The parameter $router is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

55
    public function boot(/** @scrutinizer ignore-unused */ \Illuminate\Routing\Router $router)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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