@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct($source) |
60 | 60 | { |
61 | - $this->source = (string)$source; |
|
61 | + $this->source = (string) $source; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | |
80 | 80 | foreach($translationUnit as $unit) |
81 | 81 | { |
82 | - $source = (string)$unit->source; |
|
83 | - $translations[$source][] = (string)$unit->target; |
|
84 | - $translations[$source][] = (string)$unit['id']; |
|
85 | - $translations[$source][] = (string)$unit->note; |
|
82 | + $source = (string) $unit->source; |
|
83 | + $translations[$source][] = (string) $unit->target; |
|
84 | + $translations[$source][] = (string) $unit['id']; |
|
85 | + $translations[$source][] = (string) $unit->note; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $translations; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | if(isset($variants[$i]{0})) |
138 | 138 | { |
139 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
139 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
140 | 140 | $catalogues[] = $catalogue . $this->dataSeparator . $variant . $this->dataExt; |
141 | 141 | } |
142 | 142 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | { |
172 | 172 | if(isset($variants[$i]{0})) |
173 | 173 | { |
174 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
174 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
175 | 175 | $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
176 | 176 | } |
177 | 177 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | protected function getCatalogues($dir = null, $variant = null) |
200 | 200 | { |
201 | - $dir = $dir?$dir:$this->source; |
|
201 | + $dir = $dir ? $dir : $this->source; |
|
202 | 202 | $files = scandir($dir); |
203 | 203 | $catalogue = []; |
204 | 204 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | $lastNodes = $xpath->query('//trans-unit[last()]'); |
296 | 296 | if(($last = $lastNodes->item(0)) !== null) { |
297 | - $count = (int)$last->getAttribute('id'); |
|
297 | + $count = (int) $last->getAttribute('id'); |
|
298 | 298 | } else { |
299 | 299 | $count = 0; |
300 | 300 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | * The prefix and suffix to append to untranslated messages. |
77 | 77 | * @var array |
78 | 78 | */ |
79 | - protected $postscript = ['','']; |
|
79 | + protected $postscript = ['', '']; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Set the default catalogue. |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function format($time, $pattern = 'F', $charset = 'UTF-8') |
115 | 115 | { |
116 | - if (is_numeric($time)) //assumes unix epoch |
|
116 | + if(is_numeric($time)) //assumes unix epoch |
|
117 | 117 | $time = floatval($time); |
118 | 118 | elseif(is_string($time)) |
119 | 119 | $time = @strtotime($time); |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | throw new Exception('The pattern for AM/PM marker is "a".'); |
457 | 457 | |
458 | 458 | $hour = $date->format('G'); |
459 | - $ampm = (int)($hour / 12); |
|
459 | + $ampm = (int) ($hour / 12); |
|
460 | 460 | return $this->formatInfo->AMPMMarkers[$ampm]; |
461 | 461 | } |
462 | 462 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | */ |
558 | 558 | protected function getDayInMonth($date, $pattern = 'FF') |
559 | 559 | { |
560 | - switch ($pattern) { |
|
560 | + switch($pattern) { |
|
561 | 561 | case 'F': |
562 | 562 | return $date->format('j'); |
563 | 563 | case 'FF': |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | if($string == '-Inf') |
138 | 138 | $elements[] = -1 * $this->inf; |
139 | - elseif ($string == '+Inf' || $string == 'Inf') |
|
139 | + elseif($string == '+Inf' || $string == 'Inf') |
|
140 | 140 | $elements[] = $this->inf; |
141 | 141 | else |
142 | 142 | $elements[] = floatval($string); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $left = false; |
153 | 153 | if($leftBracket == '[') |
154 | 154 | $left = $number >= $elements[0]; |
155 | - elseif ($leftBracket == '(') |
|
155 | + elseif($leftBracket == '(') |
|
156 | 156 | $left = $number > $elements[0]; |
157 | 157 | |
158 | 158 | $right = false; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | eval($str); |
175 | 175 | return $result; |
176 | 176 | } |
177 | - catch(Exception $e) |
|
177 | + catch (Exception $e) |
|
178 | 178 | { |
179 | 179 | return false; |
180 | 180 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | for($i = 0; $i < $n; $i++) |
198 | 198 | { |
199 | 199 | $len = strlen($offset[$i][0]); |
200 | - $begin = $i == 0? $len : $offset[$i][1] + $len; |
|
200 | + $begin = $i == 0 ? $len : $offset[$i][1] + $len; |
|
201 | 201 | $end = $i == $n - 1 ? strlen($string) : $offset[$i + 1][1]; |
202 | 202 | $strings[] = substr($string, $begin, $end - $begin); |
203 | 203 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function __construct($source) |
62 | 62 | { |
63 | - $this->source = (string)$source; |
|
63 | + $this->source = (string) $source; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | if(isset($variants[$i]{0})) |
141 | 141 | { |
142 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
142 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
143 | 143 | $catalogues[] = $catalogue . $this->dataSeparator . |
144 | 144 | $variant . $this->dataExt; |
145 | 145 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | if(isset($variants[$i]{0})) |
170 | 170 | { |
171 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
171 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
172 | 172 | $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
173 | 173 | } |
174 | 174 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | protected function getCatalogues($dir = null, $variant = null) |
382 | 382 | { |
383 | - $dir = $dir?$dir:$this->source; |
|
383 | + $dir = $dir ? $dir : $this->source; |
|
384 | 384 | $files = scandir($dir); |
385 | 385 | |
386 | 386 | $catalogue = []; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if(strtolower($pattern) == 'p') |
124 | 124 | $number = $number * 100; |
125 | 125 | |
126 | - $string = (string)$number; |
|
126 | + $string = (string) $number; |
|
127 | 127 | |
128 | 128 | $decimal = $this->formatDecimal($string); |
129 | 129 | $integer = $this->formatInteger(abs($number)); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | elseif($number < 0) |
140 | 140 | $suffix = $this->formatInfo->NegativePattern; |
141 | 141 | else |
142 | - $suffix = ["",""]; |
|
142 | + $suffix = ["", ""]; |
|
143 | 143 | |
144 | 144 | //append and prepend suffix |
145 | 145 | $result = $suffix[0] . $result . $suffix[1]; |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | */ |
165 | 165 | protected function formatInteger($string) |
166 | 166 | { |
167 | - $string = (string)$string; |
|
167 | + $string = (string) $string; |
|
168 | 168 | |
169 | 169 | $decimalDigits = $this->formatInfo->DecimalDigits; |
170 | 170 | //if not decimal digits, assume 0 decimal points. |
171 | 171 | if(is_int($decimalDigits) && $decimalDigits > 0) |
172 | - $string = (string)round(floatval($string), $decimalDigits); |
|
172 | + $string = (string) round(floatval($string), $decimalDigits); |
|
173 | 173 | $dp = strpos($string, '.'); |
174 | 174 | if(is_int($dp)) |
175 | 175 | $string = substr($string, 0, $dp); |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | } |
254 | 254 | elseif(is_int($decimalDigits)) |
255 | 255 | { |
256 | - $float = round((float)$string, $decimalDigits); |
|
257 | - if(strpos((string)$float, '.') === false) |
|
256 | + $float = round((float) $string, $decimalDigits); |
|
257 | + if(strpos((string) $float, '.') === false) |
|
258 | 258 | { |
259 | 259 | $decimal = str_pad($decimal, $decimalDigits, '0'); |
260 | 260 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | return $decimalSeparator . $decimal; |
272 | 272 | } |
273 | - elseif ($decimalDigits > 0) |
|
273 | + elseif($decimalDigits > 0) |
|
274 | 274 | return $decimalSeparator . str_pad($decimal, $decimalDigits, '0'); |
275 | 275 | |
276 | 276 | return $decimal; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct($source) |
45 | 45 | { |
46 | - $this->_connID = (string)$source; |
|
46 | + $this->_connID = (string) $source; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | |
99 | 99 | $result = []; |
100 | 100 | |
101 | - foreach ($dataReader as $row) |
|
102 | - $result[$row['source']] = [$row['target'],$row['id'],$row['comments']]; |
|
101 | + foreach($dataReader as $row) |
|
102 | + $result[$row['source']] = [$row['target'], $row['id'], $row['comments']]; |
|
103 | 103 | |
104 | 104 | return $result; |
105 | 105 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | { |
152 | 152 | if(isset($variants[$i]{0})) |
153 | 153 | { |
154 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
154 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
155 | 155 | $catalogues[] = $catalogue . '.' . $variant; |
156 | 156 | } |
157 | 157 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $command->bindParameter(':variant', $variant, PDO::PARAM_STR); |
176 | 176 | $cat_id = $command->queryScalar(); |
177 | 177 | |
178 | - if ($cat_id === null) return false; |
|
178 | + if($cat_id === null) return false; |
|
179 | 179 | |
180 | 180 | $command = $this->getDBConnection()->createCommand( |
181 | 181 | 'SELECT COUNT(msg_id) FROM trans_unit WHERE cat_id = :catid '); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $command->bindParameter(':dateadded', $time, PDO::PARAM_INT); |
238 | 238 | foreach($messages as $message) |
239 | 239 | { |
240 | - if (empty($message)) continue; |
|
240 | + if(empty($message)) continue; |
|
241 | 241 | $count++; $inserted++; |
242 | 242 | $command->execute(); |
243 | 243 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $result = []; |
312 | 312 | |
313 | - foreach ($dataReader as $row) |
|
313 | + foreach($dataReader as $row) |
|
314 | 314 | { |
315 | 315 | $details = explode('.', $row[0]); |
316 | 316 | if(!isset($details[1])) $details[1] = null; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public static function getInstance($culture = null) |
172 | 172 | { |
173 | 173 | |
174 | - if ($culture instanceof CultureInfo) |
|
174 | + if($culture instanceof CultureInfo) |
|
175 | 175 | return $culture->getDateTimeFormat(); |
176 | 176 | elseif(is_string($culture)) |
177 | 177 | { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function getAbbreviatedMonthNames() |
296 | 296 | { |
297 | - if (isset($this->data['monthNames']['format']['abbreviated'])) |
|
297 | + if(isset($this->data['monthNames']['format']['abbreviated'])) |
|
298 | 298 | return $this->data['monthNames']['format']['abbreviated']; |
299 | 299 | else |
300 | 300 | return $this->data['monthNames']['format']['wide']; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | public function formatDateTime($date, $time) |
513 | 513 | { |
514 | 514 | $pattern = $this->getDateTimeOrderPattern(); |
515 | - return str_replace(['{0}','{1}'], [$time, $date], $pattern); |
|
515 | + return str_replace(['{0}', '{1}'], [$time, $date], $pattern); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | public static function getInstance($culture = null, |
182 | 182 | $type = NumberFormatInfo::DECIMAL) |
183 | 183 | { |
184 | - if ($culture instanceof CultureInfo) |
|
184 | + if($culture instanceof CultureInfo) |
|
185 | 185 | { |
186 | 186 | $formatInfo = $culture->NumberFormat; |
187 | 187 | $formatInfo->setPattern($type); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $groupPos2 = false; |
263 | 263 | $groupSize1 = false; |
264 | 264 | $groupSize2 = false; |
265 | - $decimalPoints = is_int($decimalPos)?-1:false; |
|
265 | + $decimalPoints = is_int($decimalPos) ?-1 : false; |
|
266 | 266 | |
267 | 267 | $info['negPref'] = $this->data['NumberElements'][6]; |
268 | 268 | $info['negPost'] = ''; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | { |
354 | 354 | $regexp = '/[#,\.0]+/'; |
355 | 355 | $result = preg_split($regexp, $pattern); |
356 | - return [$result[0],$result[1]]; |
|
356 | + return [$result[0], $result[1]]; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 |