Completed
Push — master ( 396778...5e0c6d )
by Changwan
03:27
created

BeanstalkServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Wandu\Q\Providers;
3
4
use Pheanstalk\Pheanstalk;
5
use Pheanstalk\PheanstalkInterface;
6
use Wandu\DI\ContainerInterface;
7
use Wandu\DI\ServiceProviderInterface;
8
use function Wandu\Foundation\config;
9
10
class BeanstalkServiceProvider implements ServiceProviderInterface 
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function register(ContainerInterface $app)
16
    {
17
        $app->closure(PheanstalkInterface::class, function () {
18
            return new Pheanstalk(
19
                config('beanstalkd.host', '127.0.0.1'),
20
                config('beanstalkd.port', Pheanstalk::DEFAULT_PORT),
21
                config('beanstalkd.timeout'),
22
                config('beanstalkd.connect_persistent', false)
23
            );
24
        });
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function boot(ContainerInterface $app)
31
    {
32
    }
33
}
34