1 | <?php |
||
23 | class ItemApiController extends ApiController { |
||
24 | |||
25 | use JSONHttpError; |
||
26 | |||
27 | private $itemService; |
||
28 | private $userId; |
||
29 | private $serializer; |
||
30 | |||
31 | public function __construct($AppName, |
||
40 | |||
41 | |||
42 | /** |
||
43 | * @NoAdminRequired |
||
44 | * @NoCSRFRequired |
||
45 | * @CORS |
||
46 | * |
||
47 | * @param int $type |
||
48 | * @param int $id |
||
49 | * @param bool $getRead |
||
50 | * @param int $batchSize |
||
51 | * @param int $offset |
||
52 | * @param bool $oldestFirst |
||
53 | * @return array|mixed |
||
54 | */ |
||
55 | public function index($type=3, $id=0, $getRead=true, $batchSize=-1, |
||
64 | |||
65 | |||
66 | /** |
||
67 | * @NoAdminRequired |
||
68 | * @NoCSRFRequired |
||
69 | * @CORS |
||
70 | * |
||
71 | * @param int $type |
||
72 | * @param int $id |
||
73 | * @param int $lastModified |
||
74 | * @return array|mixed |
||
75 | */ |
||
76 | public function updated($type=3, $id=0, $lastModified=0) { |
||
82 | |||
83 | |||
84 | private function setRead($isRead, $itemId) { |
||
93 | |||
94 | |||
95 | /** |
||
96 | * @NoAdminRequired |
||
97 | * @NoCSRFRequired |
||
98 | * @CORS |
||
99 | * |
||
100 | * @param int $itemId |
||
101 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
102 | */ |
||
103 | public function read($itemId) { |
||
106 | |||
107 | |||
108 | /** |
||
109 | * @NoAdminRequired |
||
110 | * @NoCSRFRequired |
||
111 | * @CORS |
||
112 | * |
||
113 | * @param int $itemId |
||
114 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
115 | */ |
||
116 | public function unread($itemId) { |
||
119 | |||
120 | |||
121 | private function setStarred($isStarred, $feedId, $guidHash) { |
||
132 | |||
133 | |||
134 | /** |
||
135 | * @NoAdminRequired |
||
136 | * @NoCSRFRequired |
||
137 | * @CORS |
||
138 | * |
||
139 | * @param int $feedId |
||
140 | * @param string $guidHash |
||
141 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
142 | */ |
||
143 | public function star($feedId, $guidHash) { |
||
146 | |||
147 | |||
148 | /** |
||
149 | * @NoAdminRequired |
||
150 | * @NoCSRFRequired |
||
151 | * @CORS |
||
152 | * |
||
153 | * @param int $feedId |
||
154 | * @param string $guidHash |
||
155 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
156 | */ |
||
157 | public function unstar($feedId, $guidHash) { |
||
160 | |||
161 | |||
162 | /** |
||
163 | * @NoAdminRequired |
||
164 | * @NoCSRFRequired |
||
165 | * @CORS |
||
166 | * |
||
167 | * @param int $newestItemId |
||
168 | */ |
||
169 | public function readAll($newestItemId) { |
||
172 | |||
173 | |||
174 | private function setMultipleRead($isRead, $items) { |
||
183 | |||
184 | |||
185 | /** |
||
186 | * @NoAdminRequired |
||
187 | * @NoCSRFRequired |
||
188 | * @CORS |
||
189 | * |
||
190 | * @param int[] item ids |
||
191 | */ |
||
192 | public function readMultiple($items) { |
||
195 | |||
196 | |||
197 | /** |
||
198 | * @NoAdminRequired |
||
199 | * @NoCSRFRequired |
||
200 | * @CORS |
||
201 | * |
||
202 | * @param int[] item ids |
||
203 | */ |
||
204 | public function unreadMultiple($items) { |
||
207 | |||
208 | |||
209 | private function setMultipleStarred($isStarred, $items) { |
||
219 | |||
220 | |||
221 | /** |
||
222 | * @NoAdminRequired |
||
223 | * @NoCSRFRequired |
||
224 | * @CORS |
||
225 | * |
||
226 | * @param int[] item ids |
||
227 | */ |
||
228 | public function starMultiple($items) { |
||
231 | |||
232 | |||
233 | /** |
||
234 | * @NoAdminRequired |
||
235 | * @NoCSRFRequired |
||
236 | * @CORS |
||
237 | * |
||
238 | * @param int[] item ids |
||
239 | */ |
||
240 | public function unstarMultiple($items) { |
||
243 | |||
244 | |||
245 | } |
||
246 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: