QueuePoolServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 16
rs 9.4285
cc 2
eloc 8
nc 2
nop 0
1
<?php
2
3
namespace Wanghanlin\QueuePool;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class QueuePoolServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        $this->app->singleton('queue.pool', function () {
15
            return new QueuePool($this->app->basePath());
16
        });
17
18
        $this->app->singleton('command.queue.pool', function ($app) {
19
            return new QueuePoolCommand($app['queue.pool']);
20
        });
21
22
        if ($this->app->runningInConsole()) {
23
            $this->commands([
24
                'command.queue.pool',
25
            ]);
26
        }
27
    }
28
29
    /**
30
     * Register the application services.
31
     */
32
    public function register()
33
    {
34
        //
35
    }
36
37
    /**
38
     * Get the services provided by the provider.
39
     *
40
     * @return array
41
     */
42
    public function provides()
43
    {
44
        return [
45
            'queue.pool', 'command.queue.pool',
46
        ];
47
    }
48
}
49