RequestThreadControl::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

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 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Callback;
6
7
class RequestThreadControl
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $requestedOwnerAppId;
13
14
    /**
15
     * @var string|null
16
     */
17
    protected $metadata;
18
19
    /**
20
     * TakeThreadControl constructor.
21
     */
22 1
    public function __construct(int $requestedOwnerAppId, ?string $metadata)
23
    {
24 1
        $this->requestedOwnerAppId = $requestedOwnerAppId;
25 1
        $this->metadata = $metadata;
26 1
    }
27
28 1
    public function getRequestedOwnerAppId(): int
29
    {
30 1
        return $this->requestedOwnerAppId;
31
    }
32
33 1
    public function getMetadata(): ?string
34
    {
35 1
        return $this->metadata;
36
    }
37
38
    /**
39
     * @return \Kerox\Messenger\Model\Callback\RequestThreadControl
40
     */
41 1
    public static function create(array $callbackData): self
42
    {
43 1
        return new self($callbackData['requested_owner_app_id'], $callbackData['metadata'] ?? null);
44
    }
45
}
46