@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | protected static function actionToBreadcrumbClass($action) |
| 18 | 18 | { |
| 19 | 19 | $arr = explode('/', Inflector::camel2id($action->controller->getUniqueId())); |
| 20 | - $arr[\count($arr) - 1] = Inflector::camelize(ucfirst($arr[\count($arr) - 1])); |
|
| 21 | - return static::$crumbsNamespace . '\\' . implode('\\', $arr) . 'Crumbs'; |
|
| 20 | + $arr[ \count($arr) - 1 ] = Inflector::camelize(ucfirst($arr[ \count($arr) - 1 ])); |
|
| 21 | + return static::$crumbsNamespace.'\\'.implode('\\', $arr).'Crumbs'; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected static function actionToBreadcrumbMethod($action) |
| 25 | 25 | { |
| 26 | - return 'crumb' . Inflector::camelize($action->id); |
|
| 26 | + return 'crumb'.Inflector::camelize($action->id); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | if (class_exists($class) && method_exists($class, $method)) { |
| 40 | 40 | $reflectionMethod = new \ReflectionMethod($class, $method); |
| 41 | - $data = []; |
|
| 41 | + $data = [ ]; |
|
| 42 | 42 | foreach ($reflectionMethod->getParameters() as $p) { |
| 43 | - $data[] = $params[$p->getName()] ?? null; |
|
| 43 | + $data[ ] = $params[ $p->getName() ] ?? null; |
|
| 44 | 44 | } |
| 45 | - return array_filter(\call_user_func_array([$class, $method], $data)); |
|
| 45 | + return array_filter(\call_user_func_array([ $class, $method ], $data)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return []; |
|
| 48 | + return [ ]; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | $model = $this->controller->findModel($id, $this->controller->viewClass); |
| 26 | 26 | |
| 27 | 27 | if ($this->updateIfPost && Yii::$app->request->isPost) { |
| 28 | - return $this->controller->runAction($this->updateAction, [$this->primaryKeyParam => $id]); |
|
| 28 | + return $this->controller->runAction($this->updateAction, [ $this->primaryKeyParam => $id ]); |
|
| 29 | 29 | } |
| 30 | - return $this->controller->render($this->view, ['model' => $model]); |
|
| 30 | + return $this->controller->render($this->view, [ 'model' => $model ]); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -44,6 +44,6 @@ |
||
| 44 | 44 | } |
| 45 | 45 | Yii::$app->session->setFlash('error', Html::errorSummary($model)); |
| 46 | 46 | } |
| 47 | - return $this->controller->render($this->view, ['model' => $model]); |
|
| 47 | + return $this->controller->render($this->view, [ 'model' => $model ]); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $this->controller->indexCondition($query); |
| 31 | 31 | $this->controller->applySearch($query, $dataProvider, $searchModel); |
| 32 | 32 | |
| 33 | - $params = $this->controller->indexParams(['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); |
|
| 33 | + $params = $this->controller->indexParams([ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider ]); |
|
| 34 | 34 | return $this->controller->render($this->view, $params); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -44,6 +44,6 @@ |
||
| 44 | 44 | } |
| 45 | 45 | Yii::$app->session->setFlash('error', Html::errorSummary($model)); |
| 46 | 46 | } |
| 47 | - return $this->controller->render($this->view, ['model' => $model]); |
|
| 47 | + return $this->controller->render($this->view, [ 'model' => $model ]); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @var ActiveRecord $class |
| 67 | 67 | */ |
| 68 | 68 | $class = $class ?? $this->modelClass; |
| 69 | - $query = $this->getModelQuery($class)->andWhere(['id' => $id]); |
|
| 69 | + $query = $this->getModelQuery($class)->andWhere([ 'id' => $id ]); |
|
| 70 | 70 | $this->findModelCondition($query); |
| 71 | 71 | if (($model = $query->one()) !== null) { |
| 72 | 72 | return $model; |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | ] |
| 93 | 93 | ], |
| 94 | 94 | ]; |
| 95 | - return new ActiveDataProvider(array_merge(['query' => $query], $options)); |
|
| 95 | + return new ActiveDataProvider(array_merge([ 'query' => $query ], $options)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function render($view, $params = []) |
|
| 98 | + public function render($view, $params = [ ]) |
|
| 99 | 99 | { |
| 100 | 100 | if (\Yii::$app->request->isAjax) { |
| 101 | 101 | return parent::renderAjax($view, $params); |
| 102 | 102 | } |
| 103 | 103 | if ($this->breadcrumbsAppdend) { |
| 104 | 104 | Breadcrumbs::$crumbsNamespace = $this->breadcrumbsNamespace; |
| 105 | - \Yii::$app->view->params[$this->breadcrumbsParam] = Breadcrumbs::formCrumbs($this->action, $params); |
|
| 105 | + \Yii::$app->view->params[ $this->breadcrumbsParam ] = Breadcrumbs::formCrumbs($this->action, $params); |
|
| 106 | 106 | } |
| 107 | 107 | return parent::render($view, $params); |
| 108 | 108 | } |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | 'verbs' => [ |
| 117 | 117 | 'class' => VerbFilter::class, |
| 118 | 118 | 'actions' => [ |
| 119 | - 'delete' => ['POST'], |
|
| 120 | - 'delete-batch' => ['POST'] |
|
| 119 | + 'delete' => [ 'POST' ], |
|
| 120 | + 'delete-batch' => [ 'POST' ] |
|
| 121 | 121 | ], |
| 122 | 122 | ], |
| 123 | 123 | ]); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function createRedirect($model) |
| 182 | 182 | { |
| 183 | - return ['index']; |
|
| 183 | + return [ 'index' ]; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function updateRedirect($model) |
| 191 | 191 | { |
| 192 | - return ['index']; |
|
| 192 | + return [ 'index' ]; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function deleteRedirect($model) |
| 200 | 200 | { |
| 201 | - return ['index']; |
|
| 201 | + return [ 'index' ]; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function deleteBatchRedirect() |
| 209 | 209 | { |
| 210 | - return ['index']; |
|
| 210 | + return [ 'index' ]; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | { |
| 17 | 17 | public function run(array $ids) |
| 18 | 18 | { |
| 19 | - $errors = []; |
|
| 19 | + $errors = [ ]; |
|
| 20 | 20 | foreach ($ids as $id) { |
| 21 | - $this->controller->runAction('delete', ['id' => $id]); |
|
| 21 | + $this->controller->runAction('delete', [ 'id' => $id ]); |
|
| 22 | 22 | if (Yii::$app->session->hasFlash('error')) { |
| 23 | - $errors[] = Yii::$app->session->getFlash('error', null, true); |
|
| 23 | + $errors[ ] = Yii::$app->session->getFlash('error', null, true); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | if (!empty($errors)) { |