| Total Complexity | 6 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class PushMessageContentGameScore extends PushMessageContent |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'pushMessageContentGameScore'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Game title, empty for pinned message. |
||
| 20 | */ |
||
| 21 | protected string $title; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * New score, 0 for pinned message. |
||
| 25 | */ |
||
| 26 | protected int $score; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * True, if the message is a pinned message with the specified content. |
||
| 30 | */ |
||
| 31 | protected bool $isPinned; |
||
| 32 | |||
| 33 | public function __construct(string $title, int $score, bool $isPinned) |
||
| 34 | { |
||
| 35 | parent::__construct(); |
||
| 36 | |||
| 37 | $this->title = $title; |
||
| 38 | $this->score = $score; |
||
| 39 | $this->isPinned = $isPinned; |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function fromArray(array $array): PushMessageContentGameScore |
||
| 43 | { |
||
| 44 | return new static( |
||
| 45 | $array['title'], |
||
| 46 | $array['score'], |
||
| 47 | $array['is_pinned'], |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function typeSerialize(): array |
||
| 58 | ]; |
||
| 59 | } |
||
| 60 | |||
| 61 | public function getTitle(): string |
||
| 62 | { |
||
| 63 | return $this->title; |
||
| 64 | } |
||
| 65 | |||
| 66 | public function getScore(): int |
||
| 69 | } |
||
| 70 | |||
| 71 | public function getIsPinned(): bool |
||
| 74 | } |
||
| 75 | } |
||
| 76 |