From a6f065e7a24fbf351a8c2332405f768b358103f7 Mon Sep 17 00:00:00 2001 From: euromark Date: Sun, 9 Jun 2013 17:20:08 +0200 Subject: [PATCH] coding standards whitespace and single quote --- lib/Cake/I18n/I18n.php | 26 +++++++++---------- .../Component/AuthComponentTest.php | 2 +- lib/Cake/Test/Case/Utility/SanitizeTest.php | 4 +-- lib/Cake/Test/Case/Utility/SetTest.php | 18 ++++++------- .../TestSuite/Reporter/CakeTextReporter.php | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index d9effc5b3..f81a11d3a 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -373,7 +373,7 @@ class I18n { $head = $this->_domains[$domain][$this->_lang][$this->category][""]; foreach (explode("\n", $head) as $line) { - $header = strtok($line,":"); + $header = strtok($line, ':'); $line = trim(strtok("\n")); $this->_domains[$domain][$this->_lang][$this->category]["%po-header"][strtolower($header)] = $line; } @@ -407,7 +407,7 @@ class I18n { if ($data = file_get_contents($filename)) { $translations = array(); $header = substr($data, 0, 20); - $header = unpack("L1magic/L1version/L1count/L1o_msg/L1o_trn", $header); + $header = unpack('L1magic/L1version/L1count/L1o_msg/L1o_trn', $header); extract($header); if ((dechex($magic) === '950412de' || dechex($magic) === 'ffffffff950412de') && !$version) { @@ -445,19 +445,19 @@ class I18n { * @return mixed Array of translations on success or false on failure */ public static function loadPo($filename) { - if (!$file = fopen($filename, "r")) { + if (!$file = fopen($filename, 'r')) { return false; } $type = 0; $translations = array(); - $translationKey = ""; + $translationKey = ''; $plural = 0; - $header = ""; + $header = ''; do { $line = trim(fgets($file)); - if ($line === "" || $line[0] === "#") { + if ($line === '' || $line[0] === '#') { continue; } if (preg_match("/msgid[[:space:]]+\"(.+)\"$/i", $line, $regs)) { @@ -465,7 +465,7 @@ class I18n { $translationKey = stripcslashes($regs[1]); } elseif (preg_match("/msgid[[:space:]]+\"\"$/i", $line, $regs)) { $type = 2; - $translationKey = ""; + $translationKey = ''; } elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && ($type == 1 || $type == 2 || $type == 3)) { $type = 3; $translationKey .= stripcslashes($regs[1]); @@ -474,7 +474,7 @@ class I18n { $type = 4; } elseif (preg_match("/msgstr[[:space:]]+\"\"$/i", $line, $regs) && ($type == 1 || $type == 3) && $translationKey) { $type = 4; - $translations[$translationKey] = ""; + $translations[$translationKey] = ''; } elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 4 && $translationKey) { $translations[$translationKey] .= stripcslashes($regs[1]); } elseif (preg_match("/msgid_plural[[:space:]]+\".*\"$/i", $line, $regs)) { @@ -487,7 +487,7 @@ class I18n { $type = 7; } elseif (preg_match("/msgstr\[(\d+)\][[:space:]]+\"\"$/i", $line, $regs) && ($type == 6 || $type == 7) && $translationKey) { $plural = $regs[1]; - $translations[$translationKey][$plural] = ""; + $translations[$translationKey][$plural] = ''; $type = 7; } elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 7 && $translationKey) { $translations[$translationKey][$plural] .= stripcslashes($regs[1]); @@ -495,20 +495,20 @@ class I18n { $header .= stripcslashes($regs[1]); $type = 5; } elseif (preg_match("/msgstr[[:space:]]+\"\"$/i", $line, $regs) && !$translationKey) { - $header = ""; + $header = ''; $type = 5; } elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 5) { $header .= stripcslashes($regs[1]); } else { unset($translations[$translationKey]); $type = 0; - $translationKey = ""; + $translationKey = ''; $plural = 0; } } while (!feof($file)); fclose($file); - $merge[""] = $header; + $merge[''] = $header; return array_merge($merge, $translations); } @@ -519,7 +519,7 @@ class I18n { * @return mixed Array of definitions on success or false on failure */ public static function loadLocaleDefinition($filename) { - if (!$file = fopen($filename, "r")) { + if (!$file = fopen($filename, 'r')) { return false; } diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index fac17315f..75f5eed8b 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -988,7 +988,7 @@ class AuthComponentTest extends CakeTestCase { App::build(array( 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); - $_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest"; + $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; App::uses('Dispatcher', 'Routing'); diff --git a/lib/Cake/Test/Case/Utility/SanitizeTest.php b/lib/Cake/Test/Case/Utility/SanitizeTest.php index 86b75fc9e..16bad14b7 100644 --- a/lib/Cake/Test/Case/Utility/SanitizeTest.php +++ b/lib/Cake/Test/Case/Utility/SanitizeTest.php @@ -271,12 +271,12 @@ class SanitizeTest extends CakeTestCase { $this->assertEquals($expected, $result); $string = "x' AND 1=(SELECT COUNT(*) FROM users); --"; - $expected = "xAND1SELECTCOUNTFROMusers"; + $expected = 'xAND1SELECTCOUNTFROMusers'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); $string = "x'; DROP TABLE members; --"; - $expected = "xDROPTABLEmembers"; + $expected = 'xDROPTABLEmembers'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); } diff --git a/lib/Cake/Test/Case/Utility/SetTest.php b/lib/Cake/Test/Case/Utility/SetTest.php index ae130b2a7..465ac4706 100644 --- a/lib/Cake/Test/Case/Utility/SetTest.php +++ b/lib/Cake/Test/Case/Utility/SetTest.php @@ -2443,8 +2443,8 @@ class SetTest extends CakeTestCase { $expected->hash = '68a9f053b19526d08e36c6a9ad150737933816a5'; $expected->get_vars = ''; $expected->redirect = ''; - $expected->created = "1195055503"; - $expected->updated = "1195055503"; + $expected->created = '1195055503'; + $expected->updated = '1195055503'; // @codingStandardsIgnoreEnd $this->assertEquals($expected, $mapped[1]); @@ -2492,9 +2492,9 @@ class SetTest extends CakeTestCase { $expected->Author->id = '1'; $expected->Author->user = 'mariano'; $expected->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99'; - $expected->Author->created = "2007-03-17 01:16:23"; - $expected->Author->updated = "2007-03-17 01:18:31"; - $expected->Author->test = "working"; + $expected->Author->created = '2007-03-17 01:16:23'; + $expected->Author->updated = '2007-03-17 01:18:31'; + $expected->Author->test = 'working'; $expected->Author->_name_ = 'Author'; $expected2 = new stdClass; @@ -2511,9 +2511,9 @@ class SetTest extends CakeTestCase { $expected2->Author->id = '3'; $expected2->Author->user = 'larry'; $expected2->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99'; - $expected2->Author->created = "2007-03-17 01:20:23"; - $expected2->Author->updated = "2007-03-17 01:22:31"; - $expected2->Author->test = "working"; + $expected2->Author->created = '2007-03-17 01:20:23'; + $expected2->Author->updated = '2007-03-17 01:22:31'; + $expected2->Author->test = 'working'; $expected2->Author->_name_ = 'Author'; // @codingStandardsIgnoreEnd @@ -2546,7 +2546,7 @@ class SetTest extends CakeTestCase { $expected->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99'; $expected->Author->created = "2007-03-17 01:16:23"; $expected->Author->updated = "2007-03-17 01:18:31"; - $expected->Author->test = "working"; + $expected->Author->test = 'working'; $expected->Author->_name_ = 'Author'; // @codingStandardsIgnoreEnd $this->assertEquals($expected, $result); diff --git a/lib/Cake/TestSuite/Reporter/CakeTextReporter.php b/lib/Cake/TestSuite/Reporter/CakeTextReporter.php index 0469cce30..a1c20adde 100644 --- a/lib/Cake/TestSuite/Reporter/CakeTextReporter.php +++ b/lib/Cake/TestSuite/Reporter/CakeTextReporter.php @@ -162,7 +162,7 @@ class CakeTextReporter extends CakeBaseReporter { } if (1 > count($testCases)) { - $buffer .= "EMPTY"; + $buffer .= 'EMPTY'; echo $buffer; }