1 | <?php |
||
27 | class FeedApiController extends ApiController { |
||
28 | |||
29 | use JSONHttpError; |
||
30 | |||
31 | private $itemService; |
||
32 | private $feedService; |
||
33 | private $userId; |
||
34 | private $logger; |
||
35 | private $loggerParams; |
||
36 | private $serializer; |
||
37 | |||
38 | public function __construct($AppName, |
||
53 | |||
54 | |||
55 | /** |
||
56 | * @NoAdminRequired |
||
57 | * @NoCSRFRequired |
||
58 | * @CORS |
||
59 | */ |
||
60 | public function index() { |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @NoAdminRequired |
||
81 | * @NoCSRFRequired |
||
82 | * @CORS |
||
83 | * |
||
84 | * @param string $url |
||
85 | * @param int $folderId |
||
86 | * @return array|mixed|\OCP\AppFramework\Http\JSONResponse |
||
87 | */ |
||
88 | public function create($url, $folderId=0) { |
||
110 | |||
111 | |||
112 | /** |
||
113 | * @NoAdminRequired |
||
114 | * @NoCSRFRequired |
||
115 | * @CORS |
||
116 | * |
||
117 | * @param int $feedId |
||
118 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
119 | */ |
||
120 | public function delete($feedId) { |
||
129 | |||
130 | |||
131 | /** |
||
132 | * @NoAdminRequired |
||
133 | * @NoCSRFRequired |
||
134 | * @CORS |
||
135 | * |
||
136 | * @param int $feedId |
||
137 | * @param int $newestItemId |
||
138 | */ |
||
139 | public function read($feedId, $newestItemId) { |
||
142 | |||
143 | |||
144 | /** |
||
145 | * @NoAdminRequired |
||
146 | * @NoCSRFRequired |
||
147 | * @CORS |
||
148 | * |
||
149 | * @param int $feedId |
||
150 | * @param int $folderId |
||
151 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
152 | */ |
||
153 | public function move($feedId, $folderId) { |
||
164 | |||
165 | |||
166 | /** |
||
167 | * @NoAdminRequired |
||
168 | * @NoCSRFRequired |
||
169 | * @CORS |
||
170 | * |
||
171 | * @param int $feedId |
||
172 | * @param string $feedTitle |
||
173 | * @return array|\OCP\AppFramework\Http\JSONResponse |
||
174 | */ |
||
175 | public function rename($feedId, $feedTitle) { |
||
186 | |||
187 | |||
188 | /** |
||
189 | * @NoCSRFRequired |
||
190 | * @CORS |
||
191 | */ |
||
192 | public function fromAllUsers() { |
||
205 | |||
206 | |||
207 | /** |
||
208 | * @NoCSRFRequired |
||
209 | * |
||
210 | * @param string $userId |
||
211 | * @param int $feedId |
||
212 | */ |
||
213 | public function update($userId, $feedId) { |
||
222 | |||
223 | |||
224 | } |
||
225 |
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: