@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | private $tagRepository; |
| 43 | 43 | |
| 44 | - public function __construct(EventDispatcherInterface $dispatcher, TrickHistory $trickHistory, TagRepository $tagRepository ) |
|
| 44 | + public function __construct(EventDispatcherInterface $dispatcher, TrickHistory $trickHistory, TagRepository $tagRepository) |
|
| 45 | 45 | { |
| 46 | 46 | $this->dispatcher = $dispatcher; |
| 47 | 47 | $this->trickHistory = $trickHistory; |
@@ -85,10 +85,10 @@ |
||
| 85 | 85 | * Checks if the user is admin or author of the comment. |
| 86 | 86 | * Thows a redirect to the trick show page |
| 87 | 87 | */ |
| 88 | - private function checkSecurity(Comment $comment){ |
|
| 89 | - if(!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
| 88 | + private function checkSecurity(Comment $comment) { |
|
| 89 | + if (!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
| 90 | 90 | { |
| 91 | - Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]),"You are not allowed to edit this comment"); |
|
| 91 | + Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]), "You are not allowed to edit this comment"); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
@@ -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 |