@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | function __construct($conditions, $pipe = "") |
| 33 | 33 | { |
| 34 | 34 | $this->conditions = array(); |
| 35 | - foreach($conditions as $condition) |
|
| 35 | + foreach ($conditions as $condition) |
|
| 36 | 36 | { |
| 37 | - if($condition->show()) |
|
| 37 | + if ($condition->show()) |
|
| 38 | 38 | { |
| 39 | 39 | $this->conditions[] = $condition; |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | - if(count($this->conditions) === 0) |
|
| 42 | + if (count($this->conditions) === 0) |
|
| 43 | 43 | { |
| 44 | 44 | $this->_show = false; |
| 45 | 45 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | function setPipe($pipe) |
| 60 | 60 | { |
| 61 | - if($this->pipe !== $pipe) |
|
| 61 | + if ($this->pipe !== $pipe) |
|
| 62 | 62 | { |
| 63 | 63 | $this->_group = null; |
| 64 | 64 | } |
@@ -72,24 +72,24 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function toString($with_value = true) |
| 74 | 74 | { |
| 75 | - if(!isset($this->_group)) |
|
| 75 | + if (!isset($this->_group)) |
|
| 76 | 76 | { |
| 77 | 77 | $cond_indx = 0; |
| 78 | 78 | $group = ''; |
| 79 | 79 | |
| 80 | - foreach($this->conditions as $condition) |
|
| 80 | + foreach ($this->conditions as $condition) |
|
| 81 | 81 | { |
| 82 | - if($cond_indx === 0) |
|
| 82 | + if ($cond_indx === 0) |
|
| 83 | 83 | { |
| 84 | 84 | $condition->setPipe(""); |
| 85 | 85 | } |
| 86 | - $group .= $condition->toString($with_value) . ' '; |
|
| 86 | + $group .= $condition->toString($with_value).' '; |
|
| 87 | 87 | $cond_indx++; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if($this->pipe !== "" && trim($group) !== '') |
|
| 90 | + if ($this->pipe !== "" && trim($group) !== '') |
|
| 91 | 91 | { |
| 92 | - $group = $this->pipe . ' (' . $group . ')'; |
|
| 92 | + $group = $this->pipe.' ('.$group.')'; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $this->_group = $group; |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | function getArguments() |
| 105 | 105 | { |
| 106 | 106 | $args = array(); |
| 107 | - foreach($this->conditions as $condition) |
|
| 107 | + foreach ($this->conditions as $condition) |
|
| 108 | 108 | { |
| 109 | 109 | $arg = $condition->getArgument(); |
| 110 | - if($arg) |
|
| 110 | + if ($arg) |
|
| 111 | 111 | { |
| 112 | 112 | $args[] = $arg; |
| 113 | 113 | } |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | if(count($this->conditions) === 0) |
| 43 | 43 | { |
| 44 | 44 | $this->_show = false; |
| 45 | - } |
|
| 46 | - else |
|
| 45 | + } else |
|
| 47 | 46 | { |
| 48 | 47 | $this->_show = true; |
| 49 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | function isJoinTable() |
| 58 | 58 | { |
| 59 | - if($this->join_type) |
|
| 59 | + if ($this->join_type) |
|
| 60 | 60 | { |
| 61 | 61 | return true; |
| 62 | 62 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $oDB = &DB::getInstance(); |
| 69 | 69 | |
| 70 | - return '(' . $oDB->getSelectSql($this, $with_values) . ')'; |
|
| 70 | + return '('.$oDB->getSelectSql($this, $with_values).')'; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | function isSubquery() |
@@ -38,21 +38,21 @@ |
||
| 38 | 38 | { |
| 39 | 39 | // TODO Escape value according to column type instead of variable type |
| 40 | 40 | $value = $this->argument; |
| 41 | - if(!is_numeric($value)) |
|
| 41 | + if (!is_numeric($value)) |
|
| 42 | 42 | { |
| 43 | - return "'" . $value . "'"; |
|
| 43 | + return "'".$value."'"; |
|
| 44 | 44 | } |
| 45 | 45 | return $value; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | function show() |
| 49 | 49 | { |
| 50 | - if(!$this->argument) |
|
| 50 | + if (!$this->argument) |
|
| 51 | 51 | { |
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | $value = $this->argument; |
| 55 | - if(!isset($value)) |
|
| 55 | + if (!isset($value)) |
|
| 56 | 56 | { |
| 57 | 57 | return false; |
| 58 | 58 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | function getExpression() |
| 44 | 44 | { |
| 45 | - return sprintf("%s%s", $this->column_name, $this->column_alias ? " as " . $this->column_alias : ""); |
|
| 45 | + return sprintf("%s%s", $this->column_name, $this->column_alias ? " as ".$this->column_alias : ""); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | function show() |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | function getValue($with_values = true) |
| 33 | 33 | { |
| 34 | - if($with_values) |
|
| 34 | + if ($with_values) |
|
| 35 | 35 | { |
| 36 | 36 | return $this->argument->getValue(); |
| 37 | 37 | } |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | function show() |
| 42 | 42 | { |
| 43 | - if(!$this->argument) |
|
| 43 | + if (!$this->argument) |
|
| 44 | 44 | { |
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | $value = $this->argument->getValue(); |
| 48 | - if(!isset($value)) |
|
| 48 | + if (!isset($value)) |
|
| 49 | 49 | { |
| 50 | 50 | return false; |
| 51 | 51 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | function getArguments() |
| 61 | 61 | { |
| 62 | - if($this->argument) |
|
| 62 | + if ($this->argument) |
|
| 63 | 63 | { |
| 64 | 64 | return array($this->argument); |
| 65 | 65 | } |
@@ -62,8 +62,7 @@ |
||
| 62 | 62 | if($this->argument) |
| 63 | 63 | { |
| 64 | 64 | return array($this->argument); |
| 65 | - } |
|
| 66 | - else |
|
| 65 | + } else |
|
| 67 | 66 | { |
| 68 | 67 | return array(); |
| 69 | 68 | } |
@@ -42,16 +42,16 @@ |
||
| 42 | 42 | function getValue() |
| 43 | 43 | { |
| 44 | 44 | // TODO Escape value according to column type instead of variable type |
| 45 | - if(!is_numeric($this->value)) |
|
| 45 | + if (!is_numeric($this->value)) |
|
| 46 | 46 | { |
| 47 | - return "'" . $this->value . "'"; |
|
| 47 | + return "'".$this->value."'"; |
|
| 48 | 48 | } |
| 49 | 49 | return $this->value; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | function show() |
| 53 | 53 | { |
| 54 | - if(!$this->value) |
|
| 54 | + if (!$this->value) |
|
| 55 | 55 | { |
| 56 | 56 | return false; |
| 57 | 57 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | parent::__construct($column_name, $alias); |
| 29 | 29 | |
| 30 | - if(!is_bool($click_count)) |
|
| 30 | + if (!is_bool($click_count)) |
|
| 31 | 31 | { |
| 32 | 32 | // error_log("Click_count value for $column_name was not boolean", 0); |
| 33 | 33 | $this->click_count = false; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | function getExpression() |
| 48 | 48 | { |
| 49 | 49 | $db_type = Context::getDBType(); |
| 50 | - if($db_type == 'cubrid') |
|
| 50 | + if ($db_type == 'cubrid') |
|
| 51 | 51 | { |
| 52 | 52 | return "INCR($this->column_name)"; |
| 53 | 53 | } |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | if($db_type == 'cubrid') |
| 51 | 51 | { |
| 52 | 52 | return "INCR($this->column_name)"; |
| 53 | - } |
|
| 54 | - else |
|
| 53 | + } else |
|
| 55 | 54 | { |
| 56 | 55 | return "$this->column_name"; |
| 57 | 56 | } |
@@ -52,13 +52,13 @@ |
||
| 52 | 52 | $db_info = Context::getDBInfo(); |
| 53 | 53 | $prefix = $db_info->master_db["db_table_prefix"]; |
| 54 | 54 | |
| 55 | - foreach($this->index_hints_list as $index_hint) |
|
| 55 | + foreach ($this->index_hints_list as $index_hint) |
|
| 56 | 56 | { |
| 57 | 57 | $index_hint_type = $index_hint->getIndexHintType(); |
| 58 | - if($index_hint_type !== 'IGNORE') |
|
| 58 | + if ($index_hint_type !== 'IGNORE') |
|
| 59 | 59 | { |
| 60 | - $result .= $this->alias . '.' |
|
| 61 | - . '"' . $prefix . substr($index_hint->getIndexName(), 1) |
|
| 60 | + $result .= $this->alias.'.' |
|
| 61 | + . '"'.$prefix.substr($index_hint->getIndexName(), 1) |
|
| 62 | 62 | . ($index_hint_type == 'FORCE' ? '(+)' : '') |
| 63 | 63 | . ', '; |
| 64 | 64 | } |
@@ -46,17 +46,17 @@ |
||
| 46 | 46 | |
| 47 | 47 | $index_hint_string = ''; |
| 48 | 48 | $indexTypeList = array('USE' => 1, 'FORCE' => 1); |
| 49 | - foreach($this->index_hints_list as $index_hint) |
|
| 49 | + foreach ($this->index_hints_list as $index_hint) |
|
| 50 | 50 | { |
| 51 | 51 | $index_hint_type = $index_hint->getIndexHintType(); |
| 52 | - if(isset($indexTypeList[$index_hint_type])) |
|
| 52 | + if (isset($indexTypeList[$index_hint_type])) |
|
| 53 | 53 | { |
| 54 | - $index_hint_string .= 'INDEX(' . $index_hint->getIndexName() . '), '; |
|
| 54 | + $index_hint_string .= 'INDEX('.$index_hint->getIndexName().'), '; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | - if($index_hint_string != '') |
|
| 57 | + if ($index_hint_string != '') |
|
| 58 | 58 | { |
| 59 | - $result .= ' WITH(' . substr($index_hint_string, 0, -2) . ') '; |
|
| 59 | + $result .= ' WITH('.substr($index_hint_string, 0, -2).') '; |
|
| 60 | 60 | } |
| 61 | 61 | return $result; |
| 62 | 62 | } |