@@ -87,29 +87,37 @@ discard block |
||
87 | 87 | { |
88 | 88 | $icon = IconHelper::FILE; |
89 | 89 | |
90 | - if ($this->content_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') |
|
91 | - $icon = IconHelper::FILE_WORD; |
|
90 | + if ($this->content_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { |
|
91 | + $icon = IconHelper::FILE_WORD; |
|
92 | + } |
|
92 | 93 | |
93 | - if ($this->content_type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') |
|
94 | - $icon = IconHelper::FILE_EXCEL; |
|
94 | + if ($this->content_type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { |
|
95 | + $icon = IconHelper::FILE_EXCEL; |
|
96 | + } |
|
95 | 97 | |
96 | - if ($this->content_type == 'application/vnd.openxmlformats-officedocument.presentationml.presentation') |
|
97 | - $icon = IconHelper::FILE_POWERPOINT; |
|
98 | + if ($this->content_type == 'application/vnd.openxmlformats-officedocument.presentationml.presentation') { |
|
99 | + $icon = IconHelper::FILE_POWERPOINT; |
|
100 | + } |
|
98 | 101 | |
99 | - if ($this->content_type == 'application/x-zip-compressed') |
|
100 | - $icon = IconHelper::FILE_ARCHIVE; |
|
102 | + if ($this->content_type == 'application/x-zip-compressed') { |
|
103 | + $icon = IconHelper::FILE_ARCHIVE; |
|
104 | + } |
|
101 | 105 | |
102 | - if ($this->content_type == 'application/octet-stream') |
|
103 | - $icon = IconHelper::FILE_ARCHIVE; |
|
106 | + if ($this->content_type == 'application/octet-stream') { |
|
107 | + $icon = IconHelper::FILE_ARCHIVE; |
|
108 | + } |
|
104 | 109 | |
105 | - if (preg_match('/audio/', $this->content_type)) |
|
106 | - $icon = IconHelper::FILE_AUDIO; |
|
110 | + if (preg_match('/audio/', $this->content_type)) { |
|
111 | + $icon = IconHelper::FILE_AUDIO; |
|
112 | + } |
|
107 | 113 | |
108 | - if (preg_match('/pdf/', $this->content_type)) |
|
109 | - $icon = IconHelper::FILE_PDF; |
|
114 | + if (preg_match('/pdf/', $this->content_type)) { |
|
115 | + $icon = IconHelper::FILE_PDF; |
|
116 | + } |
|
110 | 117 | |
111 | - if ($this->type == FileType::VIDEO) |
|
112 | - $icon = IconHelper::FILE_VIDEO; |
|
118 | + if ($this->type == FileType::VIDEO) { |
|
119 | + $icon = IconHelper::FILE_VIDEO; |
|
120 | + } |
|
113 | 121 | |
114 | 122 | return $icon; |
115 | 123 | } |
@@ -233,8 +241,9 @@ discard block |
||
233 | 241 | |
234 | 242 | public function getRootPreviewPath() |
235 | 243 | { |
236 | - if ($this->isSvg()) |
|
237 | - return $this->getRootPath(); |
|
244 | + if ($this->isSvg()) { |
|
245 | + return $this->getRootPath(); |
|
246 | + } |
|
238 | 247 | |
239 | 248 | return Yii::$app->getModule('files')->storageFullPath . DIRECTORY_SEPARATOR . $this->filename . '.jpg'; |
240 | 249 | } |
@@ -257,8 +266,9 @@ discard block |
||
257 | 266 | |
258 | 267 | public function getHref() |
259 | 268 | { |
260 | - if (Yii::$app->getModule('files')->hostStatic) |
|
261 | - return Yii::$app->getModule('files')->hostStatic . $this->filename; |
|
269 | + if (Yii::$app->getModule('files')->hostStatic) { |
|
270 | + return Yii::$app->getModule('files')->hostStatic . $this->filename; |
|
271 | + } |
|
262 | 272 | return Url::to(['/files/default/get', 'hash' => $this->hash]); |
263 | 273 | } |
264 | 274 | |
@@ -357,14 +367,17 @@ discard block |
||
357 | 367 | */ |
358 | 368 | public function getPreviewWebPath($width = 0, $height = 0, $webp = false) |
359 | 369 | { |
360 | - if (!file_exists($this->getRootPath())) |
|
361 | - return null; |
|
370 | + if (!file_exists($this->getRootPath())) { |
|
371 | + return null; |
|
372 | + } |
|
362 | 373 | |
363 | - if ($this->type != FileType::IMAGE) |
|
364 | - throw new \ErrorException('Requiested file is not an image and its implsible to resize it.'); |
|
374 | + if ($this->type != FileType::IMAGE) { |
|
375 | + throw new \ErrorException('Requiested file is not an image and its implsible to resize it.'); |
|
376 | + } |
|
365 | 377 | |
366 | - if (Yii::$app->getModule('files')->hostStatic) |
|
367 | - return Yii::$app->getModule('files')->hostStatic . $this->makeNameWithSize($this->filename, $width, $height, $webp = false); |
|
378 | + if (Yii::$app->getModule('files')->hostStatic) { |
|
379 | + return Yii::$app->getModule('files')->hostStatic . $this->makeNameWithSize($this->filename, $width, $height, $webp = false); |
|
380 | + } |
|
368 | 381 | |
369 | 382 | return Url::toRoute(['/files/default/image', 'hash' => $this->hash, 'width' => $width, 'height' => $height, 'webp' => $webp]); |
370 | 383 | } |
@@ -381,8 +394,9 @@ discard block |
||
381 | 394 | { |
382 | 395 | $extension = pathinfo($this->rootPath, PATHINFO_EXTENSION); |
383 | 396 | $rootPath = str_replace(".{$extension}", '', $name) . "_w" . $width . "h" . $height . ".{$extension}"; |
384 | - if ($webp) |
|
385 | - $rootPath = str_replace($extension, 'webp', $rootPath); |
|
397 | + if ($webp) { |
|
398 | + $rootPath = str_replace($extension, 'webp', $rootPath); |
|
399 | + } |
|
386 | 400 | return $rootPath; |
387 | 401 | } |
388 | 402 | |
@@ -397,8 +411,9 @@ discard block |
||
397 | 411 | */ |
398 | 412 | public function getPreviewRootPath($width = 0, $height = 0, $webp = false) |
399 | 413 | { |
400 | - if ($this->type != FileType::IMAGE) |
|
401 | - throw new \ErrorException('Requiested file is not an image and its implsible to resize it.'); |
|
414 | + if ($this->type != FileType::IMAGE) { |
|
415 | + throw new \ErrorException('Requiested file is not an image and its implsible to resize it.'); |
|
416 | + } |
|
402 | 417 | return $this->makeNameWithSize($this->rootPath, $width, $height, $webp); |
403 | 418 | } |
404 | 419 |
@@ -66,8 +66,10 @@ discard block |
||
66 | 66 | ] |
67 | 67 | )->execute(); |
68 | 68 | |
69 | - if ($ids) foreach ($ids as $id) { |
|
69 | + if ($ids) { |
|
70 | + foreach ($ids as $id) { |
|
70 | 71 | $file = File::findOne($id); |
72 | + } |
|
71 | 73 | if ($file) { |
72 | 74 | $file->object_id = $this->owner->id; |
73 | 75 | $file->ordering = $order++; |
@@ -101,8 +103,9 @@ discard block |
||
101 | 103 | in_array($this->owner->scenario, $params['requiredOn']) && |
102 | 104 | !in_array($this->owner->scenario, $params['requiredExcept']) && |
103 | 105 | !isset($this->_values[$attributeIds][1]) |
104 | - ) |
|
105 | - $this->owner->addError($attributeName, $params['requiredMessage']); |
|
106 | + ) { |
|
107 | + $this->owner->addError($attributeName, $params['requiredMessage']); |
|
108 | + } |
|
106 | 109 | } |
107 | 110 | } |
108 | 111 | |
@@ -119,8 +122,8 @@ discard block |
||
119 | 122 | $validators = $owner->validators; |
120 | 123 | |
121 | 124 | // Пробегаемся по валидаторам и вычисляем, какие из них касаются наших файл-полей |
122 | - if ($validators) |
|
123 | - foreach ($validators as $key => $validator) { |
|
125 | + if ($validators) { |
|
126 | + foreach ($validators as $key => $validator) { |
|
124 | 127 | |
125 | 128 | // Сначала пробегаемся по файловым валидаторам |
126 | 129 | if ($validator::className() == 'yii\validators\FileValidator' || $validator::className() == 'floor12\files\components\ReformatValidator') { |
@@ -128,6 +131,7 @@ discard block |
||
128 | 131 | |
129 | 132 | if (is_string($params)) { |
130 | 133 | $field = $params; |
134 | + } |
|
131 | 135 | $params = []; |
132 | 136 | } |
133 | 137 | |
@@ -163,8 +167,10 @@ discard block |
||
163 | 167 | } |
164 | 168 | |
165 | 169 | // Добавляем дефолтный валидатор для прилетающих айдишников |
166 | - if ($this->attributes) foreach ($this->attributes as $fieldName => $fieldParams) { |
|
170 | + if ($this->attributes) { |
|
171 | + foreach ($this->attributes as $fieldName => $fieldParams) { |
|
167 | 172 | $validator = Validator::createValidator('safe', $owner, ["{$fieldName}_ids"]); |
173 | + } |
|
168 | 174 | $validators->append($validator); |
169 | 175 | } |
170 | 176 | } |
@@ -185,8 +191,9 @@ discard block |
||
185 | 191 | */ |
186 | 192 | public function canSetProperty($name, $checkVars = true) |
187 | 193 | { |
188 | - if (array_key_exists($this->getRealAttributeName($name), $this->attributes)) |
|
189 | - return true; |
|
194 | + if (array_key_exists($this->getRealAttributeName($name), $this->attributes)) { |
|
195 | + return true; |
|
196 | + } |
|
190 | 197 | |
191 | 198 | return parent::canSetProperty($name, $checkVars = true); |
192 | 199 | } |
@@ -211,8 +218,8 @@ discard block |
||
211 | 218 | isset($this->attributes[$att_name]['validator']) && |
212 | 219 | isset($this->attributes[$att_name]['validator']['yii\validators\FileValidator']) && |
213 | 220 | $this->attributes[$att_name]['validator']['yii\validators\FileValidator']->maxFiles > 1 |
214 | - ) |
|
215 | - return File::find() |
|
221 | + ) { |
|
222 | + return File::find() |
|
216 | 223 | ->where( |
217 | 224 | [ |
218 | 225 | 'object_id' => $this->owner->id, |
@@ -221,7 +228,8 @@ discard block |
||
221 | 228 | ]) |
222 | 229 | ->orderBy('ordering ASC') |
223 | 230 | ->all(); |
224 | - else return File::find() |
|
231 | + } else { |
|
232 | + return File::find() |
|
225 | 233 | ->where( |
226 | 234 | [ |
227 | 235 | 'object_id' => $this->owner->id, |
@@ -230,6 +238,7 @@ discard block |
||
230 | 238 | ]) |
231 | 239 | ->orderBy('ordering ASC') |
232 | 240 | ->one(); |
241 | + } |
|
233 | 242 | } |
234 | 243 | } |
235 | 244 | |
@@ -242,8 +251,9 @@ discard block |
||
242 | 251 | { |
243 | 252 | $attribute = $this->getRealAttributeName($name); |
244 | 253 | |
245 | - if (array_key_exists($attribute, $this->attributes)) |
|
246 | - $this->_values[$attribute] = $value; |
|
254 | + if (array_key_exists($attribute, $this->attributes)) { |
|
255 | + $this->_values[$attribute] = $value; |
|
256 | + } |
|
247 | 257 | } |
248 | 258 | |
249 | 259 |
@@ -118,8 +118,9 @@ |
||
118 | 118 | function rotate($direction) |
119 | 119 | { |
120 | 120 | $degrees = 90; |
121 | - if ($direction == 2) |
|
122 | - $degrees = 270; |
|
121 | + if ($direction == 2) { |
|
122 | + $degrees = 270; |
|
123 | + } |
|
123 | 124 | $this->image = imagerotate($this->image, $degrees, 0); |
124 | 125 | } |
125 | 126 |
@@ -44,11 +44,13 @@ |
||
44 | 44 | |
45 | 45 | $this->getView()->registerJs("yiiDownloadAllLink = '" . Url::toRoute('files/default/zip') . "'", View::POS_BEGIN, 'yiiDownloadAllLink'); |
46 | 46 | |
47 | - if ($this->passFirst && sizeof($this->files) > 0) |
|
48 | - $this->files = array_slice($this->files, 1); |
|
47 | + if ($this->passFirst && sizeof($this->files) > 0) { |
|
48 | + $this->files = array_slice($this->files, 1); |
|
49 | + } |
|
49 | 50 | |
50 | - if (empty($this->files)) |
|
51 | - return null; |
|
51 | + if (empty($this->files)) { |
|
52 | + return null; |
|
53 | + } |
|
52 | 54 | |
53 | 55 | return $this->render('fileListWidget', [ |
54 | 56 | 'files' => $this->files, |
@@ -50,7 +50,8 @@ discard block |
||
50 | 50 | <?= $model->title ?> |
51 | 51 | </div> |
52 | 52 | </a> |
53 | - <?php else: ?> |
|
53 | + <?php else { |
|
54 | + : ?> |
|
54 | 55 | |
55 | 56 | |
56 | 57 | <div data-title="<?= $model->title ?>" |
@@ -78,7 +79,9 @@ discard block |
||
78 | 79 | <?= Yii::t('files', 'View') ?> |
79 | 80 | </a> |
80 | 81 | </li> |
81 | - <?php endif; ?> |
|
82 | + <?php endif; |
|
83 | +} |
|
84 | +?> |
|
82 | 85 | </ul> |
83 | 86 | |
84 | 87 | <?php endif; ?> |
@@ -27,18 +27,21 @@ discard block |
||
27 | 27 | public function __construct(array $data) |
28 | 28 | { |
29 | 29 | |
30 | - if (!isset($data['id'])) |
|
31 | - throw new BadRequestHttpException('ID of file is not set.'); |
|
30 | + if (!isset($data['id'])) { |
|
31 | + throw new BadRequestHttpException('ID of file is not set.'); |
|
32 | + } |
|
32 | 33 | |
33 | - if (!isset($data['title'])) |
|
34 | - throw new BadRequestHttpException('Title of file is not set.'); |
|
34 | + if (!isset($data['title'])) { |
|
35 | + throw new BadRequestHttpException('Title of file is not set.'); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | $this->_title = $data['title']; |
37 | 39 | |
38 | 40 | $this->_file = File::findOne($data['id']); |
39 | 41 | |
40 | - if (!$this->_file) |
|
41 | - throw new NotFoundHttpException('File not found.'); |
|
42 | + if (!$this->_file) { |
|
43 | + throw new NotFoundHttpException('File not found.'); |
|
44 | + } |
|
42 | 45 | |
43 | 46 | } |
44 | 47 | |
@@ -50,8 +53,9 @@ discard block |
||
50 | 53 | { |
51 | 54 | $this->_file->title = $this->_title; |
52 | 55 | |
53 | - if (!$this->_file->save()) |
|
54 | - throw new BadRequestHttpException('Unable to save file.'); |
|
56 | + if (!$this->_file->save()) { |
|
57 | + throw new BadRequestHttpException('Unable to save file.'); |
|
58 | + } |
|
55 | 59 | |
56 | 60 | return $this->_title; |
57 | 61 | } |
@@ -29,17 +29,21 @@ discard block |
||
29 | 29 | |
30 | 30 | $this->model = $model; |
31 | 31 | |
32 | - if (!$filePath || !$className || !$fieldName || !$storagePath) |
|
33 | - throw new ErrorException("Empty params not allowed."); |
|
32 | + if (!$filePath || !$className || !$fieldName || !$storagePath) { |
|
33 | + throw new ErrorException("Empty params not allowed."); |
|
34 | + } |
|
34 | 35 | |
35 | - if (!file_exists($storagePath)) |
|
36 | - throw new ErrorException("File storage not found on disk."); |
|
36 | + if (!file_exists($storagePath)) { |
|
37 | + throw new ErrorException("File storage not found on disk."); |
|
38 | + } |
|
37 | 39 | |
38 | - if (!file_exists($filePath)) |
|
39 | - throw new ErrorException("File not found on disk."); |
|
40 | + if (!file_exists($filePath)) { |
|
41 | + throw new ErrorException("File not found on disk."); |
|
42 | + } |
|
40 | 43 | |
41 | - if (!is_writable($storagePath)) |
|
42 | - throw new ErrorException("File storage is not writable."); |
|
44 | + if (!is_writable($storagePath)) { |
|
45 | + throw new ErrorException("File storage is not writable."); |
|
46 | + } |
|
43 | 47 | $this->filePath = $filePath; |
44 | 48 | $this->fileName = $fileName; |
45 | 49 | $this->fieldName = $fieldName; |
@@ -65,16 +69,19 @@ discard block |
||
65 | 69 | $this->model->field = $this->fieldName; |
66 | 70 | $this->model->class = $this->className; |
67 | 71 | $this->model->filename = $filename; |
68 | - if ($this->model->filename) |
|
69 | - $this->model->title = $this->model->filename; |
|
70 | - else |
|
71 | - $this->model->title = rand(0, 99999); #такой прикол ) |
|
72 | + if ($this->model->filename) { |
|
73 | + $this->model->title = $this->model->filename; |
|
74 | + } else { |
|
75 | + $this->model->title = rand(0, 99999); |
|
76 | + } |
|
77 | + #такой прикол ) |
|
72 | 78 | $this->model->content_type = $this->model->mime_content_type($new_path); |
73 | 79 | $this->model->type = $this->detectType(); |
74 | 80 | $this->model->size = filesize($new_path); |
75 | 81 | $this->model->created = time(); |
76 | - if ($this->model->type == FileType::VIDEO) |
|
77 | - $this->model->video_status = 0; |
|
82 | + if ($this->model->type == FileType::VIDEO) { |
|
83 | + $this->model->video_status = 0; |
|
84 | + } |
|
78 | 85 | |
79 | 86 | if ($this->model->save()) { |
80 | 87 | |
@@ -114,10 +121,12 @@ discard block |
||
114 | 121 | private function detectType() |
115 | 122 | { |
116 | 123 | $contentTypeArray = explode('/', $this->model->content_type); |
117 | - if ($contentTypeArray[0] == 'image') |
|
118 | - return FileType::IMAGE; |
|
119 | - if ($contentTypeArray[0] == 'video') |
|
120 | - return FileType::VIDEO; |
|
124 | + if ($contentTypeArray[0] == 'image') { |
|
125 | + return FileType::IMAGE; |
|
126 | + } |
|
127 | + if ($contentTypeArray[0] == 'video') { |
|
128 | + return FileType::VIDEO; |
|
129 | + } |
|
121 | 130 | return FileType::FILE; |
122 | 131 | } |
123 | 132 | } |
124 | 133 | \ No newline at end of file |
@@ -33,11 +33,13 @@ discard block |
||
33 | 33 | { |
34 | 34 | $this->_file = $file; |
35 | 35 | |
36 | - if ($this->_file->type != FileType::IMAGE) |
|
37 | - throw new ErrorException('This file is not an image.'); |
|
36 | + if ($this->_file->type != FileType::IMAGE) { |
|
37 | + throw new ErrorException('This file is not an image.'); |
|
38 | + } |
|
38 | 39 | |
39 | - if (!file_exists($this->_file->rootPath)) |
|
40 | - throw new ErrorException('File not found on disk'); |
|
40 | + if (!file_exists($this->_file->rootPath)) { |
|
41 | + throw new ErrorException('File not found on disk'); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | $this->_maxHeight = $maxHeight; |
43 | 45 | $this->_maxWidth = $maxWidth; |
@@ -56,8 +58,9 @@ discard block |
||
56 | 58 | |
57 | 59 | if ($image->getWidth() > $this->_maxWidth || $image->getHeight() > $this->_maxHeight) { |
58 | 60 | $image->resizeToWidth($this->_maxWidth); |
59 | - if ($this->_file->content_type == 'image/png') |
|
60 | - $this->_imageType = IMAGETYPE_PNG; |
|
61 | + if ($this->_file->content_type == 'image/png') { |
|
62 | + $this->_imageType = IMAGETYPE_PNG; |
|
63 | + } |
|
61 | 64 | $image->save($this->_file->rootPath, $this->_imageType, $this->_compression); |
62 | 65 | $this->_file->size = filesize($this->_file->rootPath); |
63 | 66 | return $this->_file->save(false, ['size']); |
@@ -34,27 +34,31 @@ discard block |
||
34 | 34 | |
35 | 35 | $this->_onlyUploaded = $onlyUploaded; |
36 | 36 | |
37 | - if (!isset($data['attribute']) || !$data['attribute'] || !isset($data['modelClass']) || !$data['modelClass']) |
|
38 | - throw new BadRequestHttpException("Attribute or class name not set."); |
|
37 | + if (!isset($data['attribute']) || !$data['attribute'] || !isset($data['modelClass']) || !$data['modelClass']) { |
|
38 | + throw new BadRequestHttpException("Attribute or class name not set."); |
|
39 | + } |
|
39 | 40 | |
40 | 41 | // Загружаем полученные данные |
41 | 42 | $this->_instance = $file; |
42 | 43 | $this->_attribute = $data['attribute']; |
43 | 44 | |
44 | - if (!file_exists($this->_instance->tempName)) |
|
45 | - throw new ErrorException("Tmp file not found on disk."); |
|
45 | + if (!file_exists($this->_instance->tempName)) { |
|
46 | + throw new ErrorException("Tmp file not found on disk."); |
|
47 | + } |
|
46 | 48 | |
47 | 49 | // Инициализируем класс владельца файла для валидаций и ставим сценарий |
48 | 50 | $this->_owner = new $data['modelClass']; |
49 | 51 | |
50 | - if (isset($data['scenario'])) |
|
51 | - $this->_owner->setScenario($data['scenario']); |
|
52 | + if (isset($data['scenario'])) { |
|
53 | + $this->_owner->setScenario($data['scenario']); |
|
54 | + } |
|
52 | 55 | |
53 | 56 | |
54 | 57 | if (isset($this->_owner->behaviors['files']->attributes[$this->_attribute]['validator'])) { |
55 | 58 | foreach ($this->_owner->behaviors['files']->attributes[$this->_attribute]['validator'] as $validator) { |
56 | - if (!$validator->validate($this->_instance, $error)) |
|
57 | - throw new BadRequestHttpException($error); |
|
59 | + if (!$validator->validate($this->_instance, $error)) { |
|
60 | + throw new BadRequestHttpException($error); |
|
61 | + } |
|
58 | 62 | } |
59 | 63 | |
60 | 64 | } |
@@ -71,10 +75,12 @@ discard block |
||
71 | 75 | $this->_model->content_type = $this->_instance->type; |
72 | 76 | $this->_model->size = $this->_instance->size; |
73 | 77 | $this->_model->type = $this->detectType(); |
74 | - if ($identity) |
|
75 | - $this->_model->user_id = $identity->id; |
|
76 | - if ($this->_model->type == FileType::VIDEO) |
|
77 | - $this->_model->video_status = 0; |
|
78 | + if ($identity) { |
|
79 | + $this->_model->user_id = $identity->id; |
|
80 | + } |
|
81 | + if ($this->_model->type == FileType::VIDEO) { |
|
82 | + $this->_model->video_status = 0; |
|
83 | + } |
|
78 | 84 | |
79 | 85 | //Генерируем полный новый адрес сохранения файла |
80 | 86 | $this->_fullPath = Yii::$app->getModule('files')->storageFullPath . DIRECTORY_SEPARATOR . $this->_model->filename; |
@@ -89,10 +95,11 @@ discard block |
||
89 | 95 | $path = Yii::$app->getModule('files')->storageFullPath . $this->_model->filename; |
90 | 96 | |
91 | 97 | if ($this->_model->save()) { |
92 | - if (!$this->_onlyUploaded) |
|
93 | - copy($this->_instance->tempName, $this->_fullPath); |
|
94 | - else |
|
95 | - $this->_instance->saveAs($this->_fullPath, false); |
|
98 | + if (!$this->_onlyUploaded) { |
|
99 | + copy($this->_instance->tempName, $this->_fullPath); |
|
100 | + } else { |
|
101 | + $this->_instance->saveAs($this->_fullPath, false); |
|
102 | + } |
|
96 | 103 | } |
97 | 104 | |
98 | 105 | return $this->_model; |
@@ -104,10 +111,12 @@ discard block |
||
104 | 111 | public function detectType() |
105 | 112 | { |
106 | 113 | $contentTypeArray = explode('/', $this->_model->content_type); |
107 | - if ($contentTypeArray[0] == 'image') |
|
108 | - return FileType::IMAGE; |
|
109 | - if ($contentTypeArray[0] == 'video') |
|
110 | - return FileType::VIDEO; |
|
114 | + if ($contentTypeArray[0] == 'image') { |
|
115 | + return FileType::IMAGE; |
|
116 | + } |
|
117 | + if ($contentTypeArray[0] == 'video') { |
|
118 | + return FileType::VIDEO; |
|
119 | + } |
|
111 | 120 | return FileType::FILE; |
112 | 121 | } |
113 | 122 | } |
114 | 123 | \ No newline at end of file |