Passed
Push — master ( f08540...e0c380 )
by Jan
07:05
created
src/Form/Type/CurrencyEntityType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // This options allows you to override the currency shown for the null value
59 59
         $resolver->setDefault('base_currency', null);
60 60
 
61
-        $resolver->setDefault('empty_message', function (Options $options) {
61
+        $resolver->setDefault('empty_message', function(Options $options) {
62 62
             //By default we use the global base currency:
63 63
             $iso_code = $this->base_currency;
64 64
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $tmp = parent::generateChoiceAttr($choice, $key, $value, $options);
81 81
 
82
-        if(!empty($choice->getIsoCode())) {
82
+        if (!empty($choice->getIsoCode())) {
83 83
             $symbol = Currencies::getSymbol($choice->getIsoCode());
84 84
         } else {
85 85
             $symbol = null;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
     protected function getChoiceContent(AbstractStructuralDBElement $choice, $key, $value, $options): string
102 102
     {
103
-        if(!$choice instanceof Currency) {
103
+        if (!$choice instanceof Currency) {
104 104
             throw new RuntimeException('$choice must be an instance of Currency!');
105 105
         }
106 106
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
         $tmp = str_repeat('<span class="picker-level"></span>', $level);
118 118
 
119 119
         //Show currency symbol or ISO code and the name of the currency
120
-        if(!empty($choice->getIsoCode())) {
120
+        if (!empty($choice->getIsoCode())) {
121 121
             $tmp .= Currencies::getSymbol($choice->getIsoCode());
122 122
             //Add currency name as badge
123
-            $tmp .= sprintf('<span class="badge bg-primary ms-2 %s">%s</span>', $options['short'] ? 'picker-hs' : '' , htmlspecialchars($choice->getName()));
123
+            $tmp .= sprintf('<span class="badge bg-primary ms-2 %s">%s</span>', $options['short'] ? 'picker-hs' : '', htmlspecialchars($choice->getName()));
124 124
         } else {
125 125
             $tmp .= htmlspecialchars($choice->getName());
126 126
         }
Please login to merge, or discard this patch.
src/Form/Type/Helper/StructuralEntityChoiceLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 
93 93
         $results = [];
94 94
 
95
-        foreach($entities as $entity) {
95
+        foreach ($entities as $entity) {
96 96
             //If the entity is newly created (ID null), add it as result and persist it.
97 97
             if ($entity->getID() === null) {
98 98
                 $this->entityManager->persist($entity);
Please login to merge, or discard this patch.
src/Form/Type/StructuralEntityType.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function buildForm(FormBuilderInterface $builder, array $options): void
70 70
     {
71
-        $builder->addEventListener(FormEvents::PRE_SUBMIT, function (PreSubmitEvent $event) {
71
+        $builder->addEventListener(FormEvents::PRE_SUBMIT, function(PreSubmitEvent $event) {
72 72
             //When the data contains non-digit characters, we assume that the user entered a new element.
73 73
             //In that case we add the new element to our choice_loader
74 74
 
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 
102 102
 
103 103
         $builder->addModelTransformer(new CallbackTransformer(
104
-            function ($value) use ($options) {
104
+            function($value) use ($options) {
105 105
                 return $this->modelTransform($value, $options);
106
-            }, function ($value) use ($options) {
106
+            }, function($value) use ($options) {
107 107
             return $this->modelReverseTransform($value, $options);
108 108
         }));
109 109
     }
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         $resolver->setDefaults([
115 115
             'allow_add' => false,
116 116
             'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext
117
-            'subentities_of' => null,   //Only show entities with the given parent class
118
-            'disable_not_selectable' => false,  //Disable entries with not selectable property
119
-            'choice_value' => function (?AbstractStructuralDBElement $element) {
117
+            'subentities_of' => null, //Only show entities with the given parent class
118
+            'disable_not_selectable' => false, //Disable entries with not selectable property
119
+            'choice_value' => function(?AbstractStructuralDBElement $element) {
120 120
                 if ($element === null) {
121 121
                     return null;
122 122
                 }
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 
129 129
                 return $element->getID();
130 130
             }, //Use the element id as option value and for comparing items
131
-            'choice_loader' => function (Options $options) {
131
+            'choice_loader' => function(Options $options) {
132 132
                 return new StructuralEntityChoiceLoader($options, $this->builder, $this->em);
133 133
             },
134
-            'choice_label' => function (Options $options) {
135
-                return function ($choice, $key, $value) use ($options) {
134
+            'choice_label' => function(Options $options) {
135
+                return function($choice, $key, $value) use ($options) {
136 136
                     return $this->generateChoiceLabels($choice, $key, $value, $options);
137 137
                 };
138 138
             },
139
-            'choice_attr' => function (Options $options) {
140
-                return function ($choice, $key, $value) use ($options) {
139
+            'choice_attr' => function(Options $options) {
140
+                return function($choice, $key, $value) use ($options) {
141 141
                     return $this->generateChoiceAttr($choice, $key, $value, $options);
142 142
                 };
143 143
             },
144
-            'group_by' => function (AbstractStructuralDBElement $element)
144
+            'group_by' => function(AbstractStructuralDBElement $element)
145 145
             {
146 146
                 //Show entities that are not added to DB yet separately from other entities
147 147
                 if ($element->getID() === null) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         ]);
155 155
 
156 156
         //Set the constraints for the case that allow add is enabled (we then have to check that the new element is valid)
157
-        $resolver->setNormalizer('constraints', function (Options $options, $value) {
157
+        $resolver->setNormalizer('constraints', function(Options $options, $value) {
158 158
             if ($options['allow_add']) {
159 159
                 $value[] = new Valid();
160 160
             }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $resolver->setDefault('controller', 'elements--structural-entity-select');
168 168
 
169
-        $resolver->setDefault('attr', static function (Options $options) {
169
+        $resolver->setDefault('attr', static function(Options $options) {
170 170
             $tmp = [
171 171
                 'data-controller' => $options['controller'],
172 172
                 'data-allow-add' => $options['allow_add'] ? 'true' : 'false',
Please login to merge, or discard this patch.