Completed
Pull Request — master (#39)
by Aleksandr
06:46
created

QueueDeclaration::declure()   A

Complexity

Conditions 5
Paths 3

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 10
c 0
b 0
f 0
nc 3
nop 0
dl 0
loc 13
rs 9.6111
1
<?php
2
3
4
namespace OldSound\RabbitMqBundle\Declarations;
5
6
/**
7
 * @TODO move
8
 */
9
class QueueDeclaration
10
{
11
    public $name;
12
    public $passive;
13
    public $durable;
14
    public $exclusive;
15
    public $autoDelete;
16
    public $nowait;
17
    public $arguments;
18
    public $ticket;
19
    public $declare;
20
21
    // TODO remove
22
    public function setAnonymus()
23
    {
24
        $this->setQueueOptions(array(
0 ignored issues
show
Bug introduced by
The method setQueueOptions() does not exist on OldSound\RabbitMqBundle\...ations\QueueDeclaration. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $this->/** @scrutinizer ignore-call */ 
25
               setQueueOptions(array(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
            'name' => '',
26
            'passive' => false,
27
            'durable' => false,
28
            'exclusive' => true,
29
            'auto_delete' => true,
30
            'nowait' => false,
31
            'arguments' => null,
32
            'ticket' => null
33
        ));
34
    }
35
36
    /**
37
     *  TODO delete
38
     */
39
    public function declure() {
40
        foreach ($this->queues as $name => $options) {
0 ignored issues
show
Bug Best Practice introduced by
The property queues does not exist on OldSound\RabbitMqBundle\...ations\QueueDeclaration. Did you maybe forget to declare it?
Loading history...
41
            list($queueName, ,) = $this->getChannel()->queue_declare($name, $options['passive'],
0 ignored issues
show
Bug introduced by
The method getChannel() does not exist on OldSound\RabbitMqBundle\...ations\QueueDeclaration. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
            list($queueName, ,) = $this->/** @scrutinizer ignore-call */ getChannel()->queue_declare($name, $options['passive'],

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
                $options['durable'], $options['exclusive'],
43
                $options['auto_delete'], $options['nowait'],
44
                $options['arguments'], $options['ticket']);
45
46
            if (isset($options['routing_keys']) && count($options['routing_keys']) > 0) {
47
                foreach ($options['routing_keys'] as $routingKey) {
48
                    $this->queueBind($queueName, $this->exchangeOptions['name'], $routingKey, $options['arguments'] ?? []);
0 ignored issues
show
Bug Best Practice introduced by
The property exchangeOptions does not exist on OldSound\RabbitMqBundle\...ations\QueueDeclaration. Did you maybe forget to declare it?
Loading history...
Bug introduced by
The method queueBind() does not exist on OldSound\RabbitMqBundle\...ations\QueueDeclaration. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
                    $this->/** @scrutinizer ignore-call */ 
49
                           queueBind($queueName, $this->exchangeOptions['name'], $routingKey, $options['arguments'] ?? []);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
                }
50
            } else {
51
                $this->queueBind($queueName, $this->exchangeOptions['name'], $this->routingKey, $options['arguments'] ?? []);
0 ignored issues
show
Bug Best Practice introduced by
The property routingKey does not exist on OldSound\RabbitMqBundle\...ations\QueueDeclaration. Did you maybe forget to declare it?
Loading history...
52
            }
53
        }
54
    }
55
}