Permalink
Browse files

Some typo fixes.

  • Loading branch information...
1 parent 9b19605 commit 189f746100ba361887ead3ade6a27598cd9cbd09 @jails jails committed Apr 5, 2013
View
@@ -784,7 +784,7 @@ protected function _entityConditions() {
}
$key = $model::key($this->_entity->data());
- if (!$key && $this->_type != "create") {
+ if (!$key && $this->_type !== 'create') {
throw new ConfigException('No matching primary key found.');
}
if (is_array($key)) {
View
@@ -1474,11 +1474,12 @@ public function on($rel, $aliasFrom = null, $aliasTo = null, $constraints = arra
protected function _on(array $constraints, $aliasFrom, $aliasTo, $mapAlias = array()) {
$result = array();
foreach ($constraints as $key => $value) {
- if (
+ $isAliasable = (
!is_numeric($key) &&
!isset($this->_constraintTypes[$key]) &&
!isset($this->_operators[$key])
- ) {
+ );
+ if ($isAliasable) {
$key = $this->_aliasing($key, $aliasFrom, $mapAlias);
}
if (is_string($value)) {
@@ -1645,7 +1646,7 @@ protected function _buildconstraints(array $constraints, $schema = null, $joiner
if ($meta = $this->_constraint($name, $constraint, $schema)) {
$result .= $joiner . $meta;
}
- if ($name == 'primary') {
+ if ($name === 'primary') {
$primary = false;
}
}
@@ -238,10 +238,10 @@ public function describe($entity, $fields = array(), array $meta = array()) {
$default = $column['default'];
}
$fields[$column['field']] = $match + array(
- 'null' => ($column['null'] == 'YES' ? true : false),
+ 'null' => ($column['null'] === 'YES' ? true : false),
'default' => $default
);
- if ($fields[$column['field']]['type'] == 'string') {
+ if ($fields[$column['field']]['type'] === 'string') {
$fields[$column['field']]['length'] = $column['char_length'];
}
}
@@ -342,7 +342,7 @@ public function error() {
}
public function alias($alias, $context) {
- if ($context->type() == 'update' || $context->type() == 'delete') {
+ if ($context->type() === 'update' || $context->type() === 'delete') {
return;
}
return parent::alias($alias, $context);
@@ -429,23 +429,23 @@ protected function _column($real) {
switch (true) {
case in_array($column['type'], array('date', 'time', 'datetime')):
return $column;
- case ($column['type'] == 'timestamp'):
+ case ($column['type'] === 'timestamp'):
$column['type'] = 'datetime';
break;
- case ($column['type'] == 'tinyint' && $column['length'] == '1'):
- case ($column['type'] == 'boolean'):
+ case ($column['type'] === 'tinyint' && $column['length'] == '1'):
+ case ($column['type'] === 'boolean'):
return array('type' => 'boolean');
break;
case (strpos($column['type'], 'int') !== false):
$column['type'] = 'integer';
break;
- case (strpos($column['type'], 'char') !== false || $column['type'] == 'tinytext'):
+ case (strpos($column['type'], 'char') !== false || $column['type'] === 'tinytext'):
$column['type'] = 'string';
break;
case (strpos($column['type'], 'text') !== false):
$column['type'] = 'text';
break;
- case (strpos($column['type'], 'blob') !== false || $column['type'] == 'binary'):
+ case (strpos($column['type'], 'blob') !== false || $column['type'] === 'binary'):
$column['type'] = 'binary';
break;
case preg_match('/float|double|decimal/', $column['type']):
@@ -327,7 +327,7 @@ protected function _column($real) {
case (strpos($column['type'], 'int') !== false):
$column['type'] = 'integer';
break;
- case (strpos($column['type'], 'char') !== false ):
+ case (strpos($column['type'], 'char') !== false):
$column['type'] = 'string';
$column['length'] = 255;
break;
@@ -750,7 +750,7 @@ public function testConditions() {
$query = new Query(array(
'type' => 'read', 'model' => $this->_model,
- 'conditions' => array( (object) 'lower(title) = \'test\'')
+ 'conditions' => array((object) 'lower(title) = \'test\'')
));
$this->assertEqual($sql, $this->db->renderCommand($query));
@@ -760,14 +760,14 @@ public function testConditions() {
$query = new Query(array(
'type' => 'read', 'model' => $this->_model,
- 'conditions' => array( (object) 'lower(title) = REGEXP \'^test$\'')
+ 'conditions' => array((object) 'lower(title) = REGEXP \'^test$\'')
));
$this->assertEqual($sql, $this->db->renderCommand($query));
$query = new Query(array(
'type' => 'read', 'model' => $this->_model,
- 'conditions' => array( 'lower(title)' => (object) 'REGEXP \'^test$\'')
+ 'conditions' => array('lower(title)' => (object) 'REGEXP \'^test$\'')
));
$this->assertEqual($sql, $this->db->renderCommand($query));
@@ -118,7 +118,7 @@ public function testCustomWithFormat() {
};
Validator::add('test', $function);
$validations = array(
- 'inputName' => array( array( 'test', 'message' => 'foobar', 'format' => 'string' ) )
+ 'inputName' => array(array('test', 'message' => 'foobar', 'format' => 'string'))
);
$values = array(
'inputName' => 'blah'
@@ -63,7 +63,7 @@ public function access($var) {
return $this->{$var};
}
- protected function _stop($status = 0 ) {
+ protected function _stop($status = 0) {
$this->stopped = true;
}
}
View
@@ -288,8 +288,8 @@ public static function pluralize($word) {
extract(static::$_plural);
if (!isset($regexUninflected) || !isset($regexIrregular)) {
- $regexUninflected = static::_enclose(join( '|', $uninflected + static::$_uninflected));
- $regexIrregular = static::_enclose(join( '|', array_keys($irregular)));
+ $regexUninflected = static::_enclose(join('|', $uninflected + static::$_uninflected));
+ $regexIrregular = static::_enclose(join('|', array_keys($irregular)));
static::$_plural += compact('regexUninflected', 'regexIrregular');
}
if (preg_match('/(' . $regexUninflected . ')$/i', $word, $regs)) {

0 comments on commit 189f746

Please sign in to comment.