Passed
Push — master ( 3104d2...d3b8e8 )
by Aleksandr
03:00
created
src/CrudController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     public $breadcrumbsNamespace = 'app\breadcrumbs';
46 46
     public $breadcrumbsParam = 'breadcrumbs';
47 47
 
48
-    protected $params = [];
48
+    protected $params = [ ];
49 49
 
50
-    public $primaryKey = ['id'];
50
+    public $primaryKey = [ 'id' ];
51 51
 
52 52
     const EVENT_BEFORE_CREATE = 'beforeCreate';
53 53
     const EVENT_AFTER_CREATE = 'afterCreate';
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $class = $class ?? $this->modelClass;
82 82
         $query = $this->getModelQuery($class);
83 83
         foreach ($this->primaryKey as $key) {
84
-            $query->andWhere([$key => $id[$key] ?? null]);
84
+            $query->andWhere([ $key => $id[ $key ] ?? null ]);
85 85
         }
86 86
         $query = $this->findModelCondition($query);
87 87
         if (($model = $query->one()) !== null) {
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
                 ]
110 110
             ],
111 111
         ];
112
-        return new ActiveDataProvider(array_merge(['query' => $query], $options));
112
+        return new ActiveDataProvider(array_merge([ 'query' => $query ], $options));
113 113
     }
114 114
 
115
-    public function render($view, $params = [])
115
+    public function render($view, $params = [ ])
116 116
     {
117 117
         if (\Yii::$app->request->isAjax) {
118 118
             return parent::renderAjax($view, $params);
119 119
         }
120 120
         if ($this->breadcrumbsAppdend) {
121 121
             Breadcrumbs::$crumbsNamespace = $this->breadcrumbsNamespace;
122
-            \Yii::$app->view->params[$this->breadcrumbsParam] = Breadcrumbs::formCrumbs($this->action, $params);
122
+            \Yii::$app->view->params[ $this->breadcrumbsParam ] = Breadcrumbs::formCrumbs($this->action, $params);
123 123
         }
124 124
         return parent::render($view, $params);
125 125
     }
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
             'verbs' => [
134 134
                 'class' => VerbFilter::class,
135 135
                 'actions' => [
136
-                    'delete' => ['POST'],
137
-                    'delete-batch' => ['POST']
136
+                    'delete' => [ 'POST' ],
137
+                    'delete-batch' => [ 'POST' ]
138 138
                 ],
139 139
             ],
140 140
         ]);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function createRedirect($model)
199 199
     {
200
-        return ['index'];
200
+        return [ 'index' ];
201 201
     }
202 202
 
203 203
     /**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function updateRedirect($model)
208 208
     {
209
-        return ['index'];
209
+        return [ 'index' ];
210 210
     }
211 211
 
212 212
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function deleteRedirect($model)
217 217
     {
218
-        return ['index'];
218
+        return [ 'index' ];
219 219
     }
220 220
 
221 221
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function deleteBatchRedirect()
226 226
     {
227
-        return ['index'];
227
+        return [ 'index' ];
228 228
     }
229 229
 
230 230
     /**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                 'class' => UpdateAction::class,
238 238
                 'view' => $this->updateView,
239 239
                 'primaryKeyParam' => $this->primaryKey,
240
-                'redirect' => function ($model) {
240
+                'redirect' => function($model) {
241 241
                     return $this->updateRedirect($model);
242 242
                 }
243 243
             ],
@@ -246,19 +246,19 @@  discard block
 block discarded – undo
246 246
                 'view' => $this->indexView,
247 247
                 'modelClass' => $this->modelClass,
248 248
                 'modelSearchClass' => $this->modelSearchClass,
249
-                'query' => function ($class, $action) {
249
+                'query' => function($class, $action) {
250 250
                     return $this->getModelQuery($action->modelClass);
251 251
                 },
252
-                'dataProvider' => function ($query, IndexAction $action) {
252
+                'dataProvider' => function($query, IndexAction $action) {
253 253
                     $searchModel = $action->getSearchModel();
254 254
                     $dataProvider = $this->queryToDataProvider($query);
255 255
                     $this->applySearch($query, $dataProvider, $searchModel);
256 256
                     return $dataProvider;
257 257
                 },
258
-                'condition' => function ($query, IndexAction $action) {
258
+                'condition' => function($query, IndexAction $action) {
259 259
                     $this->indexCondition($query);
260 260
                 },
261
-                'renderParams' => function ($params) {
261
+                'renderParams' => function($params) {
262 262
                     return $this->indexParams($params);
263 263
                 }
264 264
             ],
Please login to merge, or discard this patch.