Completed
Pull Request — master (#286)
by
unknown
06:13
created

ExchangeType::requiresRoutingKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PHPDaemon\Clients\AMQP\Driver\Protocol\v091;
4
5
/**
6
 * An exchange's type controls how queue bindings are used to route messages.
7
 *
8
 * @see Connection::exchange() to declare an exchange.
9
 * @see QueueInterface::bind() to bind a queue to an exchange.
10
 * @see https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchanges
11
 */
12
class ExchangeType
13
{
14
    /**
15
     * Route messages to all bindings with a routing key that matches exactly
16
     * the routing key of the message.
17
     */
18
    const DIRECT = 'direct';
19
20
    /**
21
     * Route messages to all bindings. The routing key is ignored.
22
     */
23
    const FANOUT = 'fanout';
24
25
    /**
26
     * Route messages to all bindings with a routing key whose pattern matches
27
     * the routing key of the messages.
28
     */
29
    const TOPIC = 'topic';
30
31
    /**
32
     * Route messages to all bindings with headers that match the message
33
     * headers. The routing key is ignored.
34
     */
35
    const HEADERS = 'headers';
36
37
    /**
38
     * Check whether this exchange type requires a routing key when publishing
39
     * a message.
40
     */
41
    public static function requiresRoutingKey()
42
    {
43
        return [self::DIRECT, self::TOPIC];
44
    }
45
}
46