@@ -30,7 +30,7 @@ |
||
| 30 | 30 | if ($event->getException() instanceof RedirectException) { |
| 31 | 31 | $redirectResponse = new RedirectResponse($event->getException()->getRedirectResponse()); |
| 32 | 32 | |
| 33 | - if($event->getException()->getMessage() !== ""){ |
|
| 33 | + if ($event->getException()->getMessage() !== "") { |
|
| 34 | 34 | $this->addFlash(FlashMessageCategory::ERROR, $event->getException()->getMessage()); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | return $this->redirectResponse; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function getRedirectMessage(){ |
|
| 33 | + public function getRedirectMessage() { |
|
| 34 | 34 | return $this->redirectMessage; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * @param $historyId |
| 39 | 39 | * Revert a trick to a history checkpoint. |
| 40 | 40 | */ |
| 41 | - public function revertToHistory($id, $historyId){ |
|
| 41 | + public function revertToHistory($id, $historyId) { |
|
| 42 | 42 | $trick = $this->em->find('App\Entity\Trick', $id); |
| 43 | 43 | $this->repo->revert($trick, $historyId); |
| 44 | 44 | $this->em->persist($trick); |
@@ -16,16 +16,16 @@ |
||
| 16 | 16 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 17 | 17 | { |
| 18 | 18 | $builder |
| 19 | - ->add('name', TextType::class,[ |
|
| 19 | + ->add('name', TextType::class, [ |
|
| 20 | 20 | 'label' => 'Name of the trick, must be at least 5 characters' |
| 21 | 21 | ]) |
| 22 | - ->add('text', TextareaType::class ,[ |
|
| 22 | + ->add('text', TextareaType::class, [ |
|
| 23 | 23 | 'label' => 'Describe the trick', |
| 24 | 24 | 'attr' => [ |
| 25 | 25 | 'class'=>'materialize-textarea' |
| 26 | 26 | ] |
| 27 | 27 | ]) |
| 28 | - ->add('category', EntityType::class,[ |
|
| 28 | + ->add('category', EntityType::class, [ |
|
| 29 | 29 | 'class' => Category::class, |
| 30 | 30 | 'choice_label' => 'Name', |
| 31 | 31 | ]) |
@@ -15,19 +15,19 @@ |
||
| 15 | 15 | $faker = Factory::create(); |
| 16 | 16 | |
| 17 | 17 | $categoryList = array(); |
| 18 | - for($i=0; $i<5; $i++){ |
|
| 18 | + for ($i = 0; $i < 5; $i++) { |
|
| 19 | 19 | $category = new Category(); |
| 20 | 20 | $categoryList[] = $category->setName($faker->word); |
| 21 | 21 | $manager->persist($category); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - for ($i=0; $i<25; $i++){ |
|
| 24 | + for ($i = 0; $i < 25; $i++) { |
|
| 25 | 25 | $trick = new Trick(); |
| 26 | 26 | $trick |
| 27 | 27 | ->setName($faker->words(3, true)) |
| 28 | 28 | ->setText($faker->paragraph()) |
| 29 | 29 | ->setCreatedAt($faker->dateTimeThisDecade()) |
| 30 | - ->setCategory($categoryList[rand(0,4)]); |
|
| 30 | + ->setCategory($categoryList[rand(0, 4)]); |
|
| 31 | 31 | ; |
| 32 | 32 | |
| 33 | 33 | $manager->persist($trick); |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | foreach ($searchTerms as $key => $term) { |
| 51 | 51 | $queryBuilder |
| 52 | - ->orWhere('p.name LIKE :term_' . $key) |
|
| 53 | - ->setParameter('term_' . $key, '%' . $term . '%'); |
|
| 52 | + ->orWhere('p.name LIKE :term_'.$key) |
|
| 53 | + ->setParameter('term_'.$key, '%'.$term.'%'); |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | private function extractSearchTerms(string $searchQuery): array |
| 78 | 78 | { |
| 79 | 79 | $terms = array_unique(explode(' ', $searchQuery)); |
| 80 | - return array_filter($terms, function ($term) { |
|
| 80 | + return array_filter($terms, function($term) { |
|
| 81 | 81 | return 2 <= mb_strlen($term); |
| 82 | 82 | }); |
| 83 | 83 | } |
@@ -42,12 +42,12 @@ |
||
| 42 | 42 | public function revertHistory(Trick $trick, $historyId, Request $request) |
| 43 | 43 | { |
| 44 | 44 | $submittedToken = $request->request->get('_token'); |
| 45 | - if (!$this->isCsrfTokenValid('revert-trick' . $historyId, $submittedToken)) { |
|
| 45 | + if (!$this->isCsrfTokenValid('revert-trick'.$historyId, $submittedToken)) { |
|
| 46 | 46 | throw new RedirectException($this->generateUrl('home'), 'Bad CSRF Token'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $this->trickHistory->revertToHistory($trick->getId(), $historyId); |
| 50 | - $this->addFlash(FlashMessageCategory::SUCCESS, 'Reverted ' . $trick->getName()); |
|
| 50 | + $this->addFlash(FlashMessageCategory::SUCCESS, 'Reverted '.$trick->getName()); |
|
| 51 | 51 | return $this->redirectToRoute('trick.show', [ |
| 52 | 52 | 'id' => $trick->getId(), |
| 53 | 53 | 'slug' => $trick->getSlug(), |