@@ -19,14 +19,14 @@ |
||
19 | 19 | parent::__construct($registry, Image::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.title LIKE :term_' . $key) |
|
29 | - ->setParameter('term_' . $key, '%' . $term . '%'); |
|
28 | + ->orWhere('p.title LIKE :term_'.$key) |
|
29 | + ->setParameter('term_'.$key, '%'.$term.'%'); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 |
@@ -19,14 +19,14 @@ |
||
19 | 19 | parent::__construct($registry, Video::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.title LIKE :term_' . $key) |
|
29 | - ->setParameter('term_' . $key, '%' . $term . '%'); |
|
28 | + ->orWhere('p.title LIKE :term_'.$key) |
|
29 | + ->setParameter('term_'.$key, '%'.$term.'%'); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $imageSearch = $this->imageRepository->findBySearchQuery($searchTerms); |
80 | 80 | /** @var Image $image */ |
81 | 81 | foreach ($imageSearch as $image) { |
82 | - if($image->getTrick() !== null){ |
|
82 | + if ($image->getTrick() !== null) { |
|
83 | 83 | $trickList[] = $image->getTrick(); |
84 | 84 | } |
85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $videoSearch = $this->videoRepository->findBySearchQuery($searchTerms); |
89 | 89 | /** @var Video $video */ |
90 | 90 | foreach ($videoSearch as $video) { |
91 | - if($video->getTrick() !== null){ |
|
91 | + if ($video->getTrick() !== null) { |
|
92 | 92 | $trickList[] = $video->getTrick(); |
93 | 93 | } |
94 | 94 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | private function extractSearchTerms(string $searchQuery): array |
115 | 115 | { |
116 | 116 | $terms = array_unique(explode(' ', $searchQuery)); |
117 | - return array_filter($terms, function ($term) { |
|
117 | + return array_filter($terms, function($term) { |
|
118 | 118 | return 2 <= mb_strlen($term); |
119 | 119 | }); |
120 | 120 | } |
@@ -38,12 +38,12 @@ |
||
38 | 38 | public function deleteTrickImage(video $video, Request $request) |
39 | 39 | { |
40 | 40 | $submittedToken = $request->request->get('_token'); |
41 | - if (!$this->isCsrfTokenValid('delete-video' . $video->getId(), $submittedToken)) { |
|
41 | + if (!$this->isCsrfTokenValid('delete-video'.$video->getId(), $submittedToken)) { |
|
42 | 42 | throw new RedirectException($this->generateUrl('home'), 'Bad CSRF Token'); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $trick = $video->getTrick(); |
46 | - if($trick !== null){ |
|
46 | + if ($trick !== null) { |
|
47 | 47 | $event = new VideoDeleteEvent($video, $trick); |
48 | 48 | $this->dispatcher->dispatch(VideoDeleteEvent::NAME, $event); |
49 | 49 | } |
@@ -38,12 +38,12 @@ |
||
38 | 38 | public function deleteTrickImage(Image $image, Request $request) |
39 | 39 | { |
40 | 40 | $submittedToken = $request->request->get('_token'); |
41 | - if (!$this->isCsrfTokenValid('delete-image' . $image->getId(), $submittedToken)) { |
|
41 | + if (!$this->isCsrfTokenValid('delete-image'.$image->getId(), $submittedToken)) { |
|
42 | 42 | throw new RedirectException($this->generateUrl('home'), 'Bad CSRF Token'); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $trick = $image->getTrick(); |
46 | - if ($trick !== null){ |
|
46 | + if ($trick !== null) { |
|
47 | 47 | $event = new ImageDeleteEvent($image, $trick); |
48 | 48 | $this->dispatcher->dispatch(ImageDeleteEvent::NAME, $event); |
49 | 49 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $page = $request->get('page') ?? 1; |
62 | 62 | |
63 | 63 | /** @var Paginator $tricks */ |
64 | - $tricks = $this->trickRepository->findLatestEdited($page, (int)$categoryId); |
|
64 | + $tricks = $this->trickRepository->findLatestEdited($page, (int) $categoryId); |
|
65 | 65 | |
66 | 66 | $nextPage = $this->pagePagination->nextPage($tricks, $page, Trick::NUMBER_OF_DISPLAYED_TRICKS); |
67 | 67 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'save_button_label' => 'Update', |
41 | 41 | ]); |
42 | 42 | |
43 | - if($request->isXmlHttpRequest()){ |
|
43 | + if ($request->isXmlHttpRequest()) { |
|
44 | 44 | $render = $this->renderView('comment/_comment-form.html.twig', [ |
45 | 45 | 'comment' => $comment, |
46 | 46 | 'commentForm' => $commentForm->createView(), |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * Checks if the user is admin or author of the comment. |
98 | 98 | * Thows a redirect to the trick show page |
99 | 99 | */ |
100 | - private function checkSecurity(Comment $comment){ |
|
101 | - if(!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
100 | + private function checkSecurity(Comment $comment) { |
|
101 | + if (!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
102 | 102 | { |
103 | - Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]),"You are not allowed to edit this comment"); |
|
103 | + Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]), "You are not allowed to edit this comment"); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | ->orderBy('c.createdAt', 'DESC') |
36 | 36 | ->getQuery(); |
37 | 37 | |
38 | - $paginator = $this->paginate($query,Comment::NUMBER_OF_DISPLAYED_COMMENTS, $currentPage); |
|
38 | + $paginator = $this->paginate($query, Comment::NUMBER_OF_DISPLAYED_COMMENTS, $currentPage); |
|
39 | 39 | |
40 | 40 | return $paginator; |
41 | 41 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | use Doctrine\ORM\Tools\Pagination\Paginator; |
7 | 7 | |
8 | -trait PaginateRepositoryTrait{ |
|
8 | +trait PaginateRepositoryTrait { |
|
9 | 9 | |
10 | 10 | public function paginate($dql, int $limit, int $page = 1) |
11 | 11 | { |