@@ -117,8 +117,8 @@ |
||
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 | } |
@@ -71,7 +71,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -43,16 +43,16 @@ |
||
43 | 43 | |
44 | 44 | $resolver->setDefaults([ |
45 | 45 | 'class' => PartLot::class, |
46 | - 'choice_label' => ChoiceList::label($this, function (PartLot $part_lot) { |
|
46 | + 'choice_label' => ChoiceList::label($this, function(PartLot $part_lot) { |
|
47 | 47 | return ($part_lot->getStorageLocation() ? $part_lot->getStorageLocation()->getFullPath() : '') |
48 | - . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount(); |
|
48 | + . ' ('.$part_lot->getName().'): '.$part_lot->getAmount(); |
|
49 | 49 | }), |
50 | 50 | 'attr' => [ |
51 | 51 | 'data-controller' => 'elements--selectpicker', |
52 | 52 | 'data-live-search' => true, |
53 | 53 | ], |
54 | - 'query_builder' => function (Options $options) { |
|
55 | - return function (EntityRepository $er) use ($options) { |
|
54 | + 'query_builder' => function(Options $options) { |
|
55 | + return function(EntityRepository $er) use ($options) { |
|
56 | 56 | return $er->createQueryBuilder('l') |
57 | 57 | ->where('l.part = :part') |
58 | 58 | ->setParameter('part', $options['part']); |
@@ -56,9 +56,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -32,7 +32,7 @@ |
||
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 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ], |
123 | 123 | 'choice_translation_domain' => false, |
124 | 124 | 'choices' => User::AVAILABLE_THEMES, |
125 | - 'choice_label' => static function ($entity, $key, $value) { |
|
125 | + 'choice_label' => static function($entity, $key, $value) { |
|
126 | 126 | return $value; |
127 | 127 | }, |
128 | 128 | 'placeholder' => 'user_settings.theme.placeholder', |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ->add('reset', ResetType::class, ['label' => 'reset']); |
140 | 140 | |
141 | 141 | //Add the remove_avatar button if the user has an avatar (we have to add this dynamically) |
142 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { |
|
142 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) { |
|
143 | 143 | $data = $event->getData(); |
144 | 144 | if (!$data instanceof User) { |
145 | 145 | return; |
@@ -79,7 +79,7 @@ |
||
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)) { |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | //When all options are false, we abort and show an error message |
66 | - if (! $backup_database && ! $backup_attachments && ! $backup_config) { |
|
66 | + if (!$backup_database && !$backup_attachments && !$backup_config) { |
|
67 | 67 | $io->error('You have to select at least one option what to backup! Use --full to backup everything.'); |
68 | 68 | |
69 | 69 | return Command::FAILURE; |