Failed Conditions
Pull Request — master (#9)
by Maximo
03:21
created

QueueProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
1
<?php
0 ignored issues
show
Coding Style introduced by
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
3
namespace Gewaer\Providers;
4
5
use Phalcon\Di\ServiceProviderInterface;
6
use Phalcon\DiInterface;
7
use Phalcon\Queue\Beanstalk\Extended as Beanstalk;
8
use function Gewaer\Core\envValue;
9
10
class QueueProvider implements ServiceProviderInterface
11
{
12
    /**
13
     * @param DiInterface $container
14
     */
15 4
    public function register(DiInterface $container)
16
    {
17 4
        $container->setShared(
18 4
            'queue',
19
            function () {
20
                //Connect to the queue
21 1
                $queue = new Beanstalk([
22 1
                    'host' => envValue('DATA_API_BEANSTALK_HOST', '127.0.0.1'),
23 1
                    'prefix' => envValue('DATA_API_BEANSTALK_PORT', 11300),
24
                ]);
25
26 1
                return $queue;
27 4
            }
28
        );
29 4
    }
30
}
31