@@ -40,7 +40,7 @@ |
||
| 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 | |
@@ -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 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'admin' |
| 34 | 34 | )) |
| 35 | 35 | ->setRoles(['ROLE_ADMIN']) |
| 36 | - ->setImage($faker->image('public/uploads/user_images',400,300, null, false) ) |
|
| 36 | + ->setImage($faker->image('public/uploads/user_images', 400, 300, null, false)) |
|
| 37 | 37 | ->setVerified(true) |
| 38 | 38 | ->setVerifiedHash(bin2hex(random_bytes(16))); |
| 39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $user, |
| 48 | 48 | 'user' |
| 49 | 49 | )) |
| 50 | - ->setImage($faker->image('public/uploads/user_images',400,300, null, false) ) |
|
| 50 | + ->setImage($faker->image('public/uploads/user_images', 400, 300, null, false)) |
|
| 51 | 51 | ->setVerified(true) |
| 52 | 52 | ->setVerifiedHash(bin2hex(random_bytes(16))); |
| 53 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | //Adding extra users |
| 72 | 72 | |
| 73 | - for($i=0; $i<10; $i++){ |
|
| 73 | + for ($i = 0; $i < 10; $i++) { |
|
| 74 | 74 | $user = new User(); |
| 75 | 75 | $user->setEmail('user'.$i.'@localhost.com') |
| 76 | 76 | ->setUserName('user'.$i) |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | ->setVerifiedHash(bin2hex(random_bytes(16))); |
| 84 | 84 | |
| 85 | 85 | //Not all users will have an image |
| 86 | - if(rand(0,2)>=1){ |
|
| 87 | - $user->setImage($faker->image('public/uploads/user_images',400,300, null, false) ); |
|
| 86 | + if (rand(0, 2) >= 1) { |
|
| 87 | + $user->setImage($faker->image('public/uploads/user_images', 400, 300, null, false)); |
|
| 88 | 88 | } |
| 89 | 89 | // $product = new Product(); |
| 90 | 90 | $manager->persist($user); |
@@ -40,16 +40,16 @@ discard block |
||
| 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 | $manager->persist($tag); |
| 55 | 55 | $manager->flush(); //create the tag in DB |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $trick->addTag($tag); |
| 59 | 59 | |
| 60 | - if(rand(0,6)===1){ |
|
| 60 | + if (rand(0, 6) === 1) { |
|
| 61 | 61 | $trick->addTag($fixedTag); |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -278,7 +278,7 @@ |
||
| 278 | 278 | */ |
| 279 | 279 | public function getPrimaryImages(): ?Collection |
| 280 | 280 | { |
| 281 | - return $this->getImages()->filter(function (Image $image){ |
|
| 281 | + return $this->getImages()->filter(function(Image $image) { |
|
| 282 | 282 | return $image->getPrimaryImage() === true; |
| 283 | 283 | }); |
| 284 | 284 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | if ($trickImage === $image) { |
| 43 | 43 | if($trickImage->getPrimaryImage()){ |
| 44 | 44 | $trickImage->setPrimaryImage(false); |
| 45 | - }else{ |
|
| 45 | + } else{ |
|
| 46 | 46 | $trickImage->setPrimaryImage(true); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | /** @var Image $trickImage */ |
| 23 | 23 | foreach ($trickImages as $trickImage) { |
| 24 | - if ($trickImage->getPrimaryImage() && $trickImage !== $image ) { |
|
| 24 | + if ($trickImage->getPrimaryImage() && $trickImage !== $image) { |
|
| 25 | 25 | $trickImage->setPrimaryImage(false); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | /** @var Image $trickImage */ |
| 42 | 42 | foreach ($trickImages as $trickImage) { |
| 43 | 43 | if ($trickImage === $image) { |
| 44 | - if($trickImage->getPrimaryImage()){ |
|
| 44 | + if ($trickImage->getPrimaryImage()) { |
|
| 45 | 45 | $trickImage->setPrimaryImage(false); |
| 46 | - }else{ |
|
| 46 | + } else { |
|
| 47 | 47 | $trickImage->setPrimaryImage(true); |
| 48 | 48 | } |
| 49 | 49 | |