@@ -40,18 +40,18 @@ |
||
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 | |
47 | 47 | $referer = $request->headers->get('referer'); |
48 | - $url = $this->generateUrl('trick.show',['id'=>$trick->getId(), 'slug'=>$trick->getSlug()]); |
|
48 | + $url = $this->generateUrl('trick.show', ['id'=>$trick->getId(), 'slug'=>$trick->getSlug()]); |
|
49 | 49 | |
50 | 50 | $event = new TrickDeletedEvent($trick); |
51 | 51 | $this->dispatcher->dispatch(TrickDeletedEvent::NAME, $event); |
52 | 52 | |
53 | 53 | //If we came from the show page, go to home page |
54 | - if(mb_substr_count($referer, $url)>0) |
|
54 | + if (mb_substr_count($referer, $url) > 0) |
|
55 | 55 | { |
56 | 56 | return $this->redirectToRoute('home'); |
57 | 57 | } |
@@ -40,22 +40,22 @@ |
||
40 | 40 | $fixedTag = new Tag(); |
41 | 41 | $fixedTag->setName("Starbug tag"); |
42 | 42 | |
43 | - foreach ($tricks as $trick){ |
|
44 | - $maxTags = rand(0,5); |
|
45 | - if($maxTags >0){ |
|
46 | - for($i=0; $i<=$maxTags; $i++){ |
|
43 | + foreach ($tricks as $trick) { |
|
44 | + $maxTags = rand(0, 5); |
|
45 | + if ($maxTags > 0) { |
|
46 | + for ($i = 0; $i <= $maxTags; $i++) { |
|
47 | 47 | |
48 | - $tagName = strtolower($faker->words(rand(1,3), true)); |
|
48 | + $tagName = strtolower($faker->words(rand(1, 3), true)); |
|
49 | 49 | //Avoid duplicate tags |
50 | 50 | $tag = $tagRepository->findOneBy(['name'=>$tagName]); |
51 | - if($tag === null){ |
|
52 | - $tag=new Tag(); |
|
51 | + if ($tag === null) { |
|
52 | + $tag = new Tag(); |
|
53 | 53 | $tag->setName($tagName); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $trick->addTag($tag); |
57 | 57 | |
58 | - if(rand(0,6)===1){ |
|
58 | + if (rand(0, 6) === 1) { |
|
59 | 59 | $trick->addTag($fixedTag); |
60 | 60 | } |
61 | 61 | } |