1 | <?php |
||
16 | class Admin extends App implements RequestHandlerInterface |
||
17 | { |
||
18 | private $entities = []; |
||
19 | |||
20 | public $title = 'Folk'; |
||
21 | public $description = 'Universal CMS'; |
||
22 | |||
23 | public function __construct($path, UriInterface $uri) |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | * |
||
36 | * @return ResponseInterface |
||
37 | */ |
||
38 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
44 | |||
45 | public function getRoute(string $name, array $data = [], array $query = null): string |
||
49 | |||
50 | /** |
||
51 | * Set the admin entities. |
||
52 | * |
||
53 | * @param array $entities |
||
54 | */ |
||
55 | public function setEntities(array $entities) |
||
65 | |||
66 | /** |
||
67 | * Add a new entity. |
||
68 | * |
||
69 | * @param EntityInterface $entity |
||
70 | * @param string|null $id |
||
71 | */ |
||
72 | public function addEntity(EntityInterface $entity, $id = null) |
||
82 | |||
83 | /** |
||
84 | * Return whether an entity exists. |
||
85 | * |
||
86 | * @param string $name |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | public function hasEntity(string $name): bool |
||
94 | |||
95 | /** |
||
96 | * Return the entity id. |
||
97 | * |
||
98 | * @param string $name |
||
99 | * |
||
100 | * @return mixed|null |
||
101 | */ |
||
102 | public function getEntityId(string $name) |
||
108 | |||
109 | /** |
||
110 | * Return an entity. |
||
111 | * |
||
112 | * @param string $name |
||
113 | * |
||
114 | * @throw NotFoundException |
||
115 | * |
||
116 | * @return EntityInterface |
||
117 | */ |
||
118 | public function getEntity(string $name): EntityInterface |
||
126 | |||
127 | /** |
||
128 | * Return all entities. |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function getAllEntities(): array |
||
136 | } |
||
137 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: