| Total Complexity | 5 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class ThreadControl implements \JsonSerializable |
||
| 10 | { |
||
| 11 | use ValidatorTrait; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var int |
||
| 15 | */ |
||
| 16 | protected $recipientId; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var null|int |
||
| 20 | */ |
||
| 21 | protected $targetAppId; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var null|string |
||
| 25 | */ |
||
| 26 | protected $metadata; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * PassThreadControl constructor. |
||
| 30 | * |
||
| 31 | * @param int $recipientId |
||
| 32 | 2 | * @param int|null $targetAppId |
|
| 33 | */ |
||
| 34 | 2 | public function __construct(int $recipientId, ?int $targetAppId = null) |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | 2 | * @param int $recipientId |
|
| 42 | * @param int|null $targetAppId |
||
| 43 | 2 | * |
|
| 44 | * @return \Kerox\Messenger\Model\ThreadControl |
||
| 45 | 2 | */ |
|
| 46 | 2 | public static function create(int $recipientId, ?int $targetAppId = null): self |
|
| 47 | { |
||
| 48 | return new self($recipientId, $targetAppId); |
||
| 49 | } |
||
| 50 | |||
| 51 | 2 | /** |
|
| 52 | * @param string $metadata |
||
| 53 | * |
||
| 54 | * @throws \Exception |
||
| 55 | 2 | */ |
|
| 56 | public function setMetadata(string $metadata): void |
||
| 57 | 2 | { |
|
| 58 | 2 | $this->isValidString($metadata, 1000); |
|
| 59 | |||
| 60 | $this->metadata = $metadata; |
||
| 61 | 2 | } |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @return array |
||
| 65 | */ |
||
| 66 | public function toArray(): array |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @return array |
||
| 81 | */ |
||
| 82 | public function jsonSerialize(): array |
||
| 85 | } |
||
| 86 | } |
||
| 87 |