Completed
Push — master ( 218e3f...ae2124 )
by Gaetano
04:08
created

Message::getQueueName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Kaliop\Queueing\Plugins\KinesisBundle\Adapter\Kinesis;
4
5
use Kaliop\QueueingBundle\Queue\MessageInterface;
6
7
class Message implements MessageInterface
8
{
9
    protected $body;
10
    protected $properties = array();
11
    protected $contentType;
12
    protected $streamName;
13
14
    public function __construct($body, array $properties = array(), $contentType='application/json', $queueName='')
15
    {
16
        $this->body = $body;
17
        $this->properties = $properties;
18
        $this->contentType = $contentType;
19
        $this->streamName = $queueName;
20
    }
21
22
    public function getBody()
23
    {
24
        return $this->body;
25
    }
26
27
    /**
28
     * This is hardcoded because
29
     * @return string
30
     */
31
    public function getContentType()
32
    {
33
        return $this->contentType;
34
    }
35
36
    /**
37
     * Check whether a property exists in the 'properties' dictionary
38
     * @param string $name
39
     * @return bool
40
     */
41
    public function has($name)
42
    {
43
        return isset($this->properties[$name]);
44
    }
45
46
    /**
47
     * @param string $name
48
     * @throws \OutOfBoundsException
49
     * @return mixed
50
     */
51
    public function get($name)
52
    {
53
        return $this->properties[$name];
54
    }
55
56
    /**
57
     * Returns the properties content
58
     * @return array
59
     */
60
    public function getProperties()
61
    {
62
        return $this->properties;
63
    }
64
65
    public function getQueueName()
66
    {
67
        return $this->streamName;
68
    }
69
}
70