diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 21:24:20 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 21:24:20 +0100 |
commit | 4cfbd5d893aa51fd5d3b349c2695e9913591041f (patch) | |
tree | c07eb79213d471aa33c49ef4e5819e41cc12f242 /src/Wallabag/CoreBundle/Controller | |
parent | 1990517b2263a080946853ed697a6d687262ae80 (diff) | |
parent | 7df80cb32ca9b7d0fe452320ddc3563a1e373e2f (diff) | |
download | wallabag-4cfbd5d893aa51fd5d3b349c2695e9913591041f.tar.gz wallabag-4cfbd5d893aa51fd5d3b349c2695e9913591041f.tar.zst wallabag-4cfbd5d893aa51fd5d3b349c2695e9913591041f.zip |
Merge pull request #1037 from j0k3r/refactor-cs
CS
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
3 files changed, 21 insertions, 31 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 25f18711..377a45ae 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -8,14 +8,12 @@ use Symfony\Component\HttpFoundation\Request; | |||
8 | use Wallabag\CoreBundle\Repository; | 8 | use Wallabag\CoreBundle\Repository; |
9 | use Wallabag\CoreBundle\Entity\Entries; | 9 | use Wallabag\CoreBundle\Entity\Entries; |
10 | use Wallabag\CoreBundle\Service\Extractor; | 10 | use Wallabag\CoreBundle\Service\Extractor; |
11 | use Wallabag\CoreBundle\Helper\Tools; | ||
12 | use Wallabag\CoreBundle\Helper\Url; | 11 | use Wallabag\CoreBundle\Helper\Url; |
13 | 12 | ||
14 | class EntryController extends Controller | 13 | class EntryController extends Controller |
15 | { | 14 | { |
16 | |||
17 | /** | 15 | /** |
18 | * @param Request $request | 16 | * @param Request $request |
19 | * @Route("/new", name="new_entry") | 17 | * @Route("/new", name="new_entry") |
20 | * @return \Symfony\Component\HttpFoundation\Response | 18 | * @return \Symfony\Component\HttpFoundation\Response |
21 | */ | 19 | */ |
@@ -32,7 +30,6 @@ class EntryController extends Controller | |||
32 | $form->handleRequest($request); | 30 | $form->handleRequest($request); |
33 | 31 | ||
34 | if ($form->isValid()) { | 32 | if ($form->isValid()) { |
35 | |||
36 | $content = Extractor::extract($entry->getUrl()); | 33 | $content = Extractor::extract($entry->getUrl()); |
37 | 34 | ||
38 | $entry->setTitle($content->getTitle()); | 35 | $entry->setTitle($content->getTitle()); |
@@ -115,7 +112,7 @@ class EntryController extends Controller | |||
115 | /** | 112 | /** |
116 | * Shows entry content | 113 | * Shows entry content |
117 | * | 114 | * |
118 | * @param Entries $entry | 115 | * @param Entries $entry |
119 | * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view") | 116 | * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view") |
120 | * @return \Symfony\Component\HttpFoundation\Response | 117 | * @return \Symfony\Component\HttpFoundation\Response |
121 | */ | 118 | */ |
@@ -130,8 +127,8 @@ class EntryController extends Controller | |||
130 | /** | 127 | /** |
131 | * Changes read status for an entry | 128 | * Changes read status for an entry |
132 | * | 129 | * |
133 | * @param Request $request | 130 | * @param Request $request |
134 | * @param Entries $entry | 131 | * @param Entries $entry |
135 | * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry") | 132 | * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry") |
136 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | 133 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
137 | */ | 134 | */ |
@@ -151,8 +148,8 @@ class EntryController extends Controller | |||
151 | /** | 148 | /** |
152 | * Changes favorite status for an entry | 149 | * Changes favorite status for an entry |
153 | * | 150 | * |
154 | * @param Request $request | 151 | * @param Request $request |
155 | * @param Entries $entry | 152 | * @param Entries $entry |
156 | * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry") | 153 | * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry") |
157 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | 154 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
158 | */ | 155 | */ |
@@ -172,8 +169,8 @@ class EntryController extends Controller | |||
172 | /** | 169 | /** |
173 | * Deletes entry | 170 | * Deletes entry |
174 | * | 171 | * |
175 | * @param Request $request | 172 | * @param Request $request |
176 | * @param Entries $entry | 173 | * @param Entries $entry |
177 | * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry") | 174 | * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry") |
178 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | 175 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
179 | */ | 176 | */ |
diff --git a/src/Wallabag/CoreBundle/Controller/SecurityController.php b/src/Wallabag/CoreBundle/Controller/SecurityController.php index 51f9cc26..c2901da2 100644 --- a/src/Wallabag/CoreBundle/Controller/SecurityController.php +++ b/src/Wallabag/CoreBundle/Controller/SecurityController.php | |||
@@ -18,10 +18,11 @@ class SecurityController extends Controller | |||
18 | $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); | 18 | $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); |
19 | $session->remove(SecurityContext::AUTHENTICATION_ERROR); | 19 | $session->remove(SecurityContext::AUTHENTICATION_ERROR); |
20 | } | 20 | } |
21 | |||
21 | return $this->render('WallabagCoreBundle:Security:login.html.twig', array( | 22 | return $this->render('WallabagCoreBundle:Security:login.html.twig', array( |
22 | // last username entered by the user | 23 | // last username entered by the user |
23 | 'last_username' => $session->get(SecurityContext::LAST_USERNAME), | 24 | 'last_username' => $session->get(SecurityContext::LAST_USERNAME), |
24 | 'error' => $error, | 25 | 'error' => $error, |
25 | )); | 26 | )); |
26 | } | 27 | } |
27 | } \ No newline at end of file | 28 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index 8e018e88..5668d934 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; | 5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
6 | use FOS\RestBundle\Controller\Annotations\View; | ||
7 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
8 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
9 | use Wallabag\CoreBundle\Entity\Entries; | 8 | use Wallabag\CoreBundle\Entity\Entries; |
@@ -12,7 +11,6 @@ use Wallabag\CoreBundle\Service\Extractor; | |||
12 | 11 | ||
13 | class WallabagRestController extends Controller | 12 | class WallabagRestController extends Controller |
14 | { | 13 | { |
15 | |||
16 | /** | 14 | /** |
17 | * Retrieve all entries. It could be filtered by many options. | 15 | * Retrieve all entries. It could be filtered by many options. |
18 | * | 16 | * |
@@ -44,14 +42,13 @@ class WallabagRestController extends Controller | |||
44 | $entries = $this | 42 | $entries = $this |
45 | ->getDoctrine() | 43 | ->getDoctrine() |
46 | ->getRepository('WallabagCoreBundle:Entries') | 44 | ->getRepository('WallabagCoreBundle:Entries') |
47 | ->findEntries(1, (int)$isArchived, (int)$isStarred, (int)$isDeleted, $sort, $order); | 45 | ->findEntries(1, (int) $isArchived, (int) $isStarred, (int) $isDeleted, $sort, $order); |
48 | 46 | ||
49 | if(!is_array($entries)) { | 47 | if (!is_array($entries)) { |
50 | throw $this->createNotFoundException(); | 48 | throw $this->createNotFoundException(); |
51 | } | 49 | } |
52 | 50 | ||
53 | return $entries; | 51 | return $entries; |
54 | |||
55 | } | 52 | } |
56 | 53 | ||
57 | /** | 54 | /** |
@@ -119,7 +116,6 @@ class WallabagRestController extends Controller | |||
119 | */ | 116 | */ |
120 | public function patchEntriesAction(Entries $entry) | 117 | public function patchEntriesAction(Entries $entry) |
121 | { | 118 | { |
122 | |||
123 | } | 119 | } |
124 | 120 | ||
125 | /** | 121 | /** |
@@ -133,10 +129,8 @@ class WallabagRestController extends Controller | |||
133 | */ | 129 | */ |
134 | public function deleteEntriesAction(Entries $entry) | 130 | public function deleteEntriesAction(Entries $entry) |
135 | { | 131 | { |
136 | |||
137 | } | 132 | } |
138 | 133 | ||
139 | |||
140 | /** | 134 | /** |
141 | * Retrieve all tags for an entry | 135 | * Retrieve all tags for an entry |
142 | * | 136 | * |
@@ -146,8 +140,8 @@ class WallabagRestController extends Controller | |||
146 | * } | 140 | * } |
147 | * ) | 141 | * ) |
148 | */ | 142 | */ |
149 | public function getEntriesTagsAction(Entries $entry) { | 143 | public function getEntriesTagsAction(Entries $entry) |
150 | 144 | { | |
151 | } | 145 | } |
152 | 146 | ||
153 | /** | 147 | /** |
@@ -162,8 +156,8 @@ class WallabagRestController extends Controller | |||
162 | * } | 156 | * } |
163 | * ) | 157 | * ) |
164 | */ | 158 | */ |
165 | public function postEntriesTagsAction(Entries $entry) { | 159 | public function postEntriesTagsAction(Entries $entry) |
166 | 160 | { | |
167 | } | 161 | } |
168 | 162 | ||
169 | /** | 163 | /** |
@@ -178,7 +172,6 @@ class WallabagRestController extends Controller | |||
178 | */ | 172 | */ |
179 | public function deleteEntriesTagsAction(Entries $entry, Tags $tag) | 173 | public function deleteEntriesTagsAction(Entries $entry, Tags $tag) |
180 | { | 174 | { |
181 | |||
182 | } | 175 | } |
183 | 176 | ||
184 | /** | 177 | /** |
@@ -187,8 +180,8 @@ class WallabagRestController extends Controller | |||
187 | * @ApiDoc( | 180 | * @ApiDoc( |
188 | * ) | 181 | * ) |
189 | */ | 182 | */ |
190 | public function getTagsAction() { | 183 | public function getTagsAction() |
191 | 184 | { | |
192 | } | 185 | } |
193 | 186 | ||
194 | /** | 187 | /** |
@@ -200,8 +193,8 @@ class WallabagRestController extends Controller | |||
200 | * } | 193 | * } |
201 | * ) | 194 | * ) |
202 | */ | 195 | */ |
203 | public function getTagAction(Tags $tag) { | 196 | public function getTagAction(Tags $tag) |
204 | 197 | { | |
205 | } | 198 | } |
206 | 199 | ||
207 | /** | 200 | /** |
@@ -215,6 +208,5 @@ class WallabagRestController extends Controller | |||
215 | */ | 208 | */ |
216 | public function deleteTagAction(Tags $tag) | 209 | public function deleteTagAction(Tags $tag) |
217 | { | 210 | { |
218 | |||
219 | } | 211 | } |
220 | } \ No newline at end of file | 212 | } |