Message   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getBody() 0 4 1
A getContentType() 0 4 1
A getQueueName() 0 4 1
A has() 0 4 1
A get() 0 4 1
A getProperties() 0 4 1
1
<?php
2
3
namespace Kaliop\Queueing\Plugins\StompBundle\Adapter\Stomp;
4
5
use Kaliop\QueueingBundle\Queue\MessageInterface;
6
7
class Message implements MessageInterface
8
{
9
    protected $body;
10
    protected $headers = array();
11
    protected $contentType;
12
    protected $queueName;
13
14
    public function __construct($body, array $headers = array(), $queueName = '')
15
    {
16
        $this->body = $body;
17
        $this->headers = $headers;
18
        /// @todo throw exception if content type not set
19
        $this->contentType = $headers['content-type'];
20
        $this->queueName = $queueName;
21
    }
22
23
    public function getBody()
24
    {
25
        return $this->body;
26
    }
27
28
    /**
29
     * This is hardcoded because
30
     * @return string
31
     */
32
    public function getContentType()
33
    {
34
        return $this->contentType;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getQueueName()
41
    {
42
        return $this->queueName;
43
    }
44
45
    /**
46
     * Check whether a property exists in the 'properties' dictionary
47
     * @param string $name
48
     * @return bool
49
     */
50
    public function has($name)
51
    {
52
        return isset($this->headers[$name]);
53
    }
54
55
    /**
56
     * @param string $name
57
     * @throws \OutOfBoundsException
58
     * @return mixed
59
     */
60
    public function get($name)
61
    {
62
        return $this->headers[$name];
63
    }
64
65
    /**
66
     * Returns the properties content
67
     * @return array
68
     */
69
    public function getProperties()
70
    {
71
        return $this->headers;
72
    }
73
}
74