correcting coding-standards

This commit is contained in:
euromark 2012-09-28 13:49:51 +02:00
parent 76d21c6d56
commit b7f1740d2b
7 changed files with 70 additions and 70 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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';

View file

@ -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

View file

@ -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;
}

View file

@ -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);
}