Completed
Pull Request — master (#7)
by
unknown
02:00
created
src/PoFile.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.