Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #873 from dereuromark/coding-standards

correcting coding-standards
  • Loading branch information...
commit 87fc86133c082963ebb55f58d8f4e39ca7011da5 2 parents e550332 + b7f1740
@markstory markstory authored
View
2  lib/Cake/Console/Command/Task/ControllerTask.php
@@ -432,7 +432,7 @@ public function getName($useDbConfig = null) {
}
}
- 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);
View
10 lib/Cake/Console/Command/Task/ModelTask.php
@@ -688,7 +688,7 @@ public function doMoreAssociations(Model $model, $associations) {
$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 @@ public function doMoreAssociations(Model $model, $associations) {
$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 @@ public function doMoreAssociations(Model $model, $associations) {
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 @@ public function doMoreAssociations(Model $model, $associations) {
$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;
}
View
4 lib/Cake/Model/Model.php
@@ -1881,7 +1881,7 @@ protected function _saveMulti($joined, $id, $db) {
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 @@ protected function _findFirst($state, $query, $results = array()) {
*/
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);
}
View
2  lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
@@ -694,7 +694,7 @@ public function testTestCaseFileName($type, $class, $expected) {
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';
View
2  lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
@@ -118,7 +118,7 @@ public function testAroAliases() {
$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
View
4 lib/Cake/Test/Case/I18n/I18nTest.php
@@ -1893,7 +1893,7 @@ private function __domainSingular($domain = 'test_plugin') {
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 @@ private function __singularFromCore() {
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;
}
View
116 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
@@ -636,8 +636,8 @@ public function testMoveUpSuccess() {
$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 @@ public function testMoveUpFail() {
$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 @@ public function testMoveUp2() {
$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 @@ public function testMoveUpFirst() {
$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 @@ public function testMoveDownSuccess() {
$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 @@ public function testMoveDownFail() {
$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 @@ public function testMoveDownLast() {
$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 @@ public function testMoveDown2() {
$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 @@ public function testSaveNoMove() {
$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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.