@@ -49,7 +49,7 @@ |
||
| 49 | 49 | public function select($columns = null, $table_alias = null): SelectInterface |
| 50 | 50 | { |
| 51 | 51 | $table_alias = $table_alias ?? $this->name(); |
| 52 | - $q = new Select($columns ?? [$table_alias . '.*'], $this, $table_alias); |
|
| 52 | + $q = new Select($columns ?? [$table_alias.'.*'], $this, $table_alias); |
|
| 53 | 53 | $q->connection($this->connection()); |
| 54 | 54 | return $q; |
| 55 | 55 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public function __construct($message, $code = 0, $previous = null) |
| 10 | 10 | { |
| 11 | - parent::__construct('CRUDITES_ERR_' . $message, $code, $previous); |
|
| 11 | + parent::__construct('CRUDITES_ERR_'.$message, $code, $previous); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function fromQuery(BaseQuery $Query) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | break; |
| 47 | 47 | |
| 48 | 48 | default: |
| 49 | - $ret = 'FUBAR #' . $state . '-' . $code . '-' . $message; |
|
| 49 | + $ret = 'FUBAR #'.$state.'-'.$code.'-'.$message; |
|
| 50 | 50 | break; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -180,7 +180,7 @@ |
||
| 180 | 180 | public function foreignTableAlias(): string |
| 181 | 181 | { |
| 182 | 182 | $ret = $this->foreignTableName(); |
| 183 | - if (preg_match('/(.+)_(' . $this->foreignColumnName() . ')$/', $this->name(), $m)) { |
|
| 183 | + if (preg_match('/(.+)_('.$this->foreignColumnName().')$/', $this->name(), $m)) { |
|
| 184 | 184 | $ret = $m[1]; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -28,9 +28,9 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function __toString() |
| 30 | 30 | { |
| 31 | - return PHP_EOL . 'load: ' |
|
| 31 | + return PHP_EOL.'load: ' |
|
| 32 | 32 | . json_encode($this->load) |
| 33 | - . PHP_EOL . 'alterations: ' |
|
| 33 | + . PHP_EOL.'alterations: ' |
|
| 34 | 34 | . json_encode(array_keys($this->alterations)); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | continue; // dont load the log information |
| 44 | 44 | } else { |
| 45 | 45 | $m = []; |
| 46 | - if (preg_match('/(.+)_(' . $fk_column->foreignColumnName() . ')$/', $fk_column->name(), $m)) { |
|
| 46 | + if (preg_match('/(.+)_('.$fk_column->foreignColumnName().')$/', $fk_column->name(), $m)) { |
|
| 47 | 47 | $foreign_table_alias = $m[1]; |
| 48 | 48 | } else { |
| 49 | 49 | $foreign_table_alias = $foreign_table_name; |
| 50 | 50 | } |
| 51 | - $foreign_table_alias = $single_fk === true ? $foreign_table_alias : $foreign_table_alias . '_' . $fk_column->name(); |
|
| 51 | + $foreign_table_alias = $single_fk === true ? $foreign_table_alias : $foreign_table_alias.'_'.$fk_column->name(); |
|
| 52 | 52 | |
| 53 | 53 | // auto select non nullable columns |
| 54 | 54 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | public function join($table_names, $joins, $join_type = '') |
| 71 | 71 | { |
| 72 | - list($join_table_name,$join_table_alias) = self::processParamTableNames($table_names); |
|
| 72 | + list($join_table_name, $join_table_alias) = self::processParamTableNames($table_names); |
|
| 73 | 73 | |
| 74 | 74 | if (preg_match('/^(INNER|LEFT|RIGHT|FULL)(\sOUTER)?/i', $join_type) !== 1) { |
| 75 | 75 | $join_type = ''; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | if (is_null($other_table->column("$select_field"))) { |
| 160 | 160 | $computed_selection = "$select_field"; // table column does not exist, no nood to prefix |
| 161 | 161 | } else { |
| 162 | - $computed_selection = "$other_table_alias.$select_field as " . $other_table_alias . "_$select_field"; |
|
| 162 | + $computed_selection = "$other_table_alias.$select_field as ".$other_table_alias."_$select_field"; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // vd($computed_selection); |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | foreach ($join_fields as $join_cond) { |
| 180 | 180 | if (isset($join_cond[3])) { // 4 joins param -> t.f = t.f |
| 181 | 181 | list($table, $field, $join_table, $join_table_field) = $join_cond; |
| 182 | - $join_parts [] = $this->backTick($field, $table) . ' = ' . $this->backTick($join_table_field, $join_table); |
|
| 182 | + $join_parts [] = $this->backTick($field, $table).' = '.$this->backTick($join_table_field, $join_table); |
|
| 183 | 183 | } elseif (isset($join_cond[2])) { // 3 joins param -> t.f = v |
| 184 | 184 | list($table, $field, $value) = $join_cond; |
| 185 | - $bind_label = ':loj_' . $join_table_alias . '_' . $table . '_' . $field; |
|
| 185 | + $bind_label = ':loj_'.$join_table_alias.'_'.$table.'_'.$field; |
|
| 186 | 186 | $this->addBinding($field, $value, null, $bind_label); |
| 187 | 187 | |
| 188 | - $join_parts [] = $this->backTick($field, $table) . ' = ' . $bind_label; |
|
| 188 | + $join_parts [] = $this->backTick($field, $table).' = '.$bind_label; |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | return sprintf('%s JOIN `%s` %s ON %s', $join_type, $join_table_name, $join_table_alias, implode(' AND ', $join_parts)); |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $value = 0; |
| 45 | 45 | } |
| 46 | 46 | $binding_names[$field_name] = $this->addBinding($field_name, $value); |
| 47 | - $this->alterations [] = $this->backTick($field_name) . ' = ' . $binding_names[$field_name]; |
|
| 47 | + $this->alterations [] = $this->backTick($field_name).' = '.$binding_names[$field_name]; |
|
| 48 | 48 | } |
| 49 | 49 | return $binding_names; |
| 50 | 50 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | public function bindLabel($field, $table_name = null): string |
| 140 | 140 | { |
| 141 | - return ':' . $this->tableLabel($table_name) . '_' . $field; |
|
| 141 | + return ':'.$this->tableLabel($table_name).'_'.$field; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | //------------------------------------------------------------ Run |
@@ -157,8 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if ($this->prepared_statement->execute($this->getBindings()) !== false) { |
| 160 | - // execute returns TRUE on success or FALSE on failure. |
|
| 161 | - ++self::$executions; |
|
| 160 | + // execute returns TRUE on success or FALSE on failure.++self::$executions; |
|
| 162 | 161 | |
| 163 | 162 | $this->isExecuted(true); |
| 164 | 163 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | throw new CruditesException('INSERT_FIELDS_BINDINGS_MISMATCH'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $fields = '`' . implode('`, `', $this->query_fields) . '`'; |
|
| 50 | + $fields = '`'.implode('`, `', $this->query_fields).'`'; |
|
| 51 | 51 | $values = implode(', ', array_keys($this->bindings)); |
| 52 | 52 | |
| 53 | 53 | return sprintf('INSERT INTO `%s` (%s) VALUES (%s)', $this->table, $fields, $values); |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function whereEQ($field, $value, $table_name = null, $bindname = null) |
| 51 | 51 | { |
| 52 | - return $this->whereBindField($table_name, $field, self::$OP_EQ, $value, $bindname); |
|
| 52 | + return $this->whereBindField($table_name, $field, self::$OP_EQ, $value, $bindname); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function whereGT($field, $value, $table_name = null, $bindname = null) |
| 56 | 56 | { |
| 57 | - return $this->whereBindField($table_name, $field, self::$OP_GT, $value, $bindname); |
|
| 57 | + return $this->whereBindField($table_name, $field, self::$OP_GT, $value, $bindname); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function whereLT($field, $value, $table_name = null, $bindname = null) |
| 61 | 61 | { |
| 62 | - return $this->whereBindField($table_name, $field, self::$OP_LT, $value, $bindname); |
|
| 62 | + return $this->whereBindField($table_name, $field, self::$OP_LT, $value, $bindname); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function whereGTE($field, $value, $table_name = null, $bindname = null) |
| 66 | 66 | { |
| 67 | - return $this->whereBindField($table_name, $field, self::$OP_GTE, $value, $bindname); |
|
| 67 | + return $this->whereBindField($table_name, $field, self::$OP_GTE, $value, $bindname); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function whereLTE($field, $value, $table_name = null, $bindname = null) |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param $filters_operator Object, inclusive or exclusive search |
| 172 | 172 | */ |
| 173 | 173 | |
| 174 | - // sub array filters[$content] |
|
| 174 | + // sub array filters[$content] |
|
| 175 | 175 | public function whereFilterContent($filters_content, $search_table = null, $filters_operator = null) |
| 176 | 176 | { |
| 177 | 177 | if (!isset($filters_content['term']) || !isset($filters_content['fields'])) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $in = ''; |
| 133 | 133 | foreach ($values as $i => $v) { |
| 134 | 134 | // TODO dirty patching. mathematical certainty needed |
| 135 | - $placeholder_name = ':' . $table_name . '_' . $field . '_awS_in_' . $count_values . '_' . $i; |
|
| 135 | + $placeholder_name = ':'.$table_name.'_'.$field.'_awS_in_'.$count_values.'_'.$i; |
|
| 136 | 136 | $this->addBinding($field, $v, null, $placeholder_name); |
| 137 | 137 | $in .= "$placeholder_name,"; |
| 138 | 138 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | protected function generateWhere() |
| 232 | 232 | { |
| 233 | 233 | if (!empty($this->where)) { |
| 234 | - return PHP_EOL . ' WHERE ' . implode(PHP_EOL . ' AND ', $this->where); |
|
| 234 | + return PHP_EOL.' WHERE '.implode(PHP_EOL.' AND ', $this->where); |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } |