PheanstalkConfiguration::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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