Completed
Pull Request — master (#21)
by
unknown
04:20
created

QwatcherServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php namespace Maqe\Qwatcher;
2
3
use Queue;
4
use Illuminate\Support\ServiceProvider;
5
use Illuminate\Support\Facades\Log;
6
7
class QwatcherServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap any application services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        Queue::before(function ($job) {
17
            \Maqe\Qwatcher\Facades\Qwatch::process($job->job->getJobId(), $job->job);
18
        });
19
20
        Queue::after(function ($job) {
21
            \Maqe\Qwatcher\Facades\Qwatch::succeed($job->job->getJobId(), $job->job);
22
        });
23
24
        // Queue::failing(function ($job) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% 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...
25
        //     \Maqe\Qwatcher\Facades\Qwatch::failed($job->job->getJobId(), $job->job);
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
26
        // });
27
    }
28
29
    /**
30
     * Register the service provider.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        /**
37
        * publish migrations
38
        */
39
        $this->publishes([__DIR__ . '/../database/migrations' => database_path('migrations')], 'migrations');
40
        $this->publishes([__DIR__ . '/../config/qwatcher.php' => config_path('qwatcher.php')], 'config');
41
42
        /**
43
        * merge config
44
        */
45
        $this->mergeConfigFrom(__DIR__ . '/../config/qwatcher.php', 'qwatcher');
46
47
        /**
48
        * Register Facade
49
        */
50
        $this->app->bind('Qwatch', function () {
51
            return (new Qwatcher);
52
        });
53
54
        /**
55
        * Register artisan Commands
56
        */
57
        // $this->commands([
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
58
        //     \Maqe\Qwatcher\Commands\SomeCommand1::class,
59
        //     \Maqe\Qwatcher\Commands\SomeCommand2::class
60
        // ]);
61
    }
62
63
    /**
64
     * Get the services provided by the provider.
65
     *
66
     * @return array
67
     */
68
    public function provides()
69
    {
70
        return ['Qwatch'];
71
    }
72
}
73