Passed
Push — master ( fb865f...3ad45c )
by Romain
51s queued 14s
created

IceBreakers::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\ProfileSettings;
6
7
class IceBreakers implements \JsonSerializable
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $question;
13
14
    /**
15
     * @var string
16
     */
17
    protected $payload;
18
19
    /**
20
     * IceBreakers constructor.
21
     */
22 1
    public function __construct(string $question, string $payload)
23
    {
24 1
        $this->question = $question;
25 1
        $this->payload = $payload;
26 1
    }
27
28
    /**
29
     * @return \Kerox\Messenger\Model\ProfileSettings\IceBreakers
30
     */
31 1
    public static function create(string $question, string $payload): self
32
    {
33 1
        return new self($question, $payload);
34
    }
35
36 1
    public function toArray(): array
37
    {
38
        return [
39 1
            'question' => $this->question,
40 1
            'payload' => $this->payload,
41
        ];
42
    }
43
44 1
    public function jsonSerialize(): array
45
    {
46 1
        return $this->toArray();
47
    }
48
}
49