BeanstalkServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 24
ccs 0
cts 14
cp 0
rs 10
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 3 1
A register() 0 11 1
1
<?php
2
namespace Wandu\Q\Providers;
3
4
use Pheanstalk\Pheanstalk;
5
use Pheanstalk\PheanstalkInterface;
6
use Wandu\Config\Contracts\Config;
7
use Wandu\DI\ContainerInterface;
8
use Wandu\DI\ServiceProviderInterface;
9
10
class BeanstalkServiceProvider implements ServiceProviderInterface 
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function register(ContainerInterface $app)
16
    {
17
        $app->closure(PheanstalkInterface::class, function (Config $config) {
18
            return new Pheanstalk(
19
                $config->get('pda.pheanstalk.host', '127.0.0.1'),
20
                $config->get('pda.pheanstalk.port', Pheanstalk::DEFAULT_PORT),
21
                $config->get('pda.pheanstalk.timeout'),
22
                $config->get('pda.pheanstalk.connect_persistent', false)
23
            );
24
        });
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function boot(ContainerInterface $app)
31
    {
32
    }
33
}
34