@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function add($type, $value) |
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 | } |
@@ -222,7 +222,7 @@ |
||
222 | 222 | { |
223 | 223 | if (preg_match( |
224 | 224 | '#(?<!%)%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]#', |
225 | - $entry->get(PoTokens::MESSAGE) . $entry->get(PoTokens::PLURAL) |
|
225 | + $entry->get(PoTokens::MESSAGE).$entry->get(PoTokens::PLURAL) |
|
226 | 226 | )) { |
227 | 227 | $entry->addFlag('php-format'); |
228 | 228 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $this->structuredHeaders = array(); |
41 | 41 | $headers = $this->entry[PoTokens::TRANSLATED]; |
42 | - $headers = ($headers === null) ? array() : $headers; |
|
42 | + $headers = ($headers===null) ? array() : $headers; |
|
43 | 43 | $full = implode('', $headers); |
44 | 44 | $headers = explode("\n", $full); |
45 | 45 | // split on ':' |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $headers = array(""); |
69 | 69 | |
70 | 70 | foreach ($this->structuredHeaders as $h) { |
71 | - $headers[] = $h['key'] . ': ' . $h['value'] . "\n"; |
|
71 | + $headers[] = $h['key'].': '.$h['value']."\n"; |
|
72 | 72 | } |
73 | 73 | $this->entry[PoTokens::TRANSLATED] = $headers; |
74 | 74 | return true; |
@@ -58,53 +58,53 @@ |
||
58 | 58 | $tokens = token_get_all($source); |
59 | 59 | |
60 | 60 | $translateTags = array_merge($this->gettextTags, $this->pgettextTags, $this->ngettextTags); |
61 | - $commentText=null; |
|
62 | - $commentLine=(-10); |
|
61 | + $commentText = null; |
|
62 | + $commentLine = (-10); |
|
63 | 63 | $tokenCount = count($tokens); |
64 | 64 | $i = 0; |
65 | - while ($i<$tokenCount) { |
|
65 | + while ($i < $tokenCount) { |
|
66 | 66 | $token = $tokens[$i]; |
67 | - if (is_array($token) && $token[0] == T_STRING && in_array($token[1], $translateTags)) { |
|
67 | + if (is_array($token) && $token[0]==T_STRING && in_array($token[1], $translateTags)) { |
|
68 | 68 | $entry = new PoEntry; |
69 | 69 | $gtt = array(); |
70 | 70 | list(, $text, $line) = $token; |
71 | - $entry->add(PoTokens::REFERENCE, $refname . ':' . $line); |
|
72 | - $gtt['line']=$line; |
|
73 | - $gtt['function']=$text; |
|
71 | + $entry->add(PoTokens::REFERENCE, $refname.':'.$line); |
|
72 | + $gtt['line'] = $line; |
|
73 | + $gtt['function'] = $text; |
|
74 | 74 | $gtt['args'] = array(); |
75 | 75 | $la = 1; |
76 | - while (is_array($tokens[$i + $la]) && $tokens[$i + $la][0] == T_WHITESPACE) { |
|
76 | + while (is_array($tokens[$i + $la]) && $tokens[$i + $la][0]==T_WHITESPACE) { |
|
77 | 77 | $la++; |
78 | 78 | } |
79 | - if ($tokens[$i + $la] == '(') { |
|
80 | - while ((')' != $token=$tokens[$i + $la]) && ($la < 10)) { |
|
79 | + if ($tokens[$i + $la]=='(') { |
|
80 | + while ((')'!=$token = $tokens[$i + $la]) && ($la < 10)) { |
|
81 | 81 | if (is_array($token) && ( |
82 | - $token[0] == T_CONSTANT_ENCAPSED_STRING |
|
83 | - || $token[0] == T_ENCAPSED_AND_WHITESPACE |
|
82 | + $token[0]==T_CONSTANT_ENCAPSED_STRING |
|
83 | + || $token[0]==T_ENCAPSED_AND_WHITESPACE |
|
84 | 84 | )) { |
85 | 85 | list(, $text, $line) = $token; |
86 | - $gtt['args'][]=$text; |
|
86 | + $gtt['args'][] = $text; |
|
87 | 87 | } |
88 | 88 | $la++; |
89 | 89 | } |
90 | 90 | if (count($gtt['args'])) { |
91 | 91 | if (in_array($gtt['function'], $this->gettextTags)) { |
92 | 92 | $entry->set(PoTokens::MESSAGE, $this->escapeForPo($gtt['args'][0])); |
93 | - } elseif (count($gtt['args'])>1 && in_array($gtt['function'], $this->pgettextTags)) { |
|
93 | + } elseif (count($gtt['args']) > 1 && in_array($gtt['function'], $this->pgettextTags)) { |
|
94 | 94 | $entry->set(PoTokens::CONTEXT, $this->escapeForPo($gtt['args'][0])); |
95 | 95 | $entry->set(PoTokens::MESSAGE, $this->escapeForPo($gtt['args'][1])); |
96 | - } elseif (count($gtt['args'])>1 && in_array($gtt['function'], $this->ngettextTags)) { |
|
96 | + } elseif (count($gtt['args']) > 1 && in_array($gtt['function'], $this->ngettextTags)) { |
|
97 | 97 | $entry->set(PoTokens::MESSAGE, $this->escapeForPo($gtt['args'][0])); |
98 | 98 | $entry->set(PoTokens::PLURAL, $this->escapeForPo($gtt['args'][1])); |
99 | 99 | } |
100 | 100 | $this->checkPhpFormatFlag($entry); |
101 | - if ($gtt['line']==($commentLine+1)) { |
|
101 | + if ($gtt['line']==($commentLine + 1)) { |
|
102 | 102 | $entry->set(PoTokens::EXTRACTED_COMMENTS, $this->stripComment($commentText)); |
103 | 103 | } |
104 | 104 | $this->poFile->mergeEntry($entry); |
105 | 105 | } |
106 | 106 | } |
107 | - } elseif (is_array($token) && $token[0] == T_COMMENT) { |
|
107 | + } elseif (is_array($token) && $token[0]==T_COMMENT) { |
|
108 | 108 | list(, $commentText, $commentLine) = $token; |
109 | 109 | } |
110 | 110 | $i++; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | { |
80 | 80 | $key = ''; |
81 | 81 | if (!empty($msgctxt)) { |
82 | - $key .= $msgctxt . '|'; |
|
82 | + $key .= $msgctxt.'|'; |
|
83 | 83 | } |
84 | 84 | $key .= $msgid; |
85 | 85 | if (!empty($msgid_plural)) { |
86 | - $key .= '|' . $msgid_plural; |
|
86 | + $key .= '|'.$msgid_plural; |
|
87 | 87 | } |
88 | 88 | return $key; |
89 | 89 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | // try by the key first. |
268 | 268 | if (!empty($key) && isset($this->entries[$key])) { |
269 | - if ($entry === $this->entries[$key]) { |
|
269 | + if ($entry===$this->entries[$key]) { |
|
270 | 270 | unset($this->entries[$key]); |
271 | 271 | return true; |
272 | 272 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | // the entry can't be matched by key, so we have to loop :( |
276 | 276 | foreach ($this->entries as $key => $value) { |
277 | - if ($entry === $value) { |
|
277 | + if ($entry===$value) { |
|
278 | 278 | unset($this->entries[$key]); |
279 | 279 | return true; |
280 | 280 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | // no match found in main entries, try the unkeyedEntries |
284 | 284 | foreach ($this->unkeyedEntries as $key => $value) { |
285 | - if ($entry === $value) { |
|
285 | + if ($entry===$value) { |
|
286 | 286 | unset($this->unkeyedEntries[$key]); |
287 | 287 | return true; |
288 | 288 | } |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | $source = $this->dumpString(); |
306 | 306 | $testName = file_exists($file) ? $file : dirname($file); |
307 | 307 | $status = is_writable($testName); |
308 | - if ($status === true) { |
|
308 | + if ($status===true) { |
|
309 | 309 | $source = iconv("CP1257", $this->encoding, $source); |
310 | 310 | |
311 | 311 | $status = file_put_contents($file, $source); |
312 | 312 | } |
313 | - if (false === $status) { |
|
313 | + if (false===$status) { |
|
314 | 314 | throw new FileNotWritableException($file); |
315 | 315 | } |
316 | 316 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function dumpString() |
324 | 324 | { |
325 | - if ($this->header === null) { |
|
325 | + if ($this->header===null) { |
|
326 | 326 | $this->header = new PoHeader; |
327 | 327 | $this->header->buildDefaultHeader(); |
328 | 328 | } |
@@ -421,22 +421,22 @@ discard block |
||
421 | 421 | $inHeader = false; |
422 | 422 | } |
423 | 423 | if (!$wsBreak) { |
424 | - if (!($entry === null)) { |
|
424 | + if (!($entry===null)) { |
|
425 | 425 | $this->addEntry($entry); |
426 | 426 | } |
427 | 427 | $entry = null; |
428 | - $wsBreak=true; |
|
428 | + $wsBreak = true; |
|
429 | 429 | } |
430 | 430 | } else { |
431 | - $wsBreak=false; |
|
432 | - $unrecognized[$line+1] = $s; |
|
431 | + $wsBreak = false; |
|
432 | + $unrecognized[$line + 1] = $s; |
|
433 | 433 | } |
434 | 434 | } else { |
435 | - if ($entry === null) { |
|
435 | + if ($entry===null) { |
|
436 | 436 | $entry = new PoEntry; |
437 | 437 | } |
438 | - $wsBreak=false; |
|
439 | - $currentKey = $matches[2]; // will be used to set last key |
|
438 | + $wsBreak = false; |
|
439 | + $currentKey = $matches[2]; // will be used to set last key |
|
440 | 440 | switch ($matches[2]) { |
441 | 441 | case PoTokens::TRANSLATOR_COMMENTS: |
442 | 442 | case PoTokens::EXTRACTED_COMMENTS: |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | $entry->addQuotedAtPosition( |
460 | 460 | PoTokens::TRANSLATED, |
461 | 461 | $currentPlural, |
462 | - '"' . $matches[5] |
|
462 | + '"'.$matches[5] |
|
463 | 463 | ); |
464 | 464 | } else { |
465 | - $entry->addQuoted($currentKey, '"' . $matches[5]); |
|
465 | + $entry->addQuoted($currentKey, '"'.$matches[5]); |
|
466 | 466 | } |
467 | 467 | } elseif (substr($matches[2], 0, 7)==PoTokens::TRANSLATED_PLURAL) { |
468 | 468 | $currentKey = PoTokens::TRANSLATED_PLURAL; |
@@ -478,14 +478,14 @@ discard block |
||
478 | 478 | $value = empty($value) ? '' : $value; |
479 | 479 | $entry->add(PoTokens::TRANSLATOR_COMMENTS, $value); |
480 | 480 | } else { |
481 | - $unrecognized[$line+1] = $s; |
|
481 | + $unrecognized[$line + 1] = $s; |
|
482 | 482 | } |
483 | 483 | break; |
484 | 484 | } |
485 | 485 | $lastKey = $currentKey; |
486 | 486 | } |
487 | 487 | } |
488 | - if (!($entry === null)) { |
|
488 | + if (!($entry===null)) { |
|
489 | 489 | $this->addEntry($entry); |
490 | 490 | } |
491 | 491 |