diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-04-12 11:36:01 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-04-12 12:25:29 +0200 |
commit | 4094ea47712efbe58624ff74daeb1f77c9b0edcf (patch) | |
tree | 3d2c168092d0208e6ba888de969252a54bf0c6c1 /src/Wallabag/CoreBundle/Controller/ConfigController.php | |
parent | 7eccbda99f16dc39ee01a0c81ab88293e9b268fd (diff) | |
download | wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.gz wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.zst wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.zip |
Convert array + phpDoc
Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/ConfigController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 779be268..ccc3e8a1 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -32,7 +32,7 @@ class ConfigController extends Controller | |||
32 | $user = $this->getUser(); | 32 | $user = $this->getUser(); |
33 | 33 | ||
34 | // handle basic config detail (this form is defined as a service) | 34 | // handle basic config detail (this form is defined as a service) |
35 | $configForm = $this->createForm(ConfigType::class, $config, array('action' => $this->generateUrl('config'))); | 35 | $configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]); |
36 | $configForm->handleRequest($request); | 36 | $configForm->handleRequest($request); |
37 | 37 | ||
38 | if ($configForm->isValid()) { | 38 | if ($configForm->isValid()) { |
@@ -52,7 +52,7 @@ class ConfigController extends Controller | |||
52 | } | 52 | } |
53 | 53 | ||
54 | // handle changing password | 54 | // handle changing password |
55 | $pwdForm = $this->createForm(ChangePasswordType::class, null, array('action' => $this->generateUrl('config').'#set4')); | 55 | $pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']); |
56 | $pwdForm->handleRequest($request); | 56 | $pwdForm->handleRequest($request); |
57 | 57 | ||
58 | if ($pwdForm->isValid()) { | 58 | if ($pwdForm->isValid()) { |
@@ -71,10 +71,10 @@ class ConfigController extends Controller | |||
71 | } | 71 | } |
72 | 72 | ||
73 | // handle changing user information | 73 | // handle changing user information |
74 | $userForm = $this->createForm(UserInformationType::class, $user, array( | 74 | $userForm = $this->createForm(UserInformationType::class, $user, [ |
75 | 'validation_groups' => array('Profile'), | 75 | 'validation_groups' => ['Profile'], |
76 | 'action' => $this->generateUrl('config').'#set3', | 76 | 'action' => $this->generateUrl('config').'#set3', |
77 | )); | 77 | ]); |
78 | $userForm->handleRequest($request); | 78 | $userForm->handleRequest($request); |
79 | 79 | ||
80 | if ($userForm->isValid()) { | 80 | if ($userForm->isValid()) { |
@@ -89,7 +89,7 @@ class ConfigController extends Controller | |||
89 | } | 89 | } |
90 | 90 | ||
91 | // handle rss information | 91 | // handle rss information |
92 | $rssForm = $this->createForm(RssType::class, $config, array('action' => $this->generateUrl('config').'#set2')); | 92 | $rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']); |
93 | $rssForm->handleRequest($request); | 93 | $rssForm->handleRequest($request); |
94 | 94 | ||
95 | if ($rssForm->isValid()) { | 95 | if ($rssForm->isValid()) { |
@@ -106,7 +106,7 @@ class ConfigController extends Controller | |||
106 | 106 | ||
107 | // handle tagging rule | 107 | // handle tagging rule |
108 | $taggingRule = new TaggingRule(); | 108 | $taggingRule = new TaggingRule(); |
109 | $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, array('action' => $this->generateUrl('config').'#set5')); | 109 | $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $this->generateUrl('config').'#set5']); |
110 | $newTaggingRule->handleRequest($request); | 110 | $newTaggingRule->handleRequest($request); |
111 | 111 | ||
112 | if ($newTaggingRule->isValid()) { | 112 | if ($newTaggingRule->isValid()) { |
@@ -126,10 +126,10 @@ class ConfigController extends Controller | |||
126 | $newUser = $userManager->createUser(); | 126 | $newUser = $userManager->createUser(); |
127 | // enable created user by default | 127 | // enable created user by default |
128 | $newUser->setEnabled(true); | 128 | $newUser->setEnabled(true); |
129 | $newUserForm = $this->createForm(NewUserType::class, $newUser, array( | 129 | $newUserForm = $this->createForm(NewUserType::class, $newUser, [ |
130 | 'validation_groups' => array('Profile'), | 130 | 'validation_groups' => ['Profile'], |
131 | 'action' => $this->generateUrl('config').'#set6', | 131 | 'action' => $this->generateUrl('config').'#set6', |
132 | )); | 132 | ]); |
133 | $newUserForm->handleRequest($request); | 133 | $newUserForm->handleRequest($request); |
134 | 134 | ||
135 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { | 135 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { |
@@ -147,27 +147,27 @@ class ConfigController extends Controller | |||
147 | 147 | ||
148 | $this->get('session')->getFlashBag()->add( | 148 | $this->get('session')->getFlashBag()->add( |
149 | 'notice', | 149 | 'notice', |
150 | $this->get('translator')->trans('flashes.config.notice.user_added', array('%username%' => $newUser->getUsername())) | 150 | $this->get('translator')->trans('flashes.config.notice.user_added', ['%username%' => $newUser->getUsername()]) |
151 | ); | 151 | ); |
152 | 152 | ||
153 | return $this->redirect($this->generateUrl('config').'#set6'); | 153 | return $this->redirect($this->generateUrl('config').'#set6'); |
154 | } | 154 | } |
155 | 155 | ||
156 | return $this->render('WallabagCoreBundle:Config:index.html.twig', array( | 156 | return $this->render('WallabagCoreBundle:Config:index.html.twig', [ |
157 | 'form' => array( | 157 | 'form' => [ |
158 | 'config' => $configForm->createView(), | 158 | 'config' => $configForm->createView(), |
159 | 'rss' => $rssForm->createView(), | 159 | 'rss' => $rssForm->createView(), |
160 | 'pwd' => $pwdForm->createView(), | 160 | 'pwd' => $pwdForm->createView(), |
161 | 'user' => $userForm->createView(), | 161 | 'user' => $userForm->createView(), |
162 | 'new_user' => $newUserForm->createView(), | 162 | 'new_user' => $newUserForm->createView(), |
163 | 'new_tagging_rule' => $newTaggingRule->createView(), | 163 | 'new_tagging_rule' => $newTaggingRule->createView(), |
164 | ), | 164 | ], |
165 | 'rss' => array( | 165 | 'rss' => [ |
166 | 'username' => $user->getUsername(), | 166 | 'username' => $user->getUsername(), |
167 | 'token' => $config->getRssToken(), | 167 | 'token' => $config->getRssToken(), |
168 | ), | 168 | ], |
169 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), | 169 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), |
170 | )); | 170 | ]); |
171 | } | 171 | } |
172 | 172 | ||
173 | /** | 173 | /** |
@@ -187,7 +187,7 @@ class ConfigController extends Controller | |||
187 | $em->flush(); | 187 | $em->flush(); |
188 | 188 | ||
189 | if ($request->isXmlHttpRequest()) { | 189 | if ($request->isXmlHttpRequest()) { |
190 | return new JsonResponse(array('token' => $config->getRssToken())); | 190 | return new JsonResponse(['token' => $config->getRssToken()]); |
191 | } | 191 | } |
192 | 192 | ||
193 | $this->get('session')->getFlashBag()->add( | 193 | $this->get('session')->getFlashBag()->add( |
@@ -229,7 +229,7 @@ class ConfigController extends Controller | |||
229 | * Retrieve config for the current user. | 229 | * Retrieve config for the current user. |
230 | * If no config were found, create a new one. | 230 | * If no config were found, create a new one. |
231 | * | 231 | * |
232 | * @return Wallabag\CoreBundle\Entity\Config | 232 | * @return Config |
233 | */ | 233 | */ |
234 | private function getConfig() | 234 | private function getConfig() |
235 | { | 235 | { |