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

PassThreadControl::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Kerox\Messenger\Model\Callback;
4
5
class PassThreadControl
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $newOwnerAppId;
11
12
    /**
13
     * @var string
14
     */
15
    protected $metadata;
16
17
    /**
18
     * TakeThreadControl constructor.
19
     *
20
     * @param string $newOwnerAppId
21
     * @param string $metadata
22
     */
23 2
    public function __construct(string $newOwnerAppId, string $metadata)
24
    {
25 2
        $this->newOwnerAppId = $newOwnerAppId;
26 2
        $this->metadata = $metadata;
27 2
    }
28
29
    /**
30
     * @return string
31
     */
32 1
    public function getNewOwnerAppId(): string
33
    {
34 1
        return $this->newOwnerAppId;
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\PassThreadControl
49
     */
50 2
    public static function create(array $payload): PassThreadControl
51
    {
52 2
        return new static($payload['new_owner_app_id'], $payload['metadata']);
53
    }
54
}
55