Passed
Push — master ( 3c79d9...4ed25f )
by Jan
07:02
created
src/Command/User/UsersPermissionsCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
         $inherit = !$input->getOption('noInherit') && !$edit_mode; //Show the non inherited perms in edit mode
72 72
 
73 73
         //Find user
74
-        $io->note('Finding user with username: ' . $username);
74
+        $io->note('Finding user with username: '.$username);
75 75
         $user = $this->userRepository->findByEmailOrName($username);
76 76
         if ($user === null) {
77
-            $io->error('No user found with username: ' . $username);
77
+            $io->error('No user found with username: '.$username);
78 78
             return Command::FAILURE;
79 79
         }
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
         $edit_mapping = $this->renderPermissionTable($output, $user, $inherit);
84 84
 
85
-        while($edit_mode) {
85
+        while ($edit_mode) {
86 86
             $index_to_edit = $io->ask('Which permission do you want to edit? Enter the index (e.g. 2-4) to edit, * for all permissions or "q" to quit', 'q');
87 87
             if ($index_to_edit === 'q') {
88 88
                 break;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 $io->warning('You are about to edit all permissions. This will overwrite all permissions!');
98 98
             } else {
99 99
                 [$perm_to_edit, $op_to_edit] = $edit_mapping[$index_to_edit];
100
-                $io->note('Editing permission ' . $perm_to_edit . ' with operation <options=bold>' . $op_to_edit);
100
+                $io->note('Editing permission '.$perm_to_edit.' with operation <options=bold>'.$op_to_edit);
101 101
             }
102 102
 
103 103
 
Please login to merge, or discard this patch.
src/Command/VersionCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,19 +52,19 @@
 block discarded – undo
52 52
     {
53 53
         $io = new SymfonyStyle($input, $output);
54 54
 
55
-        $message = 'Part-DB version: '. $this->versionManager->getVersion()->toString();
55
+        $message = 'Part-DB version: '.$this->versionManager->getVersion()->toString();
56 56
 
57 57
         if ($this->gitVersionInfo->getGitBranchName() !== null) {
58
-            $message .= ' Git branch: '. $this->gitVersionInfo->getGitBranchName();
59
-            $message .= ', Git commit: '. $this->gitVersionInfo->getGitCommitHash();
58
+            $message .= ' Git branch: '.$this->gitVersionInfo->getGitBranchName();
59
+            $message .= ', Git commit: '.$this->gitVersionInfo->getGitCommitHash();
60 60
         }
61 61
 
62 62
         $io->success($message);
63 63
 
64 64
         $io->info('PHP version: '.PHP_VERSION);
65
-        $io->info('Symfony version: ' . $this->getApplication()->getVersion());
66
-        $io->info('OS: '. php_uname());
67
-        $io->info('PHP extension: '. implode(', ', get_loaded_extensions()));
65
+        $io->info('Symfony version: '.$this->getApplication()->getVersion());
66
+        $io->info('OS: '.php_uname());
67
+        $io->info('PHP extension: '.implode(', ', get_loaded_extensions()));
68 68
 
69 69
         return 0;
70 70
     }
Please login to merge, or discard this patch.
src/Command/CheckRequirementsCommand.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         //Check PHP versions
72 72
         $io->isVerbose() && $io->comment('Checking PHP version...');
73 73
         if (PHP_VERSION_ID < 80100) {
74
-            $io->warning('You are using PHP '. PHP_VERSION .'. This will work, but a newer version is recommended.');
74
+            $io->warning('You are using PHP '.PHP_VERSION.'. This will work, but a newer version is recommended.');
75 75
         } else {
76 76
             !$only_issues && $io->success('PHP version is sufficient.');
77 77
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         //Check if APP_ENV is set to prod
100 100
         $io->isVerbose() && $io->comment('Checking debug mode...');
101
-        if($this->params->get('kernel.debug')) {
101
+        if ($this->params->get('kernel.debug')) {
102 102
             $io->warning('You have activated debug mode, this is will leak informations in a production environment.');
103 103
         } else {
104 104
             !$only_issues && $io->success('Debug mode disabled.');
@@ -110,36 +110,36 @@  discard block
 block discarded – undo
110 110
     {
111 111
         //Get all installed PHP extensions
112 112
         $extensions = get_loaded_extensions();
113
-        $io->isVerbose() && $io->comment('Your PHP installation has '. count($extensions) .' extensions installed: '. implode(', ', $extensions));
113
+        $io->isVerbose() && $io->comment('Your PHP installation has '.count($extensions).' extensions installed: '.implode(', ', $extensions));
114 114
 
115 115
         $db_drivers_count = 0;
116
-        if(!in_array('pdo_mysql', $extensions)) {
116
+        if (!in_array('pdo_mysql', $extensions)) {
117 117
             $io->error('pdo_mysql is not installed. You will not be able to use MySQL databases.');
118 118
         } else {
119 119
             !$only_issues && $io->success('PHP extension pdo_mysql is installed.');
120 120
             $db_drivers_count++;
121 121
         }
122 122
 
123
-        if(!in_array('pdo_sqlite', $extensions)) {
123
+        if (!in_array('pdo_sqlite', $extensions)) {
124 124
             $io->error('pdo_sqlite is not installed. You will not be able to use SQLite. databases');
125 125
         } else {
126 126
             !$only_issues && $io->success('PHP extension pdo_sqlite is installed.');
127 127
             $db_drivers_count++;
128 128
         }
129 129
 
130
-        $io->isVerbose() && $io->comment('You have '. $db_drivers_count .' database drivers installed.');
130
+        $io->isVerbose() && $io->comment('You have '.$db_drivers_count.' database drivers installed.');
131 131
         if ($db_drivers_count === 0) {
132 132
             $io->error('You have no database drivers installed. You have to install at least one database driver!');
133 133
         }
134 134
 
135
-        if(!in_array('curl', $extensions)) {
135
+        if (!in_array('curl', $extensions)) {
136 136
             $io->warning('curl extension is not installed. Install curl extension for better performance');
137 137
         } else {
138 138
             !$only_issues && $io->success('PHP extension curl is installed.');
139 139
         }
140 140
 
141 141
         $gd_installed = in_array('gd', $extensions);
142
-        if(!$gd_installed) {
142
+        if (!$gd_installed) {
143 143
             $io->error('GD is not installed. GD is required for image processing.');
144 144
         } else {
145 145
             !$only_issues && $io->success('PHP extension GD is installed.');
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
         $io->isVerbose() && $io->comment('Checking if GD has jpeg support...');
150 150
         if ($gd_installed) {
151 151
             $gd_info = gd_info();
152
-            if($gd_info['JPEG Support'] === false) {
152
+            if ($gd_info['JPEG Support'] === false) {
153 153
                 $io->warning('Your GD does not have jpeg support. You will not be able to generate thumbnails of jpeg images.');
154 154
             } else {
155 155
                 !$only_issues && $io->success('GD has jpeg support.');
156 156
             }
157 157
 
158
-            if($gd_info['PNG Support'] === false) {
158
+            if ($gd_info['PNG Support'] === false) {
159 159
                 $io->warning('Your GD does not have png support. You will not be able to generate thumbnails of png images.');
160 160
             } else {
161 161
                 !$only_issues && $io->success('GD has png support.');
162 162
             }
163 163
 
164
-            if($gd_info['WebP Support'] === false) {
164
+            if ($gd_info['WebP Support'] === false) {
165 165
                 $io->warning('Your GD does not have WebP support. You will not be able to generate thumbnails of WebP images.');
166 166
             } else {
167 167
                 !$only_issues && $io->success('GD has WebP support.');
Please login to merge, or discard this patch.
src/Services/Parts/PartsTableActionHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
             if ($action === 'generate_label') {
87 87
                 $targets = implode(',', array_map(static fn (Part $part) => $part->getID(), $selected_parts));
88 88
             } else { //For lots we have to extract the part lots
89
-                $targets = implode(',', array_map(static function (Part $part) {
89
+                $targets = implode(',', array_map(static function(Part $part) {
90 90
                     //We concat the lot IDs of every part with a comma (which are later concated with a comma too per part)
91 91
                     return implode(',', array_map(static fn (PartLot $lot) => $lot->getID(), $part->getPartLots()->toArray()));
92 92
                 }, $selected_parts));
Please login to merge, or discard this patch.
src/Twig/FormatExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@
 block discarded – undo
117 117
      */
118 118
     public function formatBytes(int $bytes, int $precision = 2): string
119 119
     {
120
-        $size = ['B','kB','MB','GB','TB','PB','EB','ZB','YB'];
120
+        $size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
121 121
         $factor = floor((strlen((string) $bytes) - 1) / 3);
122
-        return sprintf("%.{$precision}f", $bytes / pow(1024, $factor)) . ' ' . @$size[$factor];
122
+        return sprintf("%.{$precision}f", $bytes / pow(1024, $factor)).' '.@$size[$factor];
123 123
     }
124 124
 }
Please login to merge, or discard this patch.
src/Form/ProjectSystem/ProjectBuildType.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
         //The form is initially empty, we have to define the fields after we know the data
74
-        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) {
74
+        $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) {
75 75
             $form = $event->getForm();
76 76
             /** @var ProjectBuildRequest $build_request */
77 77
             $build_request = $event->getData();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             foreach ($build_request->getPartBomEntries() as $bomEntry) {
95 95
                 //Every part lot has a field to specify the number of parts to take from this lot
96 96
                 foreach ($build_request->getPartLotsForBOMEntry($bomEntry) as $lot) {
97
-                    $form->add('lot_' . $lot->getID(), SIUnitType::class, [
97
+                    $form->add('lot_'.$lot->getID(), SIUnitType::class, [
98 98
                         'label' => false,
99 99
                         'measurement_unit' => $bomEntry->getPart()->getPartUnit(),
100 100
                         'max' => min($build_request->getNeededAmountForBOMEntry($bomEntry), $lot->getAmount()),
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     public function mapDataToForms($data, \Traversable $forms)
110 110
     {
111 111
         if (!$data instanceof ProjectBuildRequest) {
112
-            throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class);
112
+            throw new \RuntimeException('Data must be an instance of '.ProjectBuildRequest::class);
113 113
         }
114 114
 
115 115
         /** @var FormInterface[] $forms */
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     public function mapFormsToData(\Traversable $forms, &$data)
135 135
     {
136 136
         if (!$data instanceof ProjectBuildRequest) {
137
-            throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class);
137
+            throw new \RuntimeException('Data must be an instance of '.ProjectBuildRequest::class);
138 138
         }
139 139
 
140 140
         /** @var FormInterface[] $forms */
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
             $lot = $forms['buildsPartLot']->getData();
155 155
             if (!$lot) { //When the user selected "Create new lot", create a new lot
156 156
                 $lot = new PartLot();
157
-                $description = 'Build ' . date('Y-m-d H:i:s');
157
+                $description = 'Build '.date('Y-m-d H:i:s');
158 158
                 if (!empty($data->getComment())) {
159
-                    $description .= ' (' . $data->getComment() . ')';
159
+                    $description .= ' ('.$data->getComment().')';
160 160
                 }
161 161
                 $lot->setDescription($description);
162 162
 
Please login to merge, or discard this patch.
src/Helpers/Projects/ProjectBuildRequest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
         $this->initializeArray();
57 57
 
58 58
         //By default, use the first available lot of builds part if there is one.
59
-        if($project->getBuildPart() !== null) {
59
+        if ($project->getBuildPart() !== null) {
60 60
             $this->add_build_to_builds_part = true;
61
-            foreach( $project->getBuildPart()->getPartLots() as $lot) {
61
+            foreach ($project->getBuildPart()->getPartLots() as $lot) {
62 62
                 if (!$lot->isInstockUnknown()) {
63 63
                     $this->builds_lot = $lot;
64 64
                     break;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         //Now create an array for each BOM entry
76 76
         foreach ($this->getPartBomEntries() as $bom_entry) {
77 77
             $remaining_amount = $this->getNeededAmountForBOMEntry($bom_entry);
78
-            foreach($this->getPartLotsForBOMEntry($bom_entry) as $lot) {
78
+            foreach ($this->getPartLotsForBOMEntry($bom_entry) as $lot) {
79 79
                 //If the lot has instock use it for the build
80 80
                 $this->withdraw_amounts[$lot->getID()] = min($remaining_amount, $lot->getAmount());
81 81
                 $remaining_amount -= max(0, $this->withdraw_amounts[$lot->getID()]);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             throw new \InvalidArgumentException('The given lot must be an instance of PartLot or an ID of a PartLot!');
185 185
         }
186 186
 
187
-        if (! array_key_exists($lot_id, $this->withdraw_amounts)) {
187
+        if (!array_key_exists($lot_id, $this->withdraw_amounts)) {
188 188
             throw new \InvalidArgumentException('The given lot is not in the withdraw amounts array!');
189 189
         }
190 190
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function getPartBomEntries(): array
279 279
     {
280
-        return $this->project->getBomEntries()->filter(function (ProjectBOMEntry $entry) {
280
+        return $this->project->getBomEntries()->filter(function(ProjectBOMEntry $entry) {
281 281
             return $entry->isPartBomEntry();
282 282
         })->toArray();
283 283
     }
Please login to merge, or discard this patch.
Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     private function buildViolationForLot(PartLot $partLot, string $message): ConstraintViolationBuilderInterface
33 33
     {
34 34
         return $this->context->buildViolation($message)
35
-            ->atPath('lot_' . $partLot->getID())
35
+            ->atPath('lot_'.$partLot->getID())
36 36
             ->setParameter('{{ lot }}', $partLot->getName());
37 37
     }
38 38
 
Please login to merge, or discard this patch.
src/Services/ImportExportSystem/EntityImporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
         foreach ($names as $name) {
81 81
             //Count intendation level (whitespace characters at the beginning of the line)
82
-            $identSize = strlen($name)-strlen(ltrim($name));
82
+            $identSize = strlen($name) - strlen(ltrim($name));
83 83
 
84 84
             //If the line is intendet more than the last line, we have a new parent element
85 85
             if ($identSize > end($indentations)) {
Please login to merge, or discard this patch.