Passed
Pull Request — master (#11)
by Pavel
06:55
created

SampleEntity::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Bankiru\Api\JsonRpc\Test\Entity;
4
5
class SampleEntity implements \JsonSerializable
6
{
7
    /** @var int|null */
8
    private $id;
9
    /** @var  string */
10
    private $payload;
11
12
    /** @var  string */
13
    private $secret;
14
15
    /**
16
     * SampleEntity constructor.
17
     *
18
     * @param string $payload
19
     */
20 4
    public function __construct($payload)
21
    {
22 4
        $this->payload = $payload;
23 4
        $this->secret  = 'secret-payload';
24 4
    }
25
26
    /**
27
     * @return int|null
28
     */
29
    public function getId()
30
    {
31
        return $this->id;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getPayload()
38
    {
39
        return $this->payload;
40
    }
41
42
    /** {@inheritdoc} */
43
    public function jsonSerialize()
44
    {
45
        return [
46
            'id'             => $this->id,
47
            'sample_payload' => $this->payload,
48
        ];
49
    }
50
}
51