@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function add(string $type, string $value): void |
| 49 | 49 | { |
| 50 | - if ($this->entry[$type] === null) { |
|
| 50 | + if ($this->entry[$type]===null) { |
|
| 51 | 51 | $this->entry[$type] = array(); |
| 52 | 52 | } |
| 53 | 53 | $this->entry[$type] = (array) $this->entry[$type]; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | $value = stripcslashes($value); |
| 70 | 70 | |
| 71 | - if ($this->entry[$type] === null) { |
|
| 71 | + if ($this->entry[$type]===null) { |
|
| 72 | 72 | $this->entry[$type] = array(); |
| 73 | 73 | } |
| 74 | 74 | $this->entry[$type] = (array) $this->entry[$type]; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | $value = stripcslashes($value); |
| 95 | 95 | |
| 96 | - if ($this->entry[$type] === null) { |
|
| 96 | + if ($this->entry[$type]===null) { |
|
| 97 | 97 | $this->entry[$type] = array(); |
| 98 | 98 | } |
| 99 | 99 | if (isset($this->entry[$type][$position]) && |
@@ -175,24 +175,24 @@ discard block |
||
| 175 | 175 | $output = $this->dumpEntryComments(); |
| 176 | 176 | |
| 177 | 177 | $key = PoTokens::CONTEXT; |
| 178 | - if (!($this->entry[$key] === null)) { |
|
| 179 | - $output .= $key . $this->formatQuotedString($this->entry[$key]); |
|
| 178 | + if (!($this->entry[$key]===null)) { |
|
| 179 | + $output .= $key.$this->formatQuotedString($this->entry[$key]); |
|
| 180 | 180 | } |
| 181 | 181 | $key = PoTokens::MESSAGE; |
| 182 | - if (!($this->entry[$key] === null)) { |
|
| 183 | - $output .= $key . $this->formatQuotedString($this->entry[$key]); |
|
| 182 | + if (!($this->entry[$key]===null)) { |
|
| 183 | + $output .= $key.$this->formatQuotedString($this->entry[$key]); |
|
| 184 | 184 | $key = PoTokens::PLURAL; |
| 185 | - if (!($this->entry[$key] === null)) { |
|
| 186 | - $output .= $key . $this->formatQuotedString($this->entry[$key]); |
|
| 185 | + if (!($this->entry[$key]===null)) { |
|
| 186 | + $output .= $key.$this->formatQuotedString($this->entry[$key]); |
|
| 187 | 187 | $key = PoTokens::TRANSLATED; |
| 188 | 188 | $plurals = $this->entry[$key]; |
| 189 | 189 | $plurals = is_array($plurals) ? $plurals : array('', ''); |
| 190 | 190 | foreach ($plurals as $i => $value) { |
| 191 | - $output .= "{$key}[{$i}]" . $this->formatQuotedString($value); |
|
| 191 | + $output .= "{$key}[{$i}]".$this->formatQuotedString($value); |
|
| 192 | 192 | } |
| 193 | 193 | } else { |
| 194 | 194 | $key = PoTokens::TRANSLATED; |
| 195 | - $output .= $key . $this->formatQuotedString($this->entry[$key]); |
|
| 195 | + $output .= $key.$this->formatQuotedString($this->entry[$key]); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | $section = $this->entry[$type]; |
| 223 | 223 | if (is_array($section)) { |
| 224 | 224 | foreach ($section as $comment) { |
| 225 | - $output .= $type . ' ' . $comment . "\n"; |
|
| 225 | + $output .= $type.' '.$comment."\n"; |
|
| 226 | 226 | } |
| 227 | - } elseif (!($section === null)) { |
|
| 228 | - $output .= $type . ' ' . $section . "\n"; |
|
| 227 | + } elseif (!($section===null)) { |
|
| 228 | + $output .= $type.' '.$section."\n"; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -247,15 +247,15 @@ discard block |
||
| 247 | 247 | if (is_array($value)) { |
| 248 | 248 | $string = ''; |
| 249 | 249 | foreach ($value as $partial) { |
| 250 | - $string .= $this->formatQuotedString($partial, true) . "\n"; |
|
| 250 | + $string .= $this->formatQuotedString($partial, true)."\n"; |
|
| 251 | 251 | } |
| 252 | - return $bare ? $string : ' ' . $string; |
|
| 252 | + return $bare ? $string : ' '.$string; |
|
| 253 | 253 | } else { |
| 254 | - $string = ($value === null) ? '' : $value; |
|
| 254 | + $string = ($value===null) ? '' : $value; |
|
| 255 | 255 | $string = stripcslashes($string); |
| 256 | 256 | $string = addcslashes($string, "\0..\37\""); |
| 257 | - $string = '"' . $string . '"'; |
|
| 258 | - return $bare ? $string : ' ' . $string . "\n"; |
|
| 257 | + $string = '"'.$string.'"'; |
|
| 258 | + return $bare ? $string : ' '.$string."\n"; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -294,13 +294,13 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | if (!$this->hasFlag($name)) { |
| 296 | 296 | $flagEntry = $this->entry[PoTokens::FLAG]; |
| 297 | - if ($flagEntry === null) { |
|
| 297 | + if ($flagEntry===null) { |
|
| 298 | 298 | $this->set(PoTokens::FLAG, $name); |
| 299 | 299 | } elseif (is_array($flagEntry)) { |
| 300 | 300 | $flagEntry[] = $name; |
| 301 | 301 | $this->set(PoTokens::FLAG, implode(',', $flagEntry)); |
| 302 | 302 | } else { |
| 303 | - $this->set(PoTokens::FLAG, $flagEntry . ',' . $name); |
|
| 303 | + $this->set(PoTokens::FLAG, $flagEntry.','.$name); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $key = ''; |
| 75 | 75 | if (!empty($msgctxt)) { |
| 76 | - $key .= $msgctxt . '|'; |
|
| 76 | + $key .= $msgctxt.'|'; |
|
| 77 | 77 | } |
| 78 | 78 | $key .= (string) $msgid; |
| 79 | 79 | if (!empty($msgid_plural)) { |
| 80 | - $key .= '|' . $msgid_plural; |
|
| 80 | + $key .= '|'.$msgid_plural; |
|
| 81 | 81 | } |
| 82 | 82 | return $key; |
| 83 | 83 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | // try by the key first. |
| 262 | 262 | if (!empty($key) && isset($this->entries[$key])) { |
| 263 | - if ($entry === $this->entries[$key]) { |
|
| 263 | + if ($entry===$this->entries[$key]) { |
|
| 264 | 264 | unset($this->entries[$key]); |
| 265 | 265 | return true; |
| 266 | 266 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | // the entry can't be matched by key, so we have to loop :( |
| 270 | 270 | foreach ($this->entries as $key => $value) { |
| 271 | - if ($entry === $value) { |
|
| 271 | + if ($entry===$value) { |
|
| 272 | 272 | unset($this->entries[$key]); |
| 273 | 273 | return true; |
| 274 | 274 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | // no match found in main entries, try the unkeyedEntries |
| 278 | 278 | foreach ($this->unkeyedEntries as $key => $value) { |
| 279 | - if ($entry === $value) { |
|
| 279 | + if ($entry===$value) { |
|
| 280 | 280 | unset($this->unkeyedEntries[$key]); |
| 281 | 281 | return true; |
| 282 | 282 | } |
@@ -299,10 +299,10 @@ discard block |
||
| 299 | 299 | $source = $this->dumpString(); |
| 300 | 300 | $testName = file_exists($file) ? $file : dirname($file); |
| 301 | 301 | $status = is_writable($testName); |
| 302 | - if ($status === true) { |
|
| 302 | + if ($status===true) { |
|
| 303 | 303 | $status = file_put_contents($file, $source); |
| 304 | 304 | } |
| 305 | - if (false === $status) { |
|
| 305 | + if (false===$status) { |
|
| 306 | 306 | throw new FileNotWritableException($file); |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function dumpString(): string |
| 316 | 316 | { |
| 317 | - if ($this->header === null) { |
|
| 317 | + if ($this->header===null) { |
|
| 318 | 318 | $this->header = new PoHeader; |
| 319 | 319 | $this->header->buildDefaultHeader(); |
| 320 | 320 | } |
@@ -400,22 +400,22 @@ discard block |
||
| 400 | 400 | $inHeader = false; |
| 401 | 401 | } |
| 402 | 402 | if (!$wsBreak) { |
| 403 | - if (!($entry === null)) { |
|
| 403 | + if (!($entry===null)) { |
|
| 404 | 404 | $this->addEntry($entry); |
| 405 | 405 | } |
| 406 | 406 | $entry = null; |
| 407 | - $wsBreak=true; |
|
| 407 | + $wsBreak = true; |
|
| 408 | 408 | } |
| 409 | 409 | } else { |
| 410 | - $wsBreak=false; |
|
| 411 | - $unrecognized[$line+1] = $s; |
|
| 410 | + $wsBreak = false; |
|
| 411 | + $unrecognized[$line + 1] = $s; |
|
| 412 | 412 | } |
| 413 | 413 | } else { |
| 414 | - if ($entry === null) { |
|
| 414 | + if ($entry===null) { |
|
| 415 | 415 | $entry = new PoEntry; |
| 416 | 416 | } |
| 417 | - $wsBreak=false; |
|
| 418 | - $currentKey = $matches[2]; // will be used to set last key |
|
| 417 | + $wsBreak = false; |
|
| 418 | + $currentKey = $matches[2]; // will be used to set last key |
|
| 419 | 419 | switch ($matches[2]) { |
| 420 | 420 | case PoTokens::TRANSLATOR_COMMENTS: |
| 421 | 421 | case PoTokens::EXTRACTED_COMMENTS: |
@@ -438,10 +438,10 @@ discard block |
||
| 438 | 438 | $entry->addQuotedAtPosition( |
| 439 | 439 | PoTokens::TRANSLATED, |
| 440 | 440 | $currentPlural, |
| 441 | - '"' . $matches[5] |
|
| 441 | + '"'.$matches[5] |
|
| 442 | 442 | ); |
| 443 | 443 | } else { |
| 444 | - $entry->addQuoted($currentKey, '"' . $matches[5]); |
|
| 444 | + $entry->addQuoted($currentKey, '"'.$matches[5]); |
|
| 445 | 445 | } |
| 446 | 446 | } elseif (substr($matches[2], 0, 7)==PoTokens::TRANSLATED_PLURAL) { |
| 447 | 447 | $currentKey = PoTokens::TRANSLATED_PLURAL; |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | $value = empty($value) ? '' : $value; |
| 458 | 458 | $entry->add(PoTokens::TRANSLATOR_COMMENTS, $value); |
| 459 | 459 | } else { |
| 460 | - $unrecognized[$line+1] = $s; |
|
| 460 | + $unrecognized[$line + 1] = $s; |
|
| 461 | 461 | } |
| 462 | 462 | break; |
| 463 | 463 | } |
| 464 | 464 | $lastKey = $currentKey; |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | - if (!($entry === null)) { |
|
| 467 | + if (!($entry===null)) { |
|
| 468 | 468 | $this->addEntry($entry); |
| 469 | 469 | } |
| 470 | 470 | |