PheanstalkConfiguration::getPheanstalk()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 3
eloc 5
nc 4
nop 1
crap 3
1
<?php
2
3
namespace Equip\BeanstalkdConsumer\Configuration;
4
5
use Aura\Cli\Context;
6
use Auryn\Injector;
7
use Pheanstalk\Pheanstalk;
8
use Equip\Configuration\ConfigurationInterface;
9
10
class PheanstalkConfiguration implements ConfigurationInterface
11
{
12 1
    public function apply(Injector $injector)
13
    {
14 1
        $injector->delegate(Pheanstalk::class, [$this, 'getPheanstalk']);
15 1
    }
16
17 1
    public function getPheanstalk(Context $context)
18
    {
19 1
        $env = $context->env;
20 1
        $host = $env->get('BEANSTALKD_HOST') ?: '127.0.0.1';
21 1
        $port = $env->get('BEANSTALKD_PORT') ?: 11300;
22 1
        return new Pheanstalk($host, $port);
23
    }
24
}
25