@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | protected function configureOptions(OptionsResolver $resolver) |
| 53 | 53 | { |
| 54 | 54 | $resolver->setDefaults([ |
| 55 | - 'show_prefix' => function (Options $options) { |
|
| 55 | + 'show_prefix' => function(Options $options) { |
|
| 56 | 56 | if ($options['measurement_unit'] !== null) { |
| 57 | 57 | /** @var MeasurementUnit $unit */ |
| 58 | 58 | $unit = $options['measurement_unit']; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | return true; |
| 62 | 62 | }, |
| 63 | - 'is_integer' => function (Options $options) { |
|
| 63 | + 'is_integer' => function(Options $options) { |
|
| 64 | 64 | if ($options['measurement_unit'] !== null) { |
| 65 | 65 | /** @var MeasurementUnit $unit */ |
| 66 | 66 | $unit = $options['measurement_unit']; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | return true; |
| 70 | 70 | }, |
| 71 | - 'unit' => function (Options $options) { |
|
| 71 | + 'unit' => function(Options $options) { |
|
| 72 | 72 | if ($options['measurement_unit'] !== null) { |
| 73 | 73 | /** @var MeasurementUnit $unit */ |
| 74 | 74 | $unit = $options['measurement_unit']; |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | return ''; |
| 78 | 78 | }, |
| 79 | 79 | 'decimals' => 2, |
| 80 | - 'error_mapping' => [ '.' => 'value'] |
|
| 80 | + 'error_mapping' => ['.' => 'value'] |
|
| 81 | 81 | ]); |
| 82 | 82 | |
| 83 | 83 | $resolver->setAllowedTypes('decimals', 'int'); |
| 84 | 84 | |
| 85 | - $resolver->setNormalizer('decimals', function (Options $options, $value) { |
|
| 85 | + $resolver->setNormalizer('decimals', function(Options $options, $value) { |
|
| 86 | 86 | // If the unit is integer based, then dont show any decimals |
| 87 | 87 | if ($options['is_integer']) { |
| 88 | 88 | return 0; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //Otherwise just output it |
| 128 | - $format_string = '%.' . $options['decimals'] . 'f ' . $options['unit']; |
|
| 128 | + $format_string = '%.'.$options['decimals'].'f '.$options['unit']; |
|
| 129 | 129 | return sprintf($format_string, $value); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $resolver->setDefaults([ |
| 60 | 60 | 'measurement_unit' => null, |
| 61 | - 'show_prefix' => function (Options $options) { |
|
| 61 | + 'show_prefix' => function(Options $options) { |
|
| 62 | 62 | if ($options['measurement_unit'] !== null) { |
| 63 | 63 | /** @var MeasurementUnit $unit */ |
| 64 | 64 | $unit = $options['measurement_unit']; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | return false; |
| 68 | 68 | }, |
| 69 | - 'is_integer' => function (Options $options) { |
|
| 69 | + 'is_integer' => function(Options $options) { |
|
| 70 | 70 | if ($options['measurement_unit'] !== null) { |
| 71 | 71 | /** @var MeasurementUnit $unit */ |
| 72 | 72 | $unit = $options['measurement_unit']; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | return false; |
| 76 | 76 | }, |
| 77 | - 'unit' => function (Options $options) { |
|
| 77 | + 'unit' => function(Options $options) { |
|
| 78 | 78 | if ($options['measurement_unit'] !== null) { |
| 79 | 79 | /** @var MeasurementUnit $unit */ |
| 80 | 80 | $unit = $options['measurement_unit']; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | return null; |
| 84 | 84 | }, |
| 85 | - 'error_mapping' => [ '.' => 'value'] |
|
| 85 | + 'error_mapping' => ['.' => 'value'] |
|
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | $resolver->setAllowedTypes('measurement_unit', [MeasurementUnit::class, 'null']); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $resolver->setDefaults([ |
| 93 | 93 | 'min' => 0, |
| 94 | 94 | 'max' => '', |
| 95 | - 'step' => function (Options $options) { |
|
| 95 | + 'step' => function(Options $options) { |
|
| 96 | 96 | if ($options['is_integer'] === true) { |
| 97 | 97 | return 1; |
| 98 | 98 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if ($options['show_prefix']) { |
| 119 | 119 | $builder->add('prefix', ChoiceType::class, [ |
| 120 | - 'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6 ] |
|
| 120 | + 'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6] |
|
| 121 | 121 | ]); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if ($fs->isAbsolutePath($tmp_base_path)) { |
| 58 | 58 | $this->base_path = $tmp_base_path; |
| 59 | 59 | } else { |
| 60 | - $this->base_path = realpath($kernel->getProjectDir() . DIRECTORY_SEPARATOR . $tmp_base_path); |
|
| 60 | + $this->base_path = realpath($kernel->getProjectDir().DIRECTORY_SEPARATOR.$tmp_base_path); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $sz = 'BKMGTP'; |
| 161 | 161 | $factor = (int) floor((strlen($bytes) - 1) / 3); |
| 162 | - return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor]; |
|
| 162 | + return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor).@$sz[$factor]; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $mapping = [PartAttachment::class => 'part']; |
| 173 | 173 | |
| 174 | - $path = $this->base_path . DIRECTORY_SEPARATOR . $mapping[get_class($attachment)] . DIRECTORY_SEPARATOR . $attachment->getElement()->getID(); |
|
| 174 | + $path = $this->base_path.DIRECTORY_SEPARATOR.$mapping[get_class($attachment)].DIRECTORY_SEPARATOR.$attachment->getElement()->getID(); |
|
| 175 | 175 | return $path; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -193,17 +193,17 @@ discard block |
||
| 193 | 193 | //Sanatize filename |
| 194 | 194 | $originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME); |
| 195 | 195 | $safeFilename = transliterator_transliterate('Any-Latin; Latin-ASCII; [^A-Za-z0-9_] remove; Lower()', $originalFilename); |
| 196 | - $newFilename = $safeFilename . '.' . $file->getClientOriginalExtension(); |
|
| 196 | + $newFilename = $safeFilename.'.'.$file->getClientOriginalExtension(); |
|
| 197 | 197 | |
| 198 | 198 | //If a file with this name is already existing add a number to the filename |
| 199 | - if (file_exists($folder . DIRECTORY_SEPARATOR . $newFilename)) { |
|
| 199 | + if (file_exists($folder.DIRECTORY_SEPARATOR.$newFilename)) { |
|
| 200 | 200 | $bak = $newFilename; |
| 201 | 201 | |
| 202 | 202 | $number = 1; |
| 203 | - $newFilename = $folder . DIRECTORY_SEPARATOR . $safeFilename . '-' . $number . '.' . $file->getClientOriginalExtension(); |
|
| 203 | + $newFilename = $folder.DIRECTORY_SEPARATOR.$safeFilename.'-'.$number.'.'.$file->getClientOriginalExtension(); |
|
| 204 | 204 | while (file_exists($newFilename)) { |
| 205 | 205 | $number++; |
| 206 | - $newFilename = $folder . DIRECTORY_SEPARATOR . $safeFilename . '-' . $number . '.' . $file->getClientOriginalExtension(); |
|
| 206 | + $newFilename = $folder.DIRECTORY_SEPARATOR.$safeFilename.'-'.$number.'.'.$file->getClientOriginalExtension(); |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $io = new SymfonyStyle($input, $output); |
| 47 | 47 | |
| 48 | 48 | $mediaPath = $this->attachment_helper->getMediaPath(); |
| 49 | - $io->note("The media path is " . $mediaPath); |
|
| 49 | + $io->note("The media path is ".$mediaPath); |
|
| 50 | 50 | |
| 51 | 51 | $finder = new Finder(); |
| 52 | 52 | //We look for files in the media folder only |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function removeEmptySubFolders($path) |
| 105 | 105 | { |
| 106 | - $empty=true; |
|
| 107 | - foreach (glob($path . DIRECTORY_SEPARATOR . "*") as $file) |
|
| 106 | + $empty = true; |
|
| 107 | + foreach (glob($path.DIRECTORY_SEPARATOR."*") as $file) |
|
| 108 | 108 | { |
| 109 | 109 | $empty &= is_dir($file) && $this->removeEmptySubFolders($file); |
| 110 | 110 | } |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | //Add pricedetails after we know the data, so we can set the default currency |
| 82 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options) { |
|
| 82 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($options) { |
|
| 83 | 83 | /** @var Orderdetail $orderdetail */ |
| 84 | 84 | $orderdetail = $event->getData(); |
| 85 | 85 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | // This options allows you to override the currency shown for the null value |
| 63 | 63 | $resolver->setDefault('base_currency', null); |
| 64 | 64 | |
| 65 | - $resolver->setDefault('empty_message', function (Options $options) { |
|
| 65 | + $resolver->setDefault('empty_message', function(Options $options) { |
|
| 66 | 66 | //By default we use the global base currency: |
| 67 | 67 | $iso_code = $this->base_currency; |
| 68 | 68 | |
@@ -74,9 +74,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -188,7 +188,6 @@ |
||
| 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 | { |
@@ -356,6 +356,6 @@ |
||
| 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 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 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 |
||
| 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 | |