Passed
Branch feature/frontend (f16ed3)
by Stone
07:11
created
src/Controller/Media/DeleteVideoController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Controller/Media/DeleteImageController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Controller/Trick/TricksByCategoryController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Controller/Comment/EditCommentController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Repository/CommentRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Repository/TrickRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function findLatestEdited(int $currentPage = 1, int $categoryId = 0)
33 33
     {
34
-        if($currentPage <1){
34
+        if ($currentPage < 1) {
35 35
             throw new \InvalidArgumentException("Current page can not be lower than one");
36 36
         }
37 37
 
38 38
         $query = $this->createQueryBuilder('t');
39 39
 
40
-        if($categoryId>0){
40
+        if ($categoryId > 0) {
41 41
             $query->where('t.category = :categoryId')
42 42
                 ->setParameter('categoryId', $categoryId);
43 43
         }
44 44
 
45 45
         $query->orderBy('t.editedAt', 'DESC')
46 46
             ->getQuery();
47
-        $paginator = $this->paginate($query,Trick::NUMBER_OF_DISPLAYED_TRICKS, $currentPage);
47
+        $paginator = $this->paginate($query, Trick::NUMBER_OF_DISPLAYED_TRICKS, $currentPage);
48 48
 
49 49
         return $paginator;
50 50
 
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function findLatestEditedByTag(int $currentPage = 1, int $tagId = 0)
59 59
     {
60
-        if($currentPage <1){
60
+        if ($currentPage < 1) {
61 61
             throw new \InvalidArgumentException("Current page can not be lower than one");
62 62
         }
63 63
 
64 64
         $query = $this->createQueryBuilder('t');
65 65
 
66
-        if($tagId>0){
66
+        if ($tagId > 0) {
67 67
             $query->leftJoin('t.tags', 'tag')
68 68
                 ->where('tag = :tagId')
69 69
                 ->setParameter('tagId', $tagId);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         $query->orderBy('t.editedAt', 'DESC')
73 73
             ->getQuery();
74
-        $paginator = $this->paginate($query,Trick::NUMBER_OF_DISPLAYED_TRICKS, $currentPage);
74
+        $paginator = $this->paginate($query, Trick::NUMBER_OF_DISPLAYED_TRICKS, $currentPage);
75 75
 
76 76
         return $paginator;
77 77
 
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 
85 85
         foreach ($searchTerms as $key => $term) {
86 86
             $queryBuilder
87
-                ->orWhere('p.name LIKE :term_' . $key)
88
-                ->setParameter('term_' . $key, '%' . $term . '%');
87
+                ->orWhere('p.name LIKE :term_'.$key)
88
+                ->setParameter('term_'.$key, '%'.$term.'%');
89 89
 
90 90
         }
91 91
 
Please login to merge, or discard this patch.
src/Form/ImageTypeForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
                 'required' => true,
28 28
             ])
29 29
 
30
-            ->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event){
30
+            ->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
31 31
                 /** @var Trick $trick */
32 32
                 $image = $event->getData();
33 33
 
34 34
                 $form = $event->getForm();
35 35
 
36
-                if(!$image || $image->getId() === null){
37
-                    $form->add('imageFile', VichImageType::class,[
36
+                if (!$image || $image->getId() === null) {
37
+                    $form->add('imageFile', VichImageType::class, [
38 38
                         'required' => true,
39 39
                         'allow_delete' => false,
40 40
                         'download_uri' => false,
Please login to merge, or discard this patch.
src/Pagination/PaginateRepositoryTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.