Passed
Push — master ( 44bd30...0dfe52 )
by Evgenii
04:58
created
src/controllers/DefaultController.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -74,8 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function checkFormToken()
76 76
     {
77
-        if (in_array($this->action->id, $this->actionsToCheck) && FileInputWidget::generateToken() != Yii::$app->request->post('_fileFormToken'))
78
-            throw new BadRequestHttpException('File-form token is wrong or missing.');
77
+        if (in_array($this->action->id, $this->actionsToCheck) && FileInputWidget::generateToken() != Yii::$app->request->post('_fileFormToken')) {
78
+                    throw new BadRequestHttpException('File-form token is wrong or missing.');
79
+        }
79 80
     }
80 81
 
81 82
     /**
@@ -93,8 +94,9 @@  discard block
 block discarded – undo
93 94
             mkdir($path, 0777, true);
94 95
         }
95 96
         $filename = "{$path}/{$md5}.zip";
96
-        if (file_exists($filename))
97
-            @unlink($filename);
97
+        if (file_exists($filename)) {
98
+                    @unlink($filename);
99
+        }
98 100
         if (sizeof($files) && $zip->open($filename, ZipArchive::CREATE)) {
99 101
             foreach ($files as $file) {
100 102
                 $zip->addFile($file->rootPath, $file->title);
@@ -169,8 +171,9 @@  discard block
 block discarded – undo
169 171
 
170 172
         $view = Yii::$app->request->post('mode') == 'single' ? "_single" : "_file";
171 173
 
172
-        if ($ratio)
173
-            $this->getView()->registerJs("initCropper({$model->id}, '{$model->href}', {$ratio}, true);");
174
+        if ($ratio) {
175
+                    $this->getView()->registerJs("initCropper({$model->id}, '{$model->href}', {$ratio}, true);");
176
+        }
174 177
 
175 178
         return $this->renderAjax($view, [
176 179
             'model' => $model,
@@ -197,8 +200,9 @@  discard block
 block discarded – undo
197 200
     {
198 201
         $model = File::findOne(['hash' => $hash]);
199 202
 
200
-        if (!$model)
201
-            throw new NotFoundHttpException("Запрашиваемый файл не найден в базе.");
203
+        if (!$model) {
204
+                    throw new NotFoundHttpException("Запрашиваемый файл не найден в базе.");
205
+        }
202 206
 
203 207
         $response = Yii::$app->response;
204 208
         $response->format = Response::FORMAT_RAW;
@@ -207,8 +211,9 @@  discard block
 block discarded – undo
207 211
         Yii::$app->response->headers->set('Last-Modified', date("c", $model->created));
208 212
         Yii::$app->response->headers->set('Cache-Control', 'public, max-age=' . (60 * 60 * 24 * 15));
209 213
 
210
-        if (!file_exists($model->getRootPreviewPath()))
211
-            throw new NotFoundHttpException('Preview not found.');
214
+        if (!file_exists($model->getRootPreviewPath())) {
215
+                    throw new NotFoundHttpException('Preview not found.');
216
+        }
212 217
 
213 218
         $response->sendFile($model->getRootPreviewPath(), 'preview.jpg');
214 219
 
Please login to merge, or discard this patch.
src/views/default/_single.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             <?= Html::hiddenInput($name ?: ((new ReflectionClass($model->class))->getShortName() . "[{$model->field}_ids][]"), $model->id) ?>
42 42
         </div>
43 43
 
44
-    <?php else: ?>
44
+    <?php else : ?>
45 45
 
46 46
         <div data-title="<?= $model->title ?>"
47 47
              id="yii2-file-object-<?= $model->id ?>"
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
 use yii\helpers\Html;
19 19
 use yii\web\View;
20 20
 
21
-if (is_array($model))
21
+if (is_array($model)) {
22 22
     $model = $model[array_key_first($model)];
23
+}
23 24
 
24 25
 $doc_contents = [
25 26
     'application/msword',
@@ -41,7 +42,8 @@  discard block
 block discarded – undo
41 42
             <?= Html::hiddenInput($name ?: ((new ReflectionClass($model->class))->getShortName() . "[{$model->field}_ids][]"), $model->id) ?>
42 43
         </div>
43 44
 
44
-    <?php else: ?>
45
+    <?php else {
46
+    : ?>
45 47
 
46 48
         <div data-title="<?= $model->title ?>"
47 49
              id="yii2-file-object-<?= $model->id ?>"
@@ -56,7 +58,9 @@  discard block
 block discarded – undo
56 58
             <?php if ($model->type != FileType::IMAGE): ?>
57 59
                 <?= $model->icon ?>
58 60
                 <?= $model->title ?>
59
-            <?php endif; ?>
61
+            <?php endif;
62
+}
63
+?>
60 64
         </div>
61 65
     <?php endif; ?>
62 66
 
Please login to merge, or discard this patch.