From b7f1740d2bc1aaff2ee6a014a0600238a396b877 Mon Sep 17 00:00:00 2001 From: euromark Date: Fri, 28 Sep 2012 13:49:51 +0200 Subject: [PATCH] correcting coding-standards --- .../Console/Command/Task/ControllerTask.php | 2 +- lib/Cake/Console/Command/Task/ModelTask.php | 10 +- lib/Cake/Model/Model.php | 4 +- .../Console/Command/Task/TestTaskTest.php | 2 +- .../Controller/Component/Acl/PhpAclTest.php | 2 +- lib/Cake/Test/Case/I18n/I18nTest.php | 4 +- .../Model/Behavior/TreeBehaviorNumberTest.php | 116 +++++++++--------- 7 files changed, 70 insertions(+), 70 deletions(-) diff --git a/lib/Cake/Console/Command/Task/ControllerTask.php b/lib/Cake/Console/Command/Task/ControllerTask.php index 8feecc1a5..4da40184e 100644 --- a/lib/Cake/Console/Command/Task/ControllerTask.php +++ b/lib/Cake/Console/Command/Task/ControllerTask.php @@ -432,7 +432,7 @@ class ControllerTask extends BakeTask { } } - if (intval($enteredController) > 0 && intval($enteredController) <= count($controllers) ) { + if (intval($enteredController) > 0 && intval($enteredController) <= count($controllers)) { $controllerName = $controllers[intval($enteredController) - 1]; } else { $controllerName = Inflector::camelize($enteredController); diff --git a/lib/Cake/Console/Command/Task/ModelTask.php b/lib/Cake/Console/Command/Task/ModelTask.php index df2725d1f..038d4cd91 100644 --- a/lib/Cake/Console/Command/Task/ModelTask.php +++ b/lib/Cake/Console/Command/Task/ModelTask.php @@ -688,7 +688,7 @@ class ModelTask extends BakeTask { $prompt = __d('cake_console', 'Would you like to define some additional model associations?'); $wannaDoMoreAssoc = $this->in($prompt, array('y', 'n'), 'n'); $possibleKeys = $this->_generatePossibleKeys(); - while (strtolower($wannaDoMoreAssoc) == 'y') { + while (strtolower($wannaDoMoreAssoc) === 'y') { $assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); $this->out(__d('cake_console', 'What is the association type?')); $assocType = intval($this->inOptions($assocs, __d('cake_console', 'Enter a number'))); @@ -698,9 +698,9 @@ class ModelTask extends BakeTask { $this->hr(); $alias = $this->in(__d('cake_console', 'What is the alias for this association?')); - $className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias ); + $className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias); - if ($assocType == 0) { + if ($assocType === 0) { if (!empty($possibleKeys[$model->table])) { $showKeys = $possibleKeys[$model->table]; } else { @@ -733,7 +733,7 @@ class ModelTask extends BakeTask { if (!isset($foreignKey)) { $foreignKey = $this->in(__d('cake_console', 'What is the foreignKey? Specify your own.'), null, $suggestedForeignKey); } - if ($assocType == 3) { + if ($assocType === 3) { $associationForeignKey = $this->in(__d('cake_console', 'What is the associationForeignKey?'), null, $this->_modelKey($model->name)); $joinTable = $this->in(__d('cake_console', 'What is the joinTable?')); } @@ -743,7 +743,7 @@ class ModelTask extends BakeTask { $associations[$assocs[$assocType]][$i]['alias'] = $alias; $associations[$assocs[$assocType]][$i]['className'] = $className; $associations[$assocs[$assocType]][$i]['foreignKey'] = $foreignKey; - if ($assocType == 3) { + if ($assocType === 3) { $associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey; $associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index a9a3aa2a6..940c64a02 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1881,7 +1881,7 @@ class Model extends Object implements CakeEventListener { if ($keepExisting && !empty($links)) { foreach ($links as $link) { $oldJoin = $link[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']]; - if (! in_array($oldJoin, $newJoins) ) { + if (!in_array($oldJoin, $newJoins)) { $conditions[$associationForeignKey] = $oldJoin; $db->delete($this->{$join}, $conditions); } else { @@ -2735,7 +2735,7 @@ class Model extends Object implements CakeEventListener { */ protected function _findCount($state, $query, $results = array()) { if ($state === 'before') { - if (!empty($query['type']) && isset($this->findMethods[$query['type']]) && $query['type'] !== 'count' ) { + if (!empty($query['type']) && isset($this->findMethods[$query['type']]) && $query['type'] !== 'count') { $query['operation'] = 'count'; $query = $this->{'_find' . ucfirst($query['type'])}('before', $query); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php index 7eb5fa8b4..6fad8069e 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php @@ -694,7 +694,7 @@ class TestTaskTest extends CakeTestCase { public function testTestCaseFileNamePlugin() { $this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS; - CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS )); + CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS)); $this->Task->plugin = 'TestTest'; $result = $this->Task->testCaseFileName('Model', 'Post'); $expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php'; diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php index 92543b396..00f74bcf5 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php @@ -118,7 +118,7 @@ class PhpAclTest extends CakeTestCase { $this->Acl->Aro->addAlias(array('Role/25' => 'Role/IT')); $this->Acl->allow('Role/IT', '/rules/debugging/*'); - $this->assertEquals(array(array('Role/IT', )), $this->Acl->Aro->roles($user)); + $this->assertEquals(array(array('Role/IT')), $this->Acl->Aro->roles($user)); $this->assertTrue($this->Acl->check($user, '/rules/debugging/stats/pageload')); $this->assertTrue($this->Acl->check($user, '/rules/debugging/sql/queries')); // Role/default is allowed users dashboard, but not Role/IT diff --git a/lib/Cake/Test/Case/I18n/I18nTest.php b/lib/Cake/Test/Case/I18n/I18nTest.php index 637494012..a6a65533f 100644 --- a/lib/Cake/Test/Case/I18n/I18nTest.php +++ b/lib/Cake/Test/Case/I18n/I18nTest.php @@ -1893,7 +1893,7 @@ class I18nTest extends CakeTestCase { private function __domainPlural($domain = 'test_plugin') { $plurals = array(); for ($number = 0; $number <= 25; $number++) { - $plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number ); + $plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); } return $plurals; } @@ -1949,7 +1949,7 @@ class I18nTest extends CakeTestCase { private function __pluralFromCore() { $plurals = array(); for ($number = 0; $number <= 25; $number++) { - $plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number ); + $plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number); } return $plurals; } diff --git a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php index d93c6334e..f71378a14 100644 --- a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php @@ -636,8 +636,8 @@ class TreeBehaviorNumberTest extends CakeTestCase { $parent = $this->Tree->findByName('1. Root', array('id')); $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); - $expected = array(array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.1', ))); + $expected = array(array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.1'))); $this->assertSame($expected, $result); } @@ -658,8 +658,8 @@ class TreeBehaviorNumberTest extends CakeTestCase { $parent = $this->Tree->findByName('1. Root', array('id')); $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); - $expected = array(array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', ))); + $expected = array(array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2'))); $this->assertSame($expected, $result); } @@ -680,16 +680,16 @@ class TreeBehaviorNumberTest extends CakeTestCase { $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); $expected = array( - array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.5', )), - array($modelClass => array('name' => '1.3', )), - array($modelClass => array('name' => '1.4', )), - array($modelClass => array('name' => '1.6', )), - array($modelClass => array('name' => '1.7', )), - array($modelClass => array('name' => '1.8', )), - array($modelClass => array('name' => '1.9', )), - array($modelClass => array('name' => '1.10', ))); + array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.5')), + array($modelClass => array('name' => '1.3')), + array($modelClass => array('name' => '1.4')), + array($modelClass => array('name' => '1.6')), + array($modelClass => array('name' => '1.7')), + array($modelClass => array('name' => '1.8')), + array($modelClass => array('name' => '1.9')), + array($modelClass => array('name' => '1.10'))); $this->assertSame($expected, $result); } @@ -710,16 +710,16 @@ class TreeBehaviorNumberTest extends CakeTestCase { $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); $expected = array( - array($modelClass => array('name' => '1.5', )), - array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.3', )), - array($modelClass => array('name' => '1.4', )), - array($modelClass => array('name' => '1.6', )), - array($modelClass => array('name' => '1.7', )), - array($modelClass => array('name' => '1.8', )), - array($modelClass => array('name' => '1.9', )), - array($modelClass => array('name' => '1.10', ))); + array($modelClass => array('name' => '1.5')), + array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.3')), + array($modelClass => array('name' => '1.4')), + array($modelClass => array('name' => '1.6')), + array($modelClass => array('name' => '1.7')), + array($modelClass => array('name' => '1.8')), + array($modelClass => array('name' => '1.9')), + array($modelClass => array('name' => '1.10'))); $this->assertSame($expected, $result); } @@ -739,8 +739,8 @@ class TreeBehaviorNumberTest extends CakeTestCase { $parent = $this->Tree->findByName('1. Root', array('id')); $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); - $expected = array(array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.1', ))); + $expected = array(array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.1'))); $this->assertSame($expected, $result); } @@ -760,8 +760,8 @@ class TreeBehaviorNumberTest extends CakeTestCase { $parent = $this->Tree->findByName('1. Root', array('id')); $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); - $expected = array(array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', ))); + $expected = array(array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2'))); $this->assertSame($expected, $result); } @@ -782,16 +782,16 @@ class TreeBehaviorNumberTest extends CakeTestCase { $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); $expected = array( - array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.3', )), - array($modelClass => array('name' => '1.4', )), - array($modelClass => array('name' => '1.6', )), - array($modelClass => array('name' => '1.7', )), - array($modelClass => array('name' => '1.8', )), - array($modelClass => array('name' => '1.9', )), - array($modelClass => array('name' => '1.10', )), - array($modelClass => array('name' => '1.5', ))); + array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.3')), + array($modelClass => array('name' => '1.4')), + array($modelClass => array('name' => '1.6')), + array($modelClass => array('name' => '1.7')), + array($modelClass => array('name' => '1.8')), + array($modelClass => array('name' => '1.9')), + array($modelClass => array('name' => '1.10')), + array($modelClass => array('name' => '1.5'))); $this->assertSame($expected, $result); } @@ -812,16 +812,16 @@ class TreeBehaviorNumberTest extends CakeTestCase { $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); $expected = array( - array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.3', )), - array($modelClass => array('name' => '1.4', )), - array($modelClass => array('name' => '1.6', )), - array($modelClass => array('name' => '1.7', )), - array($modelClass => array('name' => '1.5', )), - array($modelClass => array('name' => '1.8', )), - array($modelClass => array('name' => '1.9', )), - array($modelClass => array('name' => '1.10', ))); + array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.3')), + array($modelClass => array('name' => '1.4')), + array($modelClass => array('name' => '1.6')), + array($modelClass => array('name' => '1.7')), + array($modelClass => array('name' => '1.5')), + array($modelClass => array('name' => '1.8')), + array($modelClass => array('name' => '1.9')), + array($modelClass => array('name' => '1.10'))); $this->assertSame($expected, $result); } @@ -842,16 +842,16 @@ class TreeBehaviorNumberTest extends CakeTestCase { $this->Tree->id = $parent[$modelClass]['id']; $result = $this->Tree->children(null, true, array('name')); $expected = array( - array($modelClass => array('name' => '1.1', )), - array($modelClass => array('name' => '1.2', )), - array($modelClass => array('name' => '1.3', )), - array($modelClass => array('name' => '1.4', )), - array($modelClass => array('name' => 'renamed', )), - array($modelClass => array('name' => '1.6', )), - array($modelClass => array('name' => '1.7', )), - array($modelClass => array('name' => '1.8', )), - array($modelClass => array('name' => '1.9', )), - array($modelClass => array('name' => '1.10', ))); + array($modelClass => array('name' => '1.1')), + array($modelClass => array('name' => '1.2')), + array($modelClass => array('name' => '1.3')), + array($modelClass => array('name' => '1.4')), + array($modelClass => array('name' => 'renamed')), + array($modelClass => array('name' => '1.6')), + array($modelClass => array('name' => '1.7')), + array($modelClass => array('name' => '1.8')), + array($modelClass => array('name' => '1.9')), + array($modelClass => array('name' => '1.10'))); $this->assertSame($expected, $result); }