Passed
Push — master ( d9e25d...dc012b )
by Jan
05:48
created
src/Controller/AdminPages/BaseAdminController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -425,12 +425,12 @@
 block discarded – undo
425 425
             if ($entity instanceof AbstractStructuralDBElement && $request->get('delete_recursive', false)) {
426 426
                 $can_delete = true;
427 427
                 //Check if any of the children can not be deleted, cause it contains parts
428
-                $recursionHelper->execute($entity, function (AbstractStructuralDBElement $element) use (&$can_delete) {
429
-                    if(!$this->deleteCheck($element)) {
428
+                $recursionHelper->execute($entity, function(AbstractStructuralDBElement $element) use (&$can_delete) {
429
+                    if (!$this->deleteCheck($element)) {
430 430
                         $can_delete = false;
431 431
                     }
432 432
                 });
433
-                if($can_delete) {
433
+                if ($can_delete) {
434 434
                     $recursionHelper->delete($entity, false);
435 435
                 } else {
436 436
                     return $this->redirectToRoute($this->route_base.'_edit', ['id' => $entity->getID()]);
Please login to merge, or discard this patch.
src/Controller/TypeaheadController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
         foreach ($parts as $part) {
150 150
             //Determine the picture to show:
151 151
             $preview_attachment = $previewGenerator->getTablePreviewAttachment($part);
152
-            if($preview_attachment !== null) {
152
+            if ($preview_attachment !== null) {
153 153
                 $preview_url = $attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm');
154 154
             } else {
155 155
                 $preview_url = '';
Please login to merge, or discard this patch.
src/Controller/UserController.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
      *
84 84
      * @throws Exception
85 85
      */
86
-    public function edit(User $entity, Request $request, EntityManagerInterface $em,  PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response
86
+    public function edit(User $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response
87 87
     {
88 88
         //Do an upgrade of the permission schema if needed (so the user can see the permissions a user get on next request (even if it was not done yet)
89 89
         $permissionSchemaUpdater->userUpgradeSchemaRecursively($entity);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @Route("/{id}/clone", name="user_clone")
156 156
      * @Route("/")
157 157
      */
158
-    public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response
158
+    public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null) : Response
159 159
     {
160 160
         return $this->_new($request, $em, $importer, $entity);
161 161
     }
Please login to merge, or discard this patch.
src/Controller/PartController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
217 217
         AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper,
218
-        ?Part $part = null, ?Project $project = null): Response
218
+        ?Part $part = null, ?Project $project = null) : Response
219 219
     {
220 220
 
221 221
         if ($part) { //Clone part
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
      */
329 329
     public function withdrawAddHandler(Part $part, Request $request, EntityManagerInterface $em, PartLotWithdrawAddHelper $withdrawAddHelper): Response
330 330
     {
331
-        if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) {
331
+        if ($this->isCsrfTokenValid('part_withraw'.$part->getID(), $request->request->get('_csfr'))) {
332 332
             //Retrieve partlot from the request
333 333
             $partLot = $em->find(PartLot::class, $request->request->get('lot_id'));
334
-            if($partLot === null) {
334
+            if ($partLot === null) {
335 335
                 throw new \RuntimeException('Part lot not found!');
336 336
             }
337 337
             //Ensure that the partlot belongs to the part
338
-            if($partLot->getPart() !== $part) {
338
+            if ($partLot->getPart() !== $part) {
339 339
                 throw new \RuntimeException("The origin partlot does not belong to the part!");
340 340
             }
341 341
             //Try to determine the target lot (used for move actions)
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         }
379 379
 
380 380
         //If an redirect was passed, then redirect there
381
-        if($request->request->get('_redirect')) {
381
+        if ($request->request->get('_redirect')) {
382 382
             return $this->redirect($request->request->get('_redirect'));
383 383
         }
384 384
         //Otherwise just redirect to the part page
Please login to merge, or discard this patch.
src/Controller/ProjectController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response
79 79
     {
80
-        if($project) {
80
+        if ($project) {
81 81
             $this->denyAccessUnlessGranted('edit', $project);
82 82
         } else {
83 83
             $this->denyAccessUnlessGranted('@projects.edit');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
             $data = $form->getData();
130 130
             $bom_entries = $data['bom_entries'];
131
-            foreach ($bom_entries as $bom_entry){
131
+            foreach ($bom_entries as $bom_entry) {
132 132
                 $target_project->addBOMEntry($bom_entry);
133 133
             }
134 134
             $entityManager->flush();
Please login to merge, or discard this patch.
src/Controller/WebauthnKeyRegistrationController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
             //Retrieve other data from the form, that you want to store with the key
47 47
             $keyName = $request->request->get('keyName');
48 48
             if (empty($keyName)) {
49
-                $keyName = 'Key ' . date('Y-m-d H:i:s');
49
+                $keyName = 'Key '.date('Y-m-d H:i:s');
50 50
             }
51 51
 
52 52
             //Check the response
Please login to merge, or discard this patch.
src/Controller/PartListsController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
         $formRequest = clone $request;
130 130
         $formRequest->setMethod('GET');
131 131
         $filter = new PartFilter($this->nodesListBuilder);
132
-        if($filter_changer !== null){
132
+        if ($filter_changer !== null) {
133 133
             $filter_changer($filter);
134 134
         }
135 135
 
136 136
         $filterForm = $this->createForm(PartFilterType::class, $filter, ['method' => 'GET']);
137
-        if($form_changer !== null) {
137
+        if ($form_changer !== null) {
138 138
             $form_changer($filterForm);
139 139
         }
140 140
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 
165 165
         return $this->showListWithFilter($request,
166 166
             'Parts/lists/category_list.html.twig',
167
-            function (PartFilter $filter) use ($category) {
167
+            function(PartFilter $filter) use ($category) {
168 168
                 $filter->getCategory()->setOperator('INCLUDING_CHILDREN')->setValue($category);
169
-            }, function (FormInterface $filterForm) {
169
+            }, function(FormInterface $filterForm) {
170 170
                 $this->disableFormFieldAfterCreation($filterForm->get('category')->get('value'));
171 171
             }, [
172 172
                 'entity' => $category,
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 
187 187
         return $this->showListWithFilter($request,
188 188
             'Parts/lists/footprint_list.html.twig',
189
-            function (PartFilter $filter) use ($footprint) {
189
+            function(PartFilter $filter) use ($footprint) {
190 190
                 $filter->getFootprint()->setOperator('INCLUDING_CHILDREN')->setValue($footprint);
191
-            }, function (FormInterface $filterForm) {
191
+            }, function(FormInterface $filterForm) {
192 192
                 $this->disableFormFieldAfterCreation($filterForm->get('footprint')->get('value'));
193 193
             }, [
194 194
                 'entity' => $footprint,
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
         return $this->showListWithFilter($request,
210 210
             'Parts/lists/manufacturer_list.html.twig',
211
-            function (PartFilter $filter) use ($manufacturer) {
211
+            function(PartFilter $filter) use ($manufacturer) {
212 212
                 $filter->getManufacturer()->setOperator('INCLUDING_CHILDREN')->setValue($manufacturer);
213
-            }, function (FormInterface $filterForm) {
213
+            }, function(FormInterface $filterForm) {
214 214
                 $this->disableFormFieldAfterCreation($filterForm->get('manufacturer')->get('value'));
215 215
             }, [
216 216
                 'entity' => $manufacturer,
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 
231 231
         return $this->showListWithFilter($request,
232 232
             'Parts/lists/store_location_list.html.twig',
233
-            function (PartFilter $filter) use ($storelocation) {
233
+            function(PartFilter $filter) use ($storelocation) {
234 234
                 $filter->getStorelocation()->setOperator('INCLUDING_CHILDREN')->setValue($storelocation);
235
-            }, function (FormInterface $filterForm) {
235
+            }, function(FormInterface $filterForm) {
236 236
                 $this->disableFormFieldAfterCreation($filterForm->get('storelocation')->get('value'));
237 237
             }, [
238 238
                 'entity' => $storelocation,
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 
253 253
         return $this->showListWithFilter($request,
254 254
             'Parts/lists/supplier_list.html.twig',
255
-            function (PartFilter $filter) use ($supplier) {
255
+            function(PartFilter $filter) use ($supplier) {
256 256
                 $filter->getSupplier()->setOperator('INCLUDING_CHILDREN')->setValue($supplier);
257
-            }, function (FormInterface $filterForm) {
257
+            }, function(FormInterface $filterForm) {
258 258
                 $this->disableFormFieldAfterCreation($filterForm->get('supplier')->get('value'));
259 259
             }, [
260 260
                 'entity' => $supplier,
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 
275 275
         return $this->showListWithFilter($request,
276 276
             'Parts/lists/tags_list.html.twig',
277
-            function (PartFilter $filter) use ($tag) {
277
+            function(PartFilter $filter) use ($tag) {
278 278
                 $filter->getTags()->setOperator('ANY')->setValue($tag);
279
-            }, function (FormInterface $filterForm) {
279
+            }, function(FormInterface $filterForm) {
280 280
                 $this->disableFormFieldAfterCreation($filterForm->get('tags')->get('value'));
281 281
             }, [
282 282
                 'tag' => $tag,
@@ -334,6 +334,6 @@  discard block
 block discarded – undo
334 334
      */
335 335
     public function showAll(Request $request, DataTableFactory $dataTable)
336 336
     {
337
-        return $this->showListWithFilter($request,'Parts/lists/all_list.html.twig');
337
+        return $this->showListWithFilter($request, 'Parts/lists/all_list.html.twig');
338 338
     }
339 339
 }
Please login to merge, or discard this patch.
src/Services/UserSystem/PermissionManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     public function dontInherit(HasPermissionsInterface $user, string $permission, string $operation): ?bool
79 79
     {
80 80
         //Check that the permission/operation combination is valid
81
-        if (! $this->isValidOperation($permission, $operation)) {
81
+        if (!$this->isValidOperation($permission, $operation)) {
82 82
             throw new InvalidArgumentException('The permission/operation combination "'.$permission.'/'.$operation.'" is not valid!');
83 83
         }
84 84
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         $perm_list = $user->getPermissions();
141 141
 
142 142
         //Check if the permission/operation combination is valid
143
-        if (! $this->isValidOperation($permission, $operation)) {
143
+        if (!$this->isValidOperation($permission, $operation)) {
144 144
             throw new InvalidArgumentException(sprintf('The permission/operation combination "%s.%s" is not valid!', $permission, $operation));
145 145
         }
146 146
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                     }
234 234
                 }
235 235
             }
236
-        } while($anything_changed);
236
+        } while ($anything_changed);
237 237
     }
238 238
 
239 239
     /**
Please login to merge, or discard this patch.
src/Services/UserSystem/PermissionPresetsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         //We need to reset the permission data first (afterwards all values are inherit)
52 52
         $perm_holder->getPermissions()->resetPermissions();
53 53
 
54
-        switch($preset_name) {
54
+        switch ($preset_name) {
55 55
             case self::PRESET_ALL_INHERIT:
56 56
                 //Do nothing, all values are inherit after reset
57 57
                 break;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
         //Labels permissions (allow all except use twig)
120 120
         $this->permissionResolver->setAllOperationsOfPermission($permHolder, 'labels', PermissionData::ALLOW);
121
-        $this->permissionResolver->setPermission($permHolder,'labels', 'use_twig', PermissionData::INHERIT);
121
+        $this->permissionResolver->setPermission($permHolder, 'labels', 'use_twig', PermissionData::INHERIT);
122 122
 
123 123
         //Self permissions
124 124
         $this->permissionResolver->setPermission($permHolder, 'self', 'edit_infos', PermissionData::ALLOW);
Please login to merge, or discard this patch.