@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function getPrefixByMagnitude(int $magnitude) : array |
57 | 57 | { |
58 | - $prefixes_pos = ['' ,'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; |
|
59 | - $prefixes_neg = ['' ,'m', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; |
|
58 | + $prefixes_pos = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; |
|
59 | + $prefixes_neg = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; |
|
60 | 60 | |
61 | 61 | //Determine nearest prefix index. |
62 | 62 | $nearest = (int) round(abs($magnitude) / 3); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | [$divisor, $symbol] = $this->getPrefixByMagnitude($this->getMagnitude($value)); |
86 | 86 | $value /= $divisor; |
87 | 87 | //Build the format string, e.g.: %.2d km |
88 | - $format_string = '%.' . $decimals . 'f ' . $symbol . $unit; |
|
88 | + $format_string = '%.'.$decimals.'f '.$symbol.$unit; |
|
89 | 89 | |
90 | 90 | return sprintf($format_string, $value); |
91 | 91 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function getIDString(): string |
276 | 276 | { |
277 | - return 'P' . sprintf('%06d', $this->getID()); |
|
277 | + return 'P'.sprintf('%06d', $this->getID()); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /********************************************************************************* |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | { |
702 | 702 | //TODO: Find a method to do this natively in SQL, the current method could be a bit slow |
703 | 703 | $sum = 0; |
704 | - foreach($this->getPartLots() as $lot) { |
|
704 | + foreach ($this->getPartLots() as $lot) { |
|
705 | 705 | //Dont use the instock value, if it is unkown |
706 | 706 | if ($lot->isInstockUnknown()) { |
707 | 707 | continue; |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $sum += $lot->getAmount(); |
711 | 711 | } |
712 | 712 | |
713 | - if(!$this->useFloatAmount()) { |
|
713 | + if (!$this->useFloatAmount()) { |
|
714 | 714 | return $sum; |
715 | 715 | } |
716 | 716 |
@@ -30,15 +30,15 @@ |
||
30 | 30 | |
31 | 31 | /** Migrate the part locations for parts with known instock */ |
32 | 32 | $this->addSql( |
33 | - 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' . |
|
34 | - 'SELECT parts.id, parts.id_storelocation, parts.instock, 0, NOW(), NOW() FROM parts ' . |
|
33 | + 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) '. |
|
34 | + 'SELECT parts.id, parts.id_storelocation, parts.instock, 0, NOW(), NOW() FROM parts '. |
|
35 | 35 | 'WHERE parts.instock >= 0 AND parts.id_storelocation IS NOT NULL' |
36 | 36 | ); |
37 | 37 | |
38 | 38 | //Migrate part locations for parts with unknown instock |
39 | 39 | $this->addSql( |
40 | - 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' . |
|
41 | - 'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts ' . |
|
40 | + 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) '. |
|
41 | + 'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts '. |
|
42 | 42 | 'WHERE parts.instock = -2 AND parts.id_storelocation IS NOT NULL' |
43 | 43 | ); |
44 | 44 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getIDString(): string |
117 | 117 | { |
118 | - return 'PL' . $this->getID(); |
|
118 | + return 'PL'.$this->getID(); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | public function setAmount(float $new_amount): PartLot |
270 | 270 | { |
271 | - $this->amount = $new_amount; |
|
271 | + $this->amount = $new_amount; |
|
272 | 272 | return $this; |
273 | 273 | } |
274 | 274 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $part = $options['data']; |
70 | 70 | |
71 | 71 | //Select the amount value type based on the |
72 | - if($part->useFloatAmount()) { |
|
72 | + if ($part->useFloatAmount()) { |
|
73 | 73 | $amount_class = NumberType::class; |
74 | 74 | } else { |
75 | 75 | $amount_class = IntegerType::class; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->add('description', CKEditorType::class, ['required' => false, 'empty_data' => '', |
85 | 85 | 'label' => 'description.label', 'help' => 'bbcode.hint', 'config_name' => 'description_config', |
86 | 86 | 'attr' => ['placeholder' => 'part.description.placeholder', 'rows' => 2], |
87 | - 'disabled' => !$this->security->isGranted('description.edit', $part), 'empty_data' => '' ]) |
|
87 | + 'disabled' => !$this->security->isGranted('description.edit', $part), 'empty_data' => '']) |
|
88 | 88 | ->add('partUnit', StructuralEntityType::class, ['class'=> MeasurementUnit::class, |
89 | 89 | 'required' => false, 'disable_not_selectable' => true, 'label' => 'part.partUnit']) |
90 | 90 | ->add('minAmount', $amount_class, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'disabled' => !$this->security->isGranted('move', $part), ]) |
99 | 99 | ->add('tags', TextType::class, ['required' => false, 'label' => 'part.tags', 'empty_data' => "", |
100 | 100 | 'attr' => ['data-role' => 'tagsinput'], |
101 | - 'disabled' => !$this->security->isGranted('edit', $part) ]) |
|
101 | + 'disabled' => !$this->security->isGranted('edit', $part)]) |
|
102 | 102 | ->add('comment', CKEditorType::class, ['required' => false, |
103 | 103 | 'label' => 'comment.label', 'attr' => ['rows' => 4], 'help' => 'bbcode.hint', |
104 | 104 | 'disabled' => !$this->security->isGranted('comment.edit', $part), 'empty_data' => '']); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | |
79 | 79 | /* If any group change, then invalidate all cached trees. Users Permissions can be inherited from groups, |
80 | 80 | so a change in any group can cause big permisssion changes for users. So to be sure, invalidate all trees */ |
81 | - if($element instanceof Group) { |
|
81 | + if ($element instanceof Group) { |
|
82 | 82 | $tag = "groups"; |
83 | 83 | $this->cache->invalidateTags([$tag]); |
84 | 84 | } |
@@ -64,10 +64,10 @@ |
||
64 | 64 | //If the user is null, then treat it as anonymous user. |
65 | 65 | //When the anonymous user is passed as user then use this path too. |
66 | 66 | if ($user === null || $user->getID() === User::ID_ANONYMOUS) { |
67 | - return 'user$_' . User::ID_ANONYMOUS; |
|
67 | + return 'user$_'.User::ID_ANONYMOUS; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | //In the most cases we can just use the username (its unique) |
71 | - return "user_" . $user->getUsername(); |
|
71 | + return "user_".$user->getUsername(); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | \ No newline at end of file |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $tree_node = new TreeViewNode($element->__toString(), $href, $children_nodes); |
104 | 104 | |
105 | - if($children_nodes != null) { |
|
105 | + if ($children_nodes != null) { |
|
106 | 106 | $tree_node->addTag((string) count($children_nodes)); |
107 | 107 | } |
108 | 108 | |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | $parent_id = $parent != null ? $parent->getID() : "0"; |
178 | 178 | // Backslashes are not allowed in cache keys |
179 | 179 | $secure_class_name = str_replace("\\", '_', $class_name); |
180 | - $key = "list_" . $this->keyGenerator->generateKey() . "_" . $secure_class_name . $parent_id; |
|
180 | + $key = "list_".$this->keyGenerator->generateKey()."_".$secure_class_name.$parent_id; |
|
181 | 181 | |
182 | - $ret = $this->cache->get($key, function (ItemInterface $item) use ($class_name, $parent, $secure_class_name) { |
|
182 | + $ret = $this->cache->get($key, function(ItemInterface $item) use ($class_name, $parent, $secure_class_name) { |
|
183 | 183 | // Invalidate when groups, a element with the class or the user changes |
184 | 184 | $item->tag(['groups', 'tree_list', $this->keyGenerator->generateKey(), $secure_class_name]); |
185 | 185 | /** |
@@ -66,9 +66,9 @@ |
||
66 | 66 | */ |
67 | 67 | public function getTree() : array |
68 | 68 | { |
69 | - $key = "tree_tools_" . $this->keyGenerator->generateKey(); |
|
69 | + $key = "tree_tools_".$this->keyGenerator->generateKey(); |
|
70 | 70 | |
71 | - return $this->cache->get($key, function (ItemInterface $item) { |
|
71 | + return $this->cache->get($key, function(ItemInterface $item) { |
|
72 | 72 | //Invalidate tree, whenever group or the user changes |
73 | 73 | $item->tag(["tree_tools", "groups", $this->keyGenerator->generateKey()]); |
74 | 74 |