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

ExchangeType   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A requiresRoutingKey() 0 4 1
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