Test Failed
Pull Request — master (#70)
by Rafael
05:03
created

QueueProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 19
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
1
<?php
2
3
namespace Gewaer\Providers;
4
5
use Phalcon\Di\ServiceProviderInterface;
6
use Phalcon\DiInterface;
7
use function Gewaer\Core\envValue;
8
9
class QueueProvider implements ServiceProviderInterface
10
{
11
    /**
12
     * @param DiInterface $container
13
     */
14 72
    public function register(DiInterface $container)
15
    {
16 72
        $container->setShared(
17 72
            'queue',
18
            function () {
19
                //Connect to the queue
20 3
                $queue = new \PhpAmqpLib\Connection\AMQPStreamConnection(
21 3
                    envValue('RABBITMQ_HOST'),
22 3
                    envValue('RABBITMQ_PORT'),
23 3
                    envValue('RABBITMQ_DEFAULT_USER'),
24 3
                    envValue('RABBITMQ_DEFAULT_PASS')
25
                );
26
27
                return $queue;
28 72
            }
29
        );
30 72
    }
31
}
32