Payload::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 3
crap 2
1
<?php
2
3
namespace Simplario\Quedis;
4
5
use Simplario\Quedis\Interfaces\PayloadInterface;
6
7
/**
8
 * Class Payload
9
 * @package Simplario\Quedis
10
 */
11
class Payload implements PayloadInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $token;
17
    /**
18
     * @var string
19
     */
20
    protected $queue;
21
    /**
22
     * @var string
23
     */
24
    protected $state;
25
26
    /**
27
     * Payload constructor.
28
     * @param string|Message $token
29
     * @param string $queue
30
     * @param string $state
31
     */
32 25
    public function __construct($token, $queue, $state)
33
    {
34 25
        $this->token = $token instanceof Message ? $token->getToken() : $token;
35 25
        $this->queue = $queue;
36 25
        $this->state = $state;
37 25
    }
38
39
    /**
40
     * @return string
41
     */
42 19
    public function getToken()
43
    {
44 19
        return $this->token;
45
    }
46
47
    /**
48
     * @return string
49
     */
50 19
    public function getQueue()
51
    {
52 19
        return $this->queue;
53
    }
54
55
    /**
56
     * @return string
57
     */
58 24
    public function getState()
59
    {
60 24
        return $this->state;
61
    }
62
63
64
}
65