@@ -19,14 +19,14 @@ |
||
19 | 19 | parent::__construct($registry, Category::class); |
20 | 20 | } |
21 | 21 | |
22 | - public function findBySearchQuery(array $searchTerms){ |
|
22 | + public function findBySearchQuery(array $searchTerms) { |
|
23 | 23 | |
24 | 24 | $queryBuilder = $this->createQueryBuilder('p'); |
25 | 25 | |
26 | 26 | foreach ($searchTerms as $key => $term) { |
27 | 27 | $queryBuilder |
28 | - ->orWhere('p.Name LIKE :term_' . $key) |
|
29 | - ->setParameter('term_' . $key, '%' . $term . '%'); |
|
28 | + ->orWhere('p.Name LIKE :term_'.$key) |
|
29 | + ->setParameter('term_'.$key, '%'.$term.'%'); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 |
@@ -32,14 +32,14 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | - public function findBySearchQuery(array $searchTerms){ |
|
35 | + public function findBySearchQuery(array $searchTerms) { |
|
36 | 36 | |
37 | 37 | $queryBuilder = $this->createQueryBuilder('p'); |
38 | 38 | |
39 | 39 | foreach ($searchTerms as $key => $term) { |
40 | 40 | $queryBuilder |
41 | - ->orWhere('p.name LIKE :term_' . $key) |
|
42 | - ->setParameter('term_' . $key, '%' . $term . '%'); |
|
41 | + ->orWhere('p.name LIKE :term_'.$key) |
|
42 | + ->setParameter('term_'.$key, '%'.$term.'%'); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $comment = new Comment(); |
51 | 51 | $comment->setTrick($trick); |
52 | 52 | $comment->setUser($faker->randomElement($users)); |
53 | - $comment->setComment($faker->realText(rand(10,75))); |
|
53 | + $comment->setComment($faker->realText(rand(10, 75))); |
|
54 | 54 | |
55 | 55 | $manager->persist($comment); |
56 | 56 |
@@ -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->sentence(5)); |
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 | - ->setName($faker->words(rand(1,5), true)) |
|
28 | - ->setText($faker->paragraph(rand(3,20))) |
|
27 | + ->setName($faker->words(rand(1, 5), true)) |
|
28 | + ->setText($faker->paragraph(rand(3, 20))) |
|
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); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function deleteTrick(Comment $comment, Request $request) |
36 | 36 | { |
37 | - if(!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
37 | + if (!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
38 | 38 | { |
39 | - Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]),"You are not allowed to edit this comment"); |
|
39 | + Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]), "You are not allowed to edit this comment"); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $submittedToken = $request->request->get('_token'); |
43 | - if (!$this->isCsrfTokenValid('delete-comment' . $comment->getId(), $submittedToken)) { |
|
43 | + if (!$this->isCsrfTokenValid('delete-comment'.$comment->getId(), $submittedToken)) { |
|
44 | 44 | throw new RedirectException($this->generateUrl('home'), 'Bad CSRF Token'); |
45 | 45 | } |
46 | 46 | |
@@ -49,6 +49,6 @@ discard block |
||
49 | 49 | $event = new CommentDeletedEvent($comment); |
50 | 50 | $this->dispatcher->dispatch(CommentDeletedEvent::NAME, $event); |
51 | 51 | |
52 | - return $this->redirectToRoute('trick.show',['id'=> $trick->getId(), 'slug' => $trick->getSlug()]); |
|
52 | + return $this->redirectToRoute('trick.show', ['id'=> $trick->getId(), 'slug' => $trick->getSlug()]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $this->tagRepository = $tagRepository; |
35 | 35 | } |
36 | 36 | |
37 | - private function serializeTag($tags){ |
|
37 | + private function serializeTag($tags) { |
|
38 | 38 | $serializer = new Serializer([new ObjectNormalizer()]); |
39 | 39 | return json_encode($serializer->normalize($tags, null, ['attributes' => ['name']])); |
40 | 40 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getUsername(): string |
123 | 123 | { |
124 | - return (string)$this->userName; |
|
124 | + return (string) $this->userName; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getPassword(): string |
150 | 150 | { |
151 | - return (string)$this->password; |
|
151 | + return (string) $this->password; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | public function setPassword(string $password): self |
@@ -379,6 +379,6 @@ discard block |
||
379 | 379 | |
380 | 380 | public function __toString() |
381 | 381 | { |
382 | - return $this->getUsername() . ' / ' . $this->getEmail(); |
|
382 | + return $this->getUsername().' / '.$this->getEmail(); |
|
383 | 383 | } |
384 | 384 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | return $this; |
92 | 92 | } |
93 | 93 | |
94 | - public function getCommentExcerpt(){ |
|
94 | + public function getCommentExcerpt() { |
|
95 | 95 | return implode(' ', array_slice(explode(' ', $this->getComment()), 0, 10))." ..."; |
96 | 96 | } |
97 | 97 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $image->setTitle($faker->words(rand(1, 3), true)); |
49 | 49 | $image->setImage($faker->image('public/uploads/trick_images', 400, 300, null, false)); |
50 | 50 | $image->setTrick($trick); |
51 | - if(rand(0,2)>0 && !$primaryImageSet){ |
|
51 | + if (rand(0, 2) > 0 && !$primaryImageSet) { |
|
52 | 52 | $image->setPrimaryImage(true); |
53 | 53 | $primaryImageSet = true; |
54 | 54 | } |