1 | <?php |
||
29 | abstract class CommonUploadController extends Controller |
||
30 | { |
||
31 | use ResponseTrait, MediaFilesTrait; |
||
32 | |||
33 | /** |
||
34 | * @var string|array the configuration for creating the serializer that formats the response data. |
||
35 | */ |
||
36 | public $serializer = 'yii\rest\Serializer'; |
||
37 | |||
38 | /** |
||
39 | * @var UploadModelInterface |
||
40 | */ |
||
41 | private $uploadModel; |
||
42 | |||
43 | /** |
||
44 | * @return UploadComponentInterface |
||
45 | */ |
||
46 | abstract protected function getUploadComponent(): UploadComponentInterface; |
||
47 | |||
48 | /** |
||
49 | * Initialize. |
||
50 | */ |
||
51 | public function init() |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function behaviors() |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function afterAction($action, $result) |
||
96 | |||
97 | /** |
||
98 | * @return array |
||
99 | */ |
||
100 | public function verbs() |
||
107 | |||
108 | /** |
||
109 | * Set upload model. |
||
110 | * |
||
111 | * @param UploadModelInterface $model |
||
112 | * |
||
113 | * @return void |
||
114 | */ |
||
115 | public function setUploadModel(UploadModelInterface $model): void |
||
119 | |||
120 | /** |
||
121 | * Returns upload model. |
||
122 | * |
||
123 | * @return UploadModelInterface |
||
124 | */ |
||
125 | public function getUploadModel(): UploadModelInterface |
||
129 | |||
130 | /** |
||
131 | * Send new file to upload it. |
||
132 | * |
||
133 | * @throws BadRequestHttpException |
||
134 | * |
||
135 | * @return array |
||
136 | */ |
||
137 | public function actionSend() |
||
149 | |||
150 | /** |
||
151 | * Update existing file. |
||
152 | * |
||
153 | * @throws BadRequestHttpException |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | public function actionUpdate() |
||
179 | |||
180 | /** |
||
181 | * Delete the media model entry with files. |
||
182 | * |
||
183 | * @throws BadRequestHttpException |
||
184 | * |
||
185 | * @return array |
||
186 | */ |
||
187 | public function actionDelete() |
||
206 | |||
207 | /** |
||
208 | * Provides upload or update file. |
||
209 | * |
||
210 | * @throws InvalidConfigException |
||
211 | * @throws BadRequestHttpException |
||
212 | * |
||
213 | * @param $request |
||
214 | * |
||
215 | * @return array |
||
216 | */ |
||
217 | private function actionSave($request) |
||
245 | |||
246 | /** |
||
247 | * Serializes the specified data. |
||
248 | * The default implementation will create a serializer based on the configuration given by [[serializer]]. |
||
249 | * It then uses the serializer to serialize the given data. |
||
250 | * |
||
251 | * @param mixed $data the data to be serialized |
||
252 | * |
||
253 | * @return mixed the serialized data. |
||
254 | */ |
||
255 | private function serializeData($data) |
||
259 | |||
260 | /** |
||
261 | * Response with uploaded file data. |
||
262 | * |
||
263 | * @return array |
||
264 | */ |
||
265 | private function getUploadResponse(): array |
||
278 | |||
279 | /** |
||
280 | * Returns an intermediate model for working with the main. |
||
281 | * |
||
282 | * @param int|null $id |
||
283 | * |
||
284 | * @throws UnknownMethodException |
||
285 | * @throws NotFoundHttpException |
||
286 | * |
||
287 | * @return Mediafile |
||
288 | */ |
||
289 | private function setMediafileModel(int $id = null): Mediafile |
||
297 | } |
||
298 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..