| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | * @param array $options | 
| 34 | 34 | * @return \Cake\ORM\Query | 
| 35 | 35 | */ | 
| 36 | - public function getTreeList(array $options = []) | |
| 36 | + public function getTreeList(array $options = [ ]) | |
| 37 | 37 |      { | 
| 38 | 38 | $options = Hash::merge([ | 
| 39 | 39 | 'lft' => 'ASC', | 
| @@ -16,8 +16,8 @@ | ||
| 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 | }); | 
| @@ -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 | */ | 
| @@ -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.')); | 
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 | 'provider' => 'table', | 
| 75 | 75 | ]) | 
| 76 | 76 |              ->add('login', 'length', [ | 
| 77 | - 'rule' => ['minLength', MIN_LENGTH_LOGIN], | |
| 77 | + 'rule' => [ 'minLength', MIN_LENGTH_LOGIN ], | |
| 78 | 78 |                  'message' => __d('community', 'The minimum login length must be {0} characters', MIN_LENGTH_LOGIN) | 
| 79 | 79 | ]); | 
| 80 | 80 | |
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 | 'provider' => 'table', | 
| 88 | 88 | ]) | 
| 89 | 89 |              ->add('slug', 'length', [ | 
| 90 | - 'rule' => ['minLength', MIN_LENGTH_LOGIN], | |
| 90 | + 'rule' => [ 'minLength', MIN_LENGTH_LOGIN ], | |
| 91 | 91 |                  'message' => __d('community', 'The minimum alias length must be {0} characters', MIN_LENGTH_LOGIN) | 
| 92 | 92 | ]); | 
| 93 | 93 | |
| @@ -111,14 +111,14 @@ discard block | ||
| 111 | 111 | $validator | 
| 112 | 112 |              ->notEmpty('password', __d('community', 'Please, enter you password.')) | 
| 113 | 113 |              ->add('password', 'minLength', [ | 
| 114 | - 'rule' => ['minLength', MIN_LENGTH_PASS], | |
| 114 | + 'rule' => [ 'minLength', MIN_LENGTH_PASS ], | |
| 115 | 115 |                  'message' => __d('community', 'The minimum password length is {0}', MIN_LENGTH_PASS), | 
| 116 | 116 | ]); | 
| 117 | 117 | |
| 118 | 118 | $validator | 
| 119 | 119 |              ->notEmpty('password_confirm', __d('community', 'Please, confirm you password.')) | 
| 120 | 120 |              ->add('password_confirm', 'no-misspelling', [ | 
| 121 | - 'rule' => ['compareWith', 'password'], | |
| 121 | + 'rule' => [ 'compareWith', 'password' ], | |
| 122 | 122 |                  'message' => __d('community', 'Passwords are not equal'), | 
| 123 | 123 | ]); | 
| 124 | 124 | |
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 |                      $result->get('login') | 
| 64 | 64 | ))); | 
| 65 | 65 | |
| 66 | - return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); | |
| 66 | + return $this->App->redirect([ 'apply' => [ 'action' => 'edit', $result->id ] ]); | |
| 67 | 67 |              } else { | 
| 68 | 68 |                  $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); | 
| 69 | 69 | } | 
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | $user = $this->Users->get($id); | 
| 93 | 93 | $groups = $this->Users->Groups->getTreeList(); | 
| 94 | 94 | |
| 95 | -        if ($this->request->is(['patch', 'post', 'put'])) { | |
| 95 | +        if ($this->request->is([ 'patch', 'post', 'put' ])) { | |
| 96 | 96 | $group = $this->Users->patchEntity($user, $this->request->getData()); | 
| 97 | 97 |              if ($result = $this->Users->save($group)) { | 
| 98 | 98 |                  $this->Flash->success(__d('community', 'The user {0} has been saved.', sprintf( | 
| @@ -100,7 +100,7 @@ discard block | ||
| 100 | 100 |                      $result->get('login') | 
| 101 | 101 | ))); | 
| 102 | 102 | return $this->App->redirect([ | 
| 103 | - 'apply' => ['action' => 'edit', $result->id] | |
| 103 | + 'apply' => [ 'action' => 'edit', $result->id ] | |
| 104 | 104 | ]); | 
| 105 | 105 |              } else { | 
| 106 | 106 |                  $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); | 
| @@ -143,7 +143,7 @@ discard block | ||
| 143 | 143 | public function initialize() | 
| 144 | 144 |      { | 
| 145 | 145 | parent::initialize(); | 
| 146 | -        $this->Security->setConfig('unlockedFields', ['password', 'password_confirm']); | |
| 146 | +        $this->Security->setConfig('unlockedFields', [ 'password', 'password_confirm' ]); | |
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 | /** |