Passed
Pull Request — master (#62)
by Romain
02:05
created

TakeThreadControl::__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 2
crap 1
1
<?php
2
3
namespace Kerox\Messenger\Model\Callback;
4
5
class TakeThreadControl
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $previousOwnerAppId;
11
12
    /**
13
     * @var string
14
     */
15
    protected $metadata;
16
17
    /**
18
     * TakeThreadControl constructor.
19
     *
20
     * @param string $previousOwnerAppId
21
     * @param string $metadata
22
     */
23 2
    public function __construct(string $previousOwnerAppId, string $metadata)
24
    {
25 2
        $this->previousOwnerAppId = $previousOwnerAppId;
26 2
        $this->metadata = $metadata;
27 2
    }
28
29
    /**
30
     * @return string
31
     */
32 1
    public function getPreviousOwnerAppId(): string
33
    {
34 1
        return $this->previousOwnerAppId;
35
    }
36
37
    /**
38
     * @return string
39
     */
40 1
    public function getMetadata(): string
41
    {
42 1
        return $this->metadata;
43
    }
44
45
    /**
46
     * @param array $payload
47
     *
48
     * @return \Kerox\Messenger\Model\Callback\TakeThreadControl
49
     */
50 2
    public static function create(array $payload): TakeThreadControl
51
    {
52 2
        return new static($payload['previous_owner_app_id'], $payload['metadata']);
53
    }
54
}
55