1 | <?php |
||
20 | trait Renderable |
||
21 | { |
||
22 | /** @var string|callable Block view file or callback */ |
||
23 | protected $indexView; |
||
24 | |||
25 | /** @var string|callable Item view file or callback */ |
||
26 | protected $itemView; |
||
27 | |||
28 | /** @var string|callable Empty view file or callback */ |
||
29 | protected $emptyView; |
||
30 | |||
31 | /** @var ViewInterface View render object */ |
||
32 | protected $renderer; |
||
33 | |||
34 | /** @var int Count of entities on one page */ |
||
35 | protected $pageSize; |
||
36 | |||
37 | /** @var int Current page number */ |
||
38 | protected $pageNumber; |
||
39 | |||
40 | /** |
||
41 | * Set pagination for SamsonCMS query. |
||
42 | * |
||
43 | * @param int $pageNumber Result page number |
||
44 | * @param int|null $pageSize Results page size |
||
45 | * |
||
46 | * @return $this Chaining |
||
47 | */ |
||
48 | public function pager($pageNumber, $pageSize = null) |
||
55 | |||
56 | /** |
||
57 | * Set index view path. |
||
58 | * |
||
59 | * @param string|callable|View $indexView Index view path or callback |
||
60 | * |
||
61 | * @return $this Chaining |
||
62 | */ |
||
63 | public function indexView($indexView) |
||
68 | |||
69 | /** |
||
70 | * Set item view path. |
||
71 | * |
||
72 | * @param string|callable|View $itemView Item view path or callback |
||
73 | * |
||
74 | * @return $this Chaining |
||
75 | */ |
||
76 | public function itemView($itemView) |
||
82 | |||
83 | /** |
||
84 | * Set empty view path. |
||
85 | * |
||
86 | * @param string|callable|View $emptyView Empty view path or callback |
||
87 | * |
||
88 | * @return $this Chaining |
||
89 | */ |
||
90 | public function emptyView($emptyView) |
||
95 | |||
96 | /** |
||
97 | * Render Entity collection item. |
||
98 | * |
||
99 | * @param mixed $item SamsonCMS entity for rendering |
||
100 | * |
||
101 | * @return string Rendered HTML |
||
102 | */ |
||
103 | public function renderItem($item) |
||
115 | |||
116 | /** |
||
117 | * Render empty collection item. |
||
118 | * |
||
119 | * @return string Rendered HTML |
||
120 | */ |
||
121 | public function renderEmpty() |
||
130 | |||
131 | /** |
||
132 | * Render Entity collection index. |
||
133 | * |
||
134 | * @param string $items Collection of rendered items |
||
135 | * |
||
136 | * @return string Rendered HTML |
||
137 | */ |
||
138 | public function renderIndex($items) |
||
149 | |||
150 | /** @return string Rendered fields table */ |
||
151 | public function __toString() |
||
155 | |||
156 | /** @return string Rendered HTML for fields table */ |
||
157 | public function output() |
||
181 | |||
182 | /** |
||
183 | * Collection items renderer. |
||
184 | * |
||
185 | * @param mixed $collection Items collection for rendering |
||
186 | * @return string Rendered items |
||
187 | */ |
||
188 | protected function renderer($collection) |
||
199 | |||
200 | /** |
||
201 | * Generic view renderer. |
||
202 | * |
||
203 | * @param mixed $item |
||
204 | * @param Entity[] $collection |
||
205 | * @param string $variableName |
||
206 | * @param string $methodName |
||
207 | * |
||
208 | * @return mixed Rendered view |
||
209 | */ |
||
210 | protected function innerRender($item, $collection, $variableName, $methodName) |
||
216 | } |
||
217 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.