| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class PageBlockAuthorDate extends PageBlock |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'pageBlockAuthorDate'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Author. |
||
| 20 | * |
||
| 21 | * @var RichText |
||
| 22 | */ |
||
| 23 | protected RichText $author; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Point in time (Unix timestamp) when the article was published; 0 if unknown. |
||
| 27 | * |
||
| 28 | * @var int |
||
| 29 | */ |
||
| 30 | protected int $publishDate; |
||
| 31 | |||
| 32 | public function __construct(RichText $author, int $publishDate) |
||
| 33 | { |
||
| 34 | parent::__construct(); |
||
| 35 | |||
| 36 | $this->author = $author; |
||
| 37 | $this->publishDate = $publishDate; |
||
| 38 | } |
||
| 39 | |||
| 40 | public static function fromArray(array $array): PageBlockAuthorDate |
||
| 41 | { |
||
| 42 | return new static( |
||
| 43 | TdSchemaRegistry::fromArray($array['author']), |
||
| 44 | $array['publish_date'], |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 48 | public function typeSerialize(): array |
||
| 54 | ]; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function getAuthor(): RichText |
||
| 60 | } |
||
| 61 | |||
| 62 | public function getPublishDate(): int |
||
| 65 | } |
||
| 66 | } |
||
| 67 |