Skip to content
This repository
Browse code

coding standards whitespace and single quote

  • Loading branch information...
commit a6f065e7a24fbf351a8c2332405f768b358103f7 1 parent f6aedea
Mark authored June 09, 2013
26  lib/Cake/I18n/I18n.php
@@ -373,7 +373,7 @@ protected function _bindTextDomain($domain) {
373 373
 			$head = $this->_domains[$domain][$this->_lang][$this->category][""];
374 374
 
375 375
 			foreach (explode("\n", $head) as $line) {
376  
-				$header = strtok($line,":");
  376
+				$header = strtok($line, ':');
377 377
 				$line = trim(strtok("\n"));
378 378
 				$this->_domains[$domain][$this->_lang][$this->category]["%po-header"][strtolower($header)] = $line;
379 379
 			}
@@ -407,7 +407,7 @@ public static function loadMo($filename) {
407 407
 		if ($data = file_get_contents($filename)) {
408 408
 			$translations = array();
409 409
 			$header = substr($data, 0, 20);
410  
-			$header = unpack("L1magic/L1version/L1count/L1o_msg/L1o_trn", $header);
  410
+			$header = unpack('L1magic/L1version/L1count/L1o_msg/L1o_trn', $header);
411 411
 			extract($header);
412 412
 
413 413
 			if ((dechex($magic) === '950412de' || dechex($magic) === 'ffffffff950412de') && !$version) {
@@ -445,19 +445,19 @@ public static function loadMo($filename) {
445 445
  * @return mixed Array of translations on success or false on failure
446 446
  */
447 447
 	public static function loadPo($filename) {
448  
-		if (!$file = fopen($filename, "r")) {
  448
+		if (!$file = fopen($filename, 'r')) {
449 449
 			return false;
450 450
 		}
451 451
 
452 452
 		$type = 0;
453 453
 		$translations = array();
454  
-		$translationKey = "";
  454
+		$translationKey = '';
455 455
 		$plural = 0;
456  
-		$header = "";
  456
+		$header = '';
457 457
 
458 458
 		do {
459 459
 			$line = trim(fgets($file));
460  
-			if ($line === "" || $line[0] === "#") {
  460
+			if ($line === '' || $line[0] === '#') {
461 461
 				continue;
462 462
 			}
463 463
 			if (preg_match("/msgid[[:space:]]+\"(.+)\"$/i", $line, $regs)) {
@@ -465,7 +465,7 @@ public static function loadPo($filename) {
465 465
 				$translationKey = stripcslashes($regs[1]);
466 466
 			} elseif (preg_match("/msgid[[:space:]]+\"\"$/i", $line, $regs)) {
467 467
 				$type = 2;
468  
-				$translationKey = "";
  468
+				$translationKey = '';
469 469
 			} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && ($type == 1 || $type == 2 || $type == 3)) {
470 470
 				$type = 3;
471 471
 				$translationKey .= stripcslashes($regs[1]);
@@ -474,7 +474,7 @@ public static function loadPo($filename) {
474 474
 				$type = 4;
475 475
 			} elseif (preg_match("/msgstr[[:space:]]+\"\"$/i", $line, $regs) && ($type == 1 || $type == 3) && $translationKey) {
476 476
 				$type = 4;
477  
-				$translations[$translationKey] = "";
  477
+				$translations[$translationKey] = '';
478 478
 			} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 4 && $translationKey) {
479 479
 				$translations[$translationKey] .= stripcslashes($regs[1]);
480 480
 			} elseif (preg_match("/msgid_plural[[:space:]]+\".*\"$/i", $line, $regs)) {
@@ -487,7 +487,7 @@ public static function loadPo($filename) {
487 487
 				$type = 7;
488 488
 			} elseif (preg_match("/msgstr\[(\d+)\][[:space:]]+\"\"$/i", $line, $regs) && ($type == 6 || $type == 7) && $translationKey) {
489 489
 				$plural = $regs[1];
490  
-				$translations[$translationKey][$plural] = "";
  490
+				$translations[$translationKey][$plural] = '';
491 491
 				$type = 7;
492 492
 			} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 7 && $translationKey) {
493 493
 				$translations[$translationKey][$plural] .= stripcslashes($regs[1]);
@@ -495,20 +495,20 @@ public static function loadPo($filename) {
495 495
 				$header .= stripcslashes($regs[1]);
496 496
 				$type = 5;
497 497
 			} elseif (preg_match("/msgstr[[:space:]]+\"\"$/i", $line, $regs) && !$translationKey) {
498  
-				$header = "";
  498
+				$header = '';
499 499
 				$type = 5;
500 500
 			} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 5) {
501 501
 				$header .= stripcslashes($regs[1]);
502 502
 			} else {
503 503
 				unset($translations[$translationKey]);
504 504
 				$type = 0;
505  
-				$translationKey = "";
  505
+				$translationKey = '';
506 506
 				$plural = 0;
507 507
 			}
508 508
 		} while (!feof($file));
509 509
 		fclose($file);
510 510
 
511  
-		$merge[""] = $header;
  511
+		$merge[''] = $header;
512 512
 		return array_merge($merge, $translations);
513 513
 	}
514 514
 
@@ -519,7 +519,7 @@ public static function loadPo($filename) {
519 519
  * @return mixed Array of definitions on success or false on failure
520 520
  */
521 521
 	public static function loadLocaleDefinition($filename) {
522  
-		if (!$file = fopen($filename, "r")) {
  522
+		if (!$file = fopen($filename, 'r')) {
523 523
 			return false;
524 524
 		}
525 525
 
2  lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -988,7 +988,7 @@ public function testAjaxLogin() {
988 988
 		App::build(array(
989 989
 			'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
990 990
 		));
991  
-		$_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest";
  991
+		$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
992 992
 
993 993
 		App::uses('Dispatcher', 'Routing');
994 994
 
4  lib/Cake/Test/Case/Utility/SanitizeTest.php
@@ -271,12 +271,12 @@ public function testParanoid() {
271 271
 		$this->assertEquals($expected, $result);
272 272
 
273 273
 		$string = "x' AND 1=(SELECT COUNT(*) FROM users); --";
274  
-		$expected = "xAND1SELECTCOUNTFROMusers";
  274
+		$expected = 'xAND1SELECTCOUNTFROMusers';
275 275
 		$result = Sanitize::paranoid($string);
276 276
 		$this->assertEquals($expected, $result);
277 277
 
278 278
 		$string = "x'; DROP TABLE members; --";
279  
-		$expected = "xDROPTABLEmembers";
  279
+		$expected = 'xDROPTABLEmembers';
280 280
 		$result = Sanitize::paranoid($string);
281 281
 		$this->assertEquals($expected, $result);
282 282
 	}
18  lib/Cake/Test/Case/Utility/SetTest.php
@@ -2443,8 +2443,8 @@ public function testMapNesting() {
2443 2443
 		$expected->hash = '68a9f053b19526d08e36c6a9ad150737933816a5';
2444 2444
 		$expected->get_vars = '';
2445 2445
 		$expected->redirect = '';
2446  
-		$expected->created = "1195055503";
2447  
-		$expected->updated = "1195055503";
  2446
+		$expected->created = '1195055503';
  2447
+		$expected->updated = '1195055503';
2448 2448
 		// @codingStandardsIgnoreEnd
2449 2449
 		$this->assertEquals($expected, $mapped[1]);
2450 2450
 
@@ -2492,9 +2492,9 @@ public function testNestedMappedData() {
2492 2492
 		$expected->Author->id = '1';
2493 2493
 		$expected->Author->user = 'mariano';
2494 2494
 		$expected->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99';
2495  
-		$expected->Author->created = "2007-03-17 01:16:23";
2496  
-		$expected->Author->updated = "2007-03-17 01:18:31";
2497  
-		$expected->Author->test = "working";
  2495
+		$expected->Author->created = '2007-03-17 01:16:23';
  2496
+		$expected->Author->updated = '2007-03-17 01:18:31';
  2497
+		$expected->Author->test = 'working';
2498 2498
 		$expected->Author->_name_ = 'Author';
2499 2499
 
2500 2500
 		$expected2 = new stdClass;
@@ -2511,9 +2511,9 @@ public function testNestedMappedData() {
2511 2511
 		$expected2->Author->id = '3';
2512 2512
 		$expected2->Author->user = 'larry';
2513 2513
 		$expected2->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99';
2514  
-		$expected2->Author->created = "2007-03-17 01:20:23";
2515  
-		$expected2->Author->updated = "2007-03-17 01:22:31";
2516  
-		$expected2->Author->test = "working";
  2514
+		$expected2->Author->created = '2007-03-17 01:20:23';
  2515
+		$expected2->Author->updated = '2007-03-17 01:22:31';
  2516
+		$expected2->Author->test = 'working';
2517 2517
 		$expected2->Author->_name_ = 'Author';
2518 2518
 		// @codingStandardsIgnoreEnd
2519 2519
 
@@ -2546,7 +2546,7 @@ public function testNestedMappedData() {
2546 2546
 		$expected->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99';
2547 2547
 		$expected->Author->created = "2007-03-17 01:16:23";
2548 2548
 		$expected->Author->updated = "2007-03-17 01:18:31";
2549  
-		$expected->Author->test = "working";
  2549
+		$expected->Author->test = 'working';
2550 2550
 		$expected->Author->_name_ = 'Author';
2551 2551
 		// @codingStandardsIgnoreEnd
2552 2552
 		$this->assertEquals($expected, $result);
2  lib/Cake/TestSuite/Reporter/CakeTextReporter.php
@@ -162,7 +162,7 @@ public function testCaseList() {
162 162
 		}
163 163
 
164 164
 		if (1 > count($testCases)) {
165  
-			$buffer .= "EMPTY";
  165
+			$buffer .= 'EMPTY';
166 166
 			echo $buffer;
167 167
 		}
168 168
 

0 notes on commit a6f065e

Please sign in to comment.
Something went wrong with that request. Please try again.