@@ -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(), |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | |
| 42 | 42 | $submittedToken = $request->request->get('_token'); |
| 43 | - if (!$this->isCsrfTokenValid('delete-trick' . $trick->getId(), $submittedToken)) { |
|
| 43 | + if (!$this->isCsrfTokenValid('delete-trick'.$trick->getId(), $submittedToken)) { |
|
| 44 | 44 | throw new RedirectException($this->generateUrl('home'), 'Bad CSRF Token'); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | $history = array(); |
| 86 | 86 | //Only load the history if we are admin. Ease the load. |
| 87 | - if($this->isGranted('ROLE_ADMIN')){ |
|
| 87 | + if ($this->isGranted('ROLE_ADMIN')) { |
|
| 88 | 88 | $history = $this->trickHistory->getHistory($trick->getId()); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function getUsername(): string |
| 111 | 111 | { |
| 112 | - return (string)$this->userName; |
|
| 112 | + return (string) $this->userName; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function getPassword(): string |
| 138 | 138 | { |
| 139 | - return (string)$this->password; |
|
| 139 | + return (string) $this->password; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function setPassword(string $password): self |
@@ -328,6 +328,6 @@ discard block |
||
| 328 | 328 | $this->verified, |
| 329 | 329 | $this->verifiedDateTime, |
| 330 | 330 | $this->updatedAt, |
| 331 | - )=unserialize($serialized, ['allowed_classes' => false]); |
|
| 331 | + ) = unserialize($serialized, ['allowed_classes' => false]); |
|
| 332 | 332 | } |
| 333 | 333 | } |