Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
entitybase.php
1<?php
10
11abstract class EntityBase
13{
14 protected $id;
15 protected $model;
16
17 public function __construct(int $id)
18 {
19 $this->id = $id;
20 $this->loadModel();
21 }
22
23 public function getId(): int
24 {
25 return $this->id;
26 }
27
28 abstract public function getType(): string;
29 abstract public function getName(): string;
30 abstract public function getUrl(): string;
31 abstract public function getAvatar(int $width = 58, int $height = 58): ?string;
32
33 public function getMetaData(): array
34 {
35 return [
36 'type' => $this->getType(),
37 'id' => $this->getId(),
38 'name' => $this->getName(),
39 'url' => $this->getUrl(),
40 'avatar' => $this->getAvatar()
41 ];
42 }
43
44 abstract protected function loadModel();
45}
getAvatar(int $width=58, int $height=58)