@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if ($result) { |
51 | 51 | $this->Flash->success(__d('community', 'The group has been saved.')); |
52 | 52 | return $this->App->redirect([ |
53 | - 'apply' => ['action' => 'edit', $result->id], |
|
53 | + 'apply' => [ 'action' => 'edit', $result->id ], |
|
54 | 54 | ]); |
55 | 55 | } else { |
56 | 56 | $this->Flash->error(__d('community', 'The group could not be saved. Please, try again.')); |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | public function edit($id) |
87 | 87 | { |
88 | 88 | /** @var Group $group */ |
89 | - $group = $this->Groups->get($id, ['contain' => []]); |
|
90 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
89 | + $group = $this->Groups->get($id, [ 'contain' => [ ] ]); |
|
90 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
91 | 91 | $group = $this->Groups->patchEntity($group, $this->request->getData()); |
92 | 92 | if ($result = $this->Groups->save($group)) { |
93 | 93 | $this->Flash->success(__d('community', 'The group has been updated.')); |
94 | 94 | return $this->App->redirect([ |
95 | - 'apply' => ['action' => 'edit', $result->id] |
|
95 | + 'apply' => [ 'action' => 'edit', $result->id ] |
|
96 | 96 | ]); |
97 | 97 | } else { |
98 | 98 | $this->Flash->error(__d('community', 'The group could not be updated. Please, try again.')); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /** |
38 | 38 | * Edit action. |
39 | 39 | * |
40 | - * @return mixed |
|
40 | + * @return \Cake\Http\Response|null |
|
41 | 41 | * |
42 | 42 | * @throws RolledbackTransactionException |
43 | 43 | * @throws \Aura\Intl\Exception |
@@ -16,9 +16,9 @@ |
||
16 | 16 | use Cake\Routing\Router; |
17 | 17 | use Cake\Routing\RouteBuilder; |
18 | 18 | |
19 | -Router::plugin('Community', ['path' => '/'], function (RouteBuilder $routeBuilder) { |
|
20 | - $routeBuilder->prefix('admin', function (RouteBuilder $routeBuilder) { |
|
21 | - $routeBuilder->connect('/community/:controller/:action/*', []); |
|
19 | +Router::plugin('Community', [ 'path' => '/' ], function(RouteBuilder $routeBuilder) { |
|
20 | + $routeBuilder->prefix('admin', function(RouteBuilder $routeBuilder) { |
|
21 | + $routeBuilder->connect('/community/:controller/:action/*', [ ]); |
|
22 | 22 | }); |
23 | 23 | |
24 | 24 | $routeBuilder->connect('profile/:action/*', [ |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * See https://book.cakephp.org/3.0/ru/orm/behaviors/tree.html |
35 | 35 | * @return \Cake\ORM\Query |
36 | 36 | */ |
37 | - public function getTreeList(array $options = []) |
|
37 | + public function getTreeList(array $options = [ ]) |
|
38 | 38 | { |
39 | 39 | $options = Hash::merge([ |
40 | 40 | 'lft' => 'ASC', |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - public $records = []; |
|
29 | + public $records = [ ]; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Run the seeder. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $result->get('login') |
56 | 56 | ))); |
57 | 57 | |
58 | - return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); |
|
58 | + return $this->App->redirect([ 'apply' => [ 'action' => 'edit', $result->id ] ]); |
|
59 | 59 | } else { |
60 | 60 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
61 | 61 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function changePassword($id = null) |
78 | 78 | { |
79 | - $user = $this->Users->get($id, ['contain' => []]); |
|
79 | + $user = $this->Users->get($id, [ 'contain' => [ ] ]); |
|
80 | 80 | $user->set('password', null); |
81 | 81 | |
82 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
82 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
83 | 83 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
84 | 84 | if ($result = $this->Users->save($user)) { |
85 | 85 | $this->Flash->success(__d('community', 'Password has been updated.')); |
86 | - return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); |
|
86 | + return $this->App->redirect([ 'apply' => [ 'action' => 'edit', $result->id ] ]); |
|
87 | 87 | } else { |
88 | 88 | $this->Flash->error(__d('community', 'Password could not be updated. Please, try again.')); |
89 | 89 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $user = $this->Users->get($id); |
111 | 111 | $groups = $this->Users->Groups->getTreeList(); |
112 | 112 | |
113 | - if ($this->request->is(['patch', 'post', 'put'])) { |
|
113 | + if ($this->request->is([ 'patch', 'post', 'put' ])) { |
|
114 | 114 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
115 | 115 | if ($result = $this->Users->save($user)) { |
116 | 116 | $this->Flash->success(__d('community', 'The user {0} has been saved.', sprintf( |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $result->get('login') |
119 | 119 | ))); |
120 | 120 | return $this->App->redirect([ |
121 | - 'apply' => ['action' => 'edit', $result->id] |
|
121 | + 'apply' => [ 'action' => 'edit', $result->id ] |
|
122 | 122 | ]); |
123 | 123 | } else { |
124 | 124 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | public function initialize() |
159 | 159 | { |
160 | 160 | parent::initialize(); |
161 | - $this->Security->setConfig('unlockedFields', ['password', 'password_confirm']); |
|
161 | + $this->Security->setConfig('unlockedFields', [ 'password', 'password_confirm' ]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - public $records = []; |
|
29 | + public $records = [ ]; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Run the seeder. |
@@ -71,8 +71,8 @@ |
||
71 | 71 | ]; |
72 | 72 | |
73 | 73 | if ($backend) { |
74 | - $url['prefix'] = 'admin'; |
|
75 | - $url[] = $this->id; |
|
74 | + $url[ 'prefix' ] = 'admin'; |
|
75 | + $url[ ] = $this->id; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | return Router::url($url); |
@@ -34,21 +34,21 @@ |
||
34 | 34 | 'Community.UserEventHandler', |
35 | 35 | ], |
36 | 36 | |
37 | - 'Controller.initialize' => function (Controller $controller) { |
|
37 | + 'Controller.initialize' => function(Controller $controller) { |
|
38 | 38 | $controller->loadComponent('Community.Auth'); |
39 | 39 | if ($controller->request->getParam('prefix') === 'admin') { |
40 | 40 | $controller->loadComponent('Community.User'); |
41 | 41 | } |
42 | 42 | }, |
43 | 43 | |
44 | - 'Controller.beforeFilter' => function (Controller $controller) { |
|
44 | + 'Controller.beforeFilter' => function(Controller $controller) { |
|
45 | 45 | $user = new User((array) $controller->Auth->user()); |
46 | 46 | $controller->set('authorized', $user); |
47 | 47 | }, |
48 | 48 | |
49 | - 'View.initialize' => function (AppView $view) { |
|
49 | + 'View.initialize' => function(AppView $view) { |
|
50 | 50 | if ($view->request->getData('plugin') === 'Community') { |
51 | - $view->Html->less(['Community.styles.less'], ['block' => true, 'fullBase' => true, 'force' => true]); |
|
51 | + $view->Html->less([ 'Community.styles.less' ], [ 'block' => true, 'fullBase' => true, 'force' => true ]); |
|
52 | 52 | } |
53 | 53 | }, |
54 | 54 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param array|\ArrayAccess $options The options to use when saving. |
74 | 74 | * @return \Cake\Datasource\EntityInterface|false |
75 | 75 | */ |
76 | - public function save(EntityInterface $entity, $options = []) |
|
76 | + public function save(EntityInterface $entity, $options = [ ]) |
|
77 | 77 | { |
78 | 78 | EventManager::trigger('Model.User.beforeSave', $this, [ |
79 | 79 | 'user' => $entity |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'message' => __d('community', 'User with this login already exists.') |
109 | 109 | ]) |
110 | 110 | ->add('login', 'length', [ |
111 | - 'rule' => ['minLength', MIN_LENGTH_LOGIN], |
|
111 | + 'rule' => [ 'minLength', MIN_LENGTH_LOGIN ], |
|
112 | 112 | 'message' => __d('community', 'The minimum login length must be {0} characters', MIN_LENGTH_LOGIN) |
113 | 113 | ]); |
114 | 114 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'message' => __d('community', 'User with this alias already exists.') |
122 | 122 | ]) |
123 | 123 | ->add('slug', 'length', [ |
124 | - 'rule' => ['minLength', MIN_LENGTH_LOGIN], |
|
124 | + 'rule' => [ 'minLength', MIN_LENGTH_LOGIN ], |
|
125 | 125 | 'message' => __d('community', 'The minimum alias length must be {0} characters', MIN_LENGTH_LOGIN) |
126 | 126 | ]); |
127 | 127 | |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $validator |
146 | 146 | ->notEmpty('password', __d('community', 'Please, enter you password.')) |
147 | 147 | ->add('password', 'minLength', [ |
148 | - 'rule' => ['minLength', MIN_LENGTH_PASS], |
|
148 | + 'rule' => [ 'minLength', MIN_LENGTH_PASS ], |
|
149 | 149 | 'message' => __d('community', 'The minimum password length is {0}', MIN_LENGTH_PASS) |
150 | 150 | ]); |
151 | 151 | |
152 | 152 | $validator |
153 | 153 | ->notEmpty('password_confirm', __d('community', 'Please, confirm you password.')) |
154 | 154 | ->add('password_confirm', 'no-misspelling', [ |
155 | - 'rule' => ['compareWith', 'password'], |
|
155 | + 'rule' => [ 'compareWith', 'password' ], |
|
156 | 156 | 'message' => __d('community', 'Passwords are not equal') |
157 | 157 | ]); |
158 | 158 | |
@@ -169,6 +169,6 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function findAuth(Query $query, array $options) |
171 | 171 | { |
172 | - return $query->where(['Users.status' => 1]); |
|
172 | + return $query->where([ 'Users.status' => 1 ]); |
|
173 | 173 | } |
174 | 174 | } |