@@ -40,22 +40,22 @@ |
||
| 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 | } |
| 55 | 55 | |
| 56 | 56 | $trick->addTag($tag); |
| 57 | 57 | |
| 58 | - if(rand(0,6)===1){ |
|
| 58 | + if (rand(0, 6) === 1) { |
|
| 59 | 59 | $trick->addTag($fixedTag); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | private $tagSerializer; |
| 46 | 46 | |
| 47 | - public function __construct(EventDispatcherInterface $dispatcher, TrickHistory $trickHistory, TagRepository $tagRepository, TagSerializer $tagSerializer ) |
|
| 47 | + public function __construct(EventDispatcherInterface $dispatcher, TrickHistory $trickHistory, TagRepository $tagRepository, TagSerializer $tagSerializer) |
|
| 48 | 48 | { |
| 49 | 49 | $this->dispatcher = $dispatcher; |
| 50 | 50 | $this->trickHistory = $trickHistory; |
@@ -176,7 +176,7 @@ |
||
| 176 | 176 | return $this->tags; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function getTagsJson(){ |
|
| 179 | + public function getTagsJson() { |
|
| 180 | 180 | |
| 181 | 181 | $tagSerializer = new TagSerializer(); |
| 182 | 182 | return $tagSerializer->trickTagsJson($this); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - if($options['all_tags_json'] === '' || $options['trick_tags_json'] === ''){ |
|
| 23 | + if ($options['all_tags_json'] === '' || $options['trick_tags_json'] === '') { |
|
| 24 | 24 | throw new \UnexpectedValueException("all_tags_json or trick_tags_json not defined in the form constructor"); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -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 | } |