@@ -56,7 +56,7 @@ |
||
56 | 56 | */ |
57 | 57 | protected function supports($attribute, $subject) |
58 | 58 | { |
59 | - if(is_object($subject)) { |
|
59 | + if (is_object($subject)) { |
|
60 | 60 | $permission_name = $this->instanceToPermissionName($subject); |
61 | 61 | //If permission name is null, then the subject is not supported |
62 | 62 | return ($permission_name !== null) && $this->resolver->isValidOperation($permission_name, $attribute); |
@@ -81,13 +81,13 @@ |
||
81 | 81 | { |
82 | 82 | parent::configureOptions($resolver); |
83 | 83 | |
84 | - $resolver->setDefault('group_name', function (Options $options) { |
|
84 | + $resolver->setDefault('group_name', function(Options $options) { |
|
85 | 85 | return trim($options['name']); |
86 | 86 | }); |
87 | 87 | |
88 | 88 | $resolver->setDefault('inherit', false); |
89 | 89 | |
90 | - $resolver->setDefault('label', function (Options $options) { |
|
90 | + $resolver->setDefault('label', function(Options $options) { |
|
91 | 91 | if (!empty($this->perm_structure['groups'][$options['group_name']]['label'])) { |
92 | 92 | return $this->perm_structure['groups'][$options['group_name']]['label']; |
93 | 93 | } |
@@ -71,12 +71,12 @@ |
||
71 | 71 | |
72 | 72 | $resolver->setRequired('property'); |
73 | 73 | |
74 | - $resolver->setDefault('field', function (Options $option) { |
|
75 | - return $option['property'] . '.name'; |
|
74 | + $resolver->setDefault('field', function(Options $option) { |
|
75 | + return $option['property'].'.name'; |
|
76 | 76 | }); |
77 | 77 | |
78 | - $resolver->setDefault('render', function (Options $options) { |
|
79 | - return function ($value, Part $context) use ($options) { |
|
78 | + $resolver->setDefault('render', function(Options $options) { |
|
79 | + return function($value, Part $context) use ($options) { |
|
80 | 80 | /** @var DBElement $entity */ |
81 | 81 | $entity = $this->accessor->getValue($context, $options['property']); |
82 | 82 |
@@ -138,7 +138,7 @@ |
||
138 | 138 | */ |
139 | 139 | public function getIDString(): string |
140 | 140 | { |
141 | - return 'P' . sprintf('%06d', $this->getID()); |
|
141 | + return 'P'.sprintf('%06d', $this->getID()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -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 false; |
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,9 +125,9 @@ discard block |
||
125 | 125 | |
126 | 126 | //Otherwise just output it |
127 | 127 | if (!empty($options['unit'])) { |
128 | - $format_string = '%.' . $options['decimals'] . 'f ' . $options['unit']; |
|
128 | + $format_string = '%.'.$options['decimals'].'f '.$options['unit']; |
|
129 | 129 | } else { //Dont add space after number if no unit was specified |
130 | - $format_string = '%.' . $options['decimals'] . 'f'; |
|
130 | + $format_string = '%.'.$options['decimals'].'f'; |
|
131 | 131 | } |
132 | 132 | return sprintf($format_string, $value); |
133 | 133 | } |
@@ -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 | if ($magnitude >= 0) { |
62 | 62 | $nearest = (int) floor(abs($magnitude) / 3); |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | $value /= $divisor; |
106 | 106 | //Build the format string, e.g.: %.2d km |
107 | 107 | if ($unit !== '' || $symbol !== '') { |
108 | - $format_string = '%.' . $decimals . 'f ' . $symbol . $unit; |
|
108 | + $format_string = '%.'.$decimals.'f '.$symbol.$unit; |
|
109 | 109 | } else { |
110 | - $format_string = '%.' . $decimals . 'f'; |
|
110 | + $format_string = '%.'.$decimals.'f'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return sprintf($format_string, $value); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | //Otherwise prepend the project path |
117 | - $tmp = realpath($this->project_dir . DIRECTORY_SEPARATOR . $param_path); |
|
117 | + $tmp = realpath($this->project_dir.DIRECTORY_SEPARATOR.$param_path); |
|
118 | 118 | |
119 | 119 | //If path does not exist then disable the placeholder |
120 | 120 | if ($tmp === false) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | foreach ($array as $item) { |
140 | 140 | $item = str_replace(['\\'], ['/'], $item); |
141 | - $ret[] = '/' . preg_quote($item, '/') . '/'; |
|
141 | + $ret[] = '/'.preg_quote($item, '/').'/'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $ret; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | //Older path entries are given via %BASE% which was the project root |
158 | 158 | |
159 | 159 | $count = 0; |
160 | - $placeholder_path = preg_replace($this->placeholders_regex, $this->pathes, $placeholder_path,-1,$count); |
|
160 | + $placeholder_path = preg_replace($this->placeholders_regex, $this->pathes, $placeholder_path, -1, $count); |
|
161 | 161 | |
162 | 162 | //A valid placeholder can have only one |
163 | 163 | if ($count !== 1) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | try { |
24 | 24 | //Check if we can use this migration method: |
25 | - $version = (int)$this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'"); |
|
25 | + $version = (int) $this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'"); |
|
26 | 26 | $this->skipIf(true, "Old Part-DB Database detected! Continue with upgrade..."); |
27 | 27 | } catch (DBALException $ex) { |
28 | 28 | //when the table was not found, we can proceed, because we have an empty DB! |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | |
87 | 87 | //Create table for user logs: |
88 | - $sql = $updateSteps[] = "CREATE TABLE `log` ". |
|
88 | + $sql = $updateSteps[] = "CREATE TABLE `log` ". |
|
89 | 89 | "( `id` INT NOT NULL AUTO_INCREMENT , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ,". |
90 | 90 | " `id_user` INT NOT NULL ,". |
91 | 91 | " `level` TINYINT NOT NULL ,". |
@@ -50,15 +50,15 @@ |
||
50 | 50 | |
51 | 51 | //Add a attachment for each footprint attachment |
52 | 52 | $this->addSql( |
53 | - 'INSERT IGNORE INTO attachments (element_id, type_id, name, class_name, path, last_modified, datetime_added) ' . |
|
54 | - "SELECT footprints.id, 1000, 'Footprint', 'Footprint', REPLACE(footprints.filename, '%BASE%/img/footprints', '%FOOTPRINTS%' ), NOW(), NOW() FROM footprints " . |
|
53 | + 'INSERT IGNORE INTO attachments (element_id, type_id, name, class_name, path, last_modified, datetime_added) '. |
|
54 | + "SELECT footprints.id, 1000, 'Footprint', 'Footprint', REPLACE(footprints.filename, '%BASE%/img/footprints', '%FOOTPRINTS%' ), NOW(), NOW() FROM footprints ". |
|
55 | 55 | "WHERE footprints.filename <> ''" |
56 | 56 | ); |
57 | 57 | |
58 | 58 | //Do the same for 3D Footprints |
59 | 59 | $this->addSql( |
60 | - 'INSERT IGNORE INTO attachments (element_id, type_id, name, class_name, path, last_modified, datetime_added) ' . |
|
61 | - "SELECT footprints.id, 1001, 'Footprint 3D', 'Footprint', REPLACE(footprints.filename_3d, '%BASE%/models', '%FOOTPRINTS3D%' ), NOW(), NOW() FROM footprints " . |
|
60 | + 'INSERT IGNORE INTO attachments (element_id, type_id, name, class_name, path, last_modified, datetime_added) '. |
|
61 | + "SELECT footprints.id, 1001, 'Footprint 3D', 'Footprint', REPLACE(footprints.filename_3d, '%BASE%/models', '%FOOTPRINTS3D%' ), NOW(), NOW() FROM footprints ". |
|
62 | 62 | "WHERE footprints.filename_3d <> ''" |
63 | 63 | ); |
64 | 64 |