Passed
Push — master ( 9d73cc...ba4bf4 )
by Jan
04:53
created
src/Form/Type/StructuralEntityType.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
     public function buildForm(FormBuilderInterface $builder, array $options)
75 75
     {
76 76
         $builder->addModelTransformer(new CallbackTransformer(
77
-            function ($value) use ($options){
77
+            function($value) use ($options){
78 78
                 return $this->transform($value, $options);
79
-            }, function ($value) use ($options) {
79
+            }, function($value) use ($options) {
80 80
             return $this->reverseTransform($value, $options);
81 81
         }));
82 82
     }
@@ -86,24 +86,24 @@  discard block
 block discarded – undo
86 86
         $resolver->setRequired(['class']);
87 87
         $resolver->setDefaults([
88 88
             'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext
89
-            'subentities_of' => null,   //Only show entities with the given parent class
90
-            'disable_not_selectable' => false,  //Disable entries with not selectable property
89
+            'subentities_of' => null, //Only show entities with the given parent class
90
+            'disable_not_selectable' => false, //Disable entries with not selectable property
91 91
             'choice_value' => 'id', //Use the element id as option value and for comparing items
92
-            'choice_loader' => function (Options $options) {
93
-                return new CallbackChoiceLoader(function () use ($options) {
92
+            'choice_loader' => function(Options $options) {
93
+                return new CallbackChoiceLoader(function() use ($options) {
94 94
                     return $this->getEntries($options);
95 95
                 });
96
-            }, 'choice_label' => function ($choice, $key, $value) {
96
+            }, 'choice_label' => function($choice, $key, $value) {
97 97
                 return $this->generateChoiceLabels($choice, $key, $value);
98
-            }, 'choice_attr' => function ($choice, $key, $value) {
98
+            }, 'choice_attr' => function($choice, $key, $value) {
99 99
                 return $this->generateChoiceAttr($choice, $key, $value);
100 100
             }
101 101
         ]);
102 102
 
103 103
         $resolver->setDefault('empty_message', null);
104 104
 
105
-        $resolver->setDefault('attr', function (Options $options) {
106
-            $tmp =  ['class' => 'selectpicker', 'data-live-search' => true];
105
+        $resolver->setDefault('attr', function(Options $options) {
106
+            $tmp = ['class' => 'selectpicker', 'data-live-search' => true];
107 107
             if ($options['empty_message']) {
108 108
                 $tmp['data-none-Selected-Text'] = $options['empty_message'];
109 109
             }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 
142 142
         $tmp = str_repeat('   ', $choice->getLevel()); //Use 3 spaces for intendation
143
-        $tmp .=  htmlspecialchars($choice->getName());
143
+        $tmp .= htmlspecialchars($choice->getName());
144 144
         return $tmp;
145 145
     }
146 146
 
Please login to merge, or discard this patch.
src/Entity/PriceInformations/Pricedetail.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,6 @@
 block discarded – undo
188 188
      *          in the database, you have to pass the "price_related_quantity" count as $multiplier.
189 189
      *
190 190
      * @return string  the price as a bcmath string
191
-
192 191
      */
193 192
     public function getPricePerUnit($multiplier = 1.0) : string
194 193
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -356,6 +356,6 @@
 block discarded – undo
356 356
      */
357 357
     public function getIDString(): string
358 358
     {
359
-        return 'PD' . sprintf('%06d', $this->getID());
359
+        return 'PD'.sprintf('%06d', $this->getID());
360 360
     }
361 361
 }
Please login to merge, or discard this patch.
src/Migrations/Version20190902140506.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
         try {
27 27
             //Check if we can use this migration method:
28
-            $version = (int)$this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'");
28
+            $version = (int) $this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'");
29 29
             $this->abortIf($version !== 26, "This database migration can only be used if the database version is 26! Install Part-DB 0.5.6 and update database there!");
30 30
         } catch (DBALException $ex) {
31 31
             //when the table was not found, then you can not use this migration
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 
47 47
         /** Migrate the part locations for parts with known instock */
48 48
         $this->addSql(
49
-            'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' .
50
-            'SELECT parts.id, parts.id_storelocation,  parts.instock, 0, NOW(), NOW() FROM parts ' .
49
+            'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) '.
50
+            'SELECT parts.id, parts.id_storelocation,  parts.instock, 0, NOW(), NOW() FROM parts '.
51 51
             'WHERE parts.instock >= 0'
52 52
         );
53 53
 
54 54
         //Migrate part locations for parts with unknown instock
55 55
         $this->addSql(
56
-            'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' .
57
-            'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts ' .
56
+            'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) '.
57
+            'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts '.
58 58
             'WHERE parts.instock = -2'
59 59
         );
60 60
 
Please login to merge, or discard this patch.
src/Migrations/Version1.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         try {
24 24
             //Check if we can use this migration method:
25
-            $version = (int)$this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'");
25
+            $version = (int) $this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'");
26 26
             $this->skipIf(true, "Old Part-DB Database detected! Continue with upgrade...");
27 27
         } catch (DBALException $ex) {
28 28
             //when the table was not found, we can proceed, because we have an empty DB!
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $this->addSql('ALTER TABLE `groups` ADD CONSTRAINT FK_F06D3970727ACA70 FOREIGN KEY (parent_id) REFERENCES `groups` (id)');
81 81
 
82 82
         //Create table for user logs:
83
-        $sql =  $updateSteps[] = "CREATE TABLE `log` ".
83
+        $sql = $updateSteps[] = "CREATE TABLE `log` ".
84 84
             "( `id` INT NOT NULL AUTO_INCREMENT , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ,".
85 85
             " `id_user` INT NOT NULL ,".
86 86
             " `level` TINYINT NOT NULL ,".
Please login to merge, or discard this patch.
src/Form/AdminPages/ImportType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@
 block discarded – undo
66 66
         //Disable import if user is not allowed to create elements.
67 67
         $entity = new $data['entity_class']();
68 68
         $perm_name = "create";
69
-        $disabled = ! $this->security->isGranted($perm_name, $entity);
69
+        $disabled = !$this->security->isGranted($perm_name, $entity);
70 70
 
71 71
         $builder
72 72
 
73 73
             ->add('format', ChoiceType::class, [
74
-                'choices' => ['JSON' => 'json', 'XML' => 'xml','CSV' => 'csv' ,'YAML' => 'yaml'],
74
+                'choices' => ['JSON' => 'json', 'XML' => 'xml', 'CSV' => 'csv', 'YAML' => 'yaml'],
75 75
                 'label' => $this->trans->trans('export.format'),
76 76
                 'disabled' => $disabled])
77 77
             ->add('csv_separator', TextType::class, ['data' => ';',
Please login to merge, or discard this patch.
src/Form/AdminPages/MassCreationForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         //Disable import if user is not allowed to create elements.
66 66
         $entity = new $data['entity_class']();
67 67
         $perm_name = "create";
68
-        $disabled = ! $this->security->isGranted($perm_name, $entity);
68
+        $disabled = !$this->security->isGranted($perm_name, $entity);
69 69
 
70 70
         $builder
71 71
             ->add('lines', TextareaType::class, ['data' => '',
Please login to merge, or discard this patch.
src/Form/AdminPages/BaseEntityAdminForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 'label' =>  $this->trans->trans('entity.edit.not_selectable'),
84 84
                 'help' =>  $this->trans->trans('entity.edit.not_selectable.help'),
85 85
                 'label_attr' => ['class' => 'checkbox-custom'],
86
-                'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity) ])
86
+                'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity)])
87 87
 
88 88
             ->add('comment', CKEditorType::class, ['required' => false, 'empty_data' => '',
89 89
                 'label' =>  $this->trans->trans('comment.label'),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
             //Buttons
96 96
             $builder->add('save', SubmitType::class, [
97
-                'label' =>  $is_new ?  $this->trans->trans('entity.create') :  $this->trans->trans('entity.edit.save'),
97
+                'label' =>  $is_new ? $this->trans->trans('entity.create') : $this->trans->trans('entity.edit.save'),
98 98
                 'attr' => ['class' => $is_new ? 'btn-success' : ''],
99 99
                 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity)])
100 100
             ->add('reset', ResetType::class, ['label' => 'entity.edit.reset',
Please login to merge, or discard this patch.
src/Form/Part/PartBaseType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -217,12 +217,12 @@
 block discarded – undo
217 217
             'label' => $this->trans->trans('part.edit.master_attachment'),
218 218
             'class' => PartAttachment::class,
219 219
             'attr' => ['class' => 'selectpicker'],
220
-            'choice_attr' => function ($choice, $key, $value) {
220
+            'choice_attr' => function($choice, $key, $value) {
221 221
                 /** @var Attachment $choice */
222 222
                 return ['data-subtext' => $choice->getFilename() ?? "URL"];
223 223
             },
224 224
             'choice_label' => 'name',
225
-            'query_builder' => function (EntityRepository $er) use ($part) {
225
+            'query_builder' => function(EntityRepository $er) use ($part) {
226 226
                 if ($part->getID() == null) {
227 227
                     //This query is always false, so we get empty results
228 228
                     return $er->createQueryBuilder('u')->where('0 = 2');
Please login to merge, or discard this patch.
src/DataTables/PartsDataTable.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
         }
134 134
 
135 135
         if (isset($options['tag'])) {
136
-            $builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%' . $options['tag'] . '%');
136
+            $builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%'.$options['tag'].'%');
137 137
         }
138 138
 
139 139
         if (isset($options['search'])) {
140 140
             $builder->AndWhere('part.name LIKE :search')->orWhere('part.description LIKE :search')->orWhere('part.comment LIKE :search')
141
-                ->setParameter('search', '%' . $options['search'] . '%');
141
+                ->setParameter('search', '%'.$options['search'].'%');
142 142
         }
143 143
     }
144 144
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $dataTable
152 152
             ->add('name', TextColumn::class, [
153 153
                 'label' => $this->translator->trans('part.table.name'),
154
-                'render' => function ($value, Part $context) {
154
+                'render' => function($value, Part $context) {
155 155
                     return sprintf(
156 156
                         '<a href="%s">%s</a>',
157 157
                         $this->urlGenerator->infoURL($context),
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             ])
181 181
             ->add('storelocation', TextColumn::class, [
182 182
                 'label' => $this->translator->trans('part.table.storeLocations'),
183
-                'render' => function ($value, Part $context) {
183
+                'render' => function($value, Part $context) {
184 184
                     $tmp = array();
185 185
                     foreach ($context->getPartLots() as $lot) {
186 186
                         //Ignore lots without storelocation
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             ])
200 200
             ->add('amount', TextColumn::class, [
201 201
                 'label' => $this->translator->trans('part.table.amount'),
202
-                'render' => function ($value, Part $context) {
202
+                'render' => function($value, Part $context) {
203 203
                     $amount = $context->getAmountSum();
204 204
                     return $this->amountFormatter->format($amount, $context->getPartUnit());
205 205
                 }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             ->add('minamount', TextColumn::class, [
208 208
                 'label' => $this->translator->trans('part.table.minamount'),
209 209
                 'visible' => false,
210
-                'render' => function ($value, Part $context) {
210
+                'render' => function($value, Part $context) {
211 211
                     return $this->amountFormatter->format($value, $context->getPartUnit());
212 212
                 }
213 213
             ])
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                 },
272 272
                 'entity' => Part::class,
273 273
                 'criteria' => [
274
-                    function (QueryBuilder $builder) use ($options) {
274
+                    function(QueryBuilder $builder) use ($options) {
275 275
                         $this->buildCriteria($builder, $options);
276 276
                     },
277 277
                     new SearchCriteriaProvider()
Please login to merge, or discard this patch.