@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | { |
67 | 67 | if (!(class_exists($this->handler->className) && $object instanceof $this->handler->className)) { |
68 | 68 | trigger_error( |
69 | - "Object '" . get_class($object) . "' is not an instance of '" . $this->handler->className . "'", |
|
69 | + "Object '".get_class($object)."' is not an instance of '".$this->handler->className."'", |
|
70 | 70 | E_USER_NOTICE |
71 | 71 | ); |
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | if (!$object->isDirty()) { |
75 | 75 | trigger_error( |
76 | - "Data entry is not inserted - the object '" . get_class($object) . "' is not dirty", |
|
76 | + "Data entry is not inserted - the object '".get_class($object)."' is not dirty", |
|
77 | 77 | E_USER_NOTICE |
78 | 78 | ); |
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | if (!$this->cleanVars($object)) { |
82 | 82 | trigger_error( |
83 | - "Insert failed in method 'cleanVars' of object '" . get_class($object) . "'" . $object->getHtmlErrors(), |
|
83 | + "Insert failed in method 'cleanVars' of object '".get_class($object)."'".$object->getHtmlErrors(), |
|
84 | 84 | E_USER_WARNING |
85 | 85 | ); |
86 | 86 | return false; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($object->isNew()) { |
90 | 90 | if (empty($object->cleanVars)) { |
91 | 91 | trigger_error( |
92 | - "Data entry is not inserted - no variable is changed in object of '" . get_class($object) . "'", |
|
92 | + "Data entry is not inserted - no variable is changed in object of '".get_class($object)."'", |
|
93 | 93 | E_USER_NOTICE |
94 | 94 | ); |
95 | 95 | return false; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | if (!(class_exists($this->handler->className) && $object instanceof $this->handler->className)) { |
133 | 133 | trigger_error( |
134 | - "Object '" . get_class($object) . "' is not an instance of '" . $this->handler->className . "'", |
|
134 | + "Object '".get_class($object)."' is not an instance of '".$this->handler->className."'", |
|
135 | 135 | E_USER_NOTICE |
136 | 136 | ); |
137 | 137 | return false; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | $qb = $this->handler->db2->createXoopsQueryBuilder(); |
92 | 92 | if (is_array($fields) && count($fields)) { |
93 | - if (!in_array("o." . $this->handler->keyName, $fields)) { |
|
94 | - $fields[] = "o." . $this->handler->keyName; |
|
93 | + if (!in_array("o.".$this->handler->keyName, $fields)) { |
|
94 | + $fields[] = "o.".$this->handler->keyName; |
|
95 | 95 | } |
96 | 96 | $first = true; |
97 | 97 | foreach ($fields as $field) { |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | |
231 | 231 | $set = array(); |
232 | 232 | foreach ($data as $key => $val) { |
233 | - $set[] = "o.{$key}=" . $this->handler->db2->quote($val); |
|
233 | + $set[] = "o.{$key}=".$this->handler->db2->quote($val); |
|
234 | 234 | } |
235 | - $sql = " UPDATE {$this->handler->table} AS o" . " SET " . implode(", ", $set) |
|
235 | + $sql = " UPDATE {$this->handler->table} AS o"." SET ".implode(", ", $set) |
|
236 | 236 | . " LEFT JOIN {$this->handler->table_link} AS l " |
237 | 237 | . "ON o.{$this->handler->field_object} = l.{$this->handler->field_link}"; |
238 | 238 | if (isset($criteria) && ($criteria instanceof CriteriaElement)) { |
239 | - $sql .= " " . $criteria->renderWhere(); |
|
239 | + $sql .= " ".$criteria->renderWhere(); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return $this->handler->db2->executeUpdate($sql); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | . "LEFT JOIN {$this->handler->table_link} AS l " |
266 | 266 | . "ON o.{$this->handler->field_object} = l.{$this->handler->field_link}"; |
267 | 267 | if (isset($criteria) && ($criteria instanceof CriteriaElement)) { |
268 | - $sql .= " " . $criteria->renderWhere(); |
|
268 | + $sql .= " ".$criteria->renderWhere(); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $this->handler->db2->executeUpdate($sql); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | if (!in_array($this->handler->keyName, $fields)) { |
46 | 46 | $fields[] = $this->handler->keyName; |
47 | 47 | } |
48 | - $first=true; |
|
48 | + $first = true; |
|
49 | 49 | foreach ($fields as $field) { |
50 | 50 | if ($first) { |
51 | - $first=false; |
|
51 | + $first = false; |
|
52 | 52 | $qb->select($field); |
53 | 53 | } else { |
54 | 54 | $qb->addSelect($field); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $qb->addSelect($this->handler->identifierName); |
132 | 132 | } |
133 | 133 | $qb->from($this->handler->table, null); |
134 | - if ($limit!=0 || $start!=0) { |
|
134 | + if ($limit != 0 || $start != 0) { |
|
135 | 135 | $qb->setFirstResult($start) |
136 | 136 | ->setMaxResults($limit); |
137 | 137 | } |
@@ -240,10 +240,10 @@ |
||
240 | 240 | if (!in_array($this->keyName, $fields)) { |
241 | 241 | $fields[] = $this->keyName; |
242 | 242 | } |
243 | - $first=true; |
|
243 | + $first = true; |
|
244 | 244 | foreach ($fields as $field) { |
245 | 245 | if ($first) { |
246 | - $first=false; |
|
246 | + $first = false; |
|
247 | 247 | $qb->select($field); |
248 | 248 | } else { |
249 | 249 | $qb->addSelect($field); |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function render() |
80 | 80 | { |
81 | - $clause = (!empty($this->prefix) ? "{$this->prefix}." : "") . $this->column; |
|
81 | + $clause = (!empty($this->prefix) ? "{$this->prefix}." : "").$this->column; |
|
82 | 82 | if (!empty($this->function)) { |
83 | 83 | $clause = sprintf($this->function, $clause); |
84 | 84 | } |
85 | 85 | if (in_array(strtoupper($this->operator), array('IS NULL', 'IS NOT NULL'))) { |
86 | - $clause .= ' ' . $this->operator; |
|
86 | + $clause .= ' '.$this->operator; |
|
87 | 87 | } else { |
88 | 88 | if ('' === ($value = trim($this->value))) { |
89 | 89 | return ''; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | if ($this->operator === '!=' || $this->operator === '<>') { |
123 | 123 | $operator = '='; |
124 | - $clause = "(!(" . $this->column . $operator . $this->value . "))"; |
|
124 | + $clause = "(!(".$this->column.$operator.$this->value."))"; |
|
125 | 125 | } else { |
126 | 126 | if ($this->operator === 'IN') { |
127 | 127 | $newvalue = str_replace(array('(', ')'), '', $this->value); |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | foreach ($tab as $uid) { |
130 | 130 | $clause .= "({$this->column}={$uid})"; |
131 | 131 | } |
132 | - $clause = '(|' . $clause . ')'; |
|
132 | + $clause = '(|'.$clause.')'; |
|
133 | 133 | } else { |
134 | - $clause = "(" . $this->column . ' ' . $this->operator . ' ' . $this->value . ")"; |
|
134 | + $clause = "(".$this->column.' '.$this->operator.' '.$this->value.")"; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | return $clause; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function renderQb(QueryBuilder $qb = null, $whereMode = '') |
161 | 161 | { |
162 | - if ($qb==null) { // initialize query builder if not passed in |
|
162 | + if ($qb == null) { // initialize query builder if not passed in |
|
163 | 163 | $qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder(); |
164 | 164 | $whereMode = ''; // first entry in new instance must be where |
165 | 165 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | break; |
178 | 178 | } |
179 | 179 | |
180 | - if ($this->limit!=0 || $this->start!=0) { |
|
180 | + if ($this->limit != 0 || $this->start != 0) { |
|
181 | 181 | $qb->setFirstResult($this->start) |
182 | 182 | ->setMaxResults($this->limit); |
183 | 183 | } |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | { |
210 | 210 | $eb = $qb->expr(); |
211 | 211 | |
212 | - $column = (empty($this->prefix) ? "" : $this->prefix.'.') . $this->column; |
|
212 | + $column = (empty($this->prefix) ? "" : $this->prefix.'.').$this->column; |
|
213 | 213 | |
214 | 214 | // this should be done using portability functions |
215 | 215 | if (!empty($this->function)) { |
216 | 216 | $column = sprintf($this->function, $column); |
217 | 217 | } |
218 | 218 | |
219 | - $value=trim($this->value); |
|
219 | + $value = trim($this->value); |
|
220 | 220 | |
221 | 221 | $operator = strtolower($this->operator); |
222 | 222 | $expr = ''; |
@@ -231,16 +231,16 @@ discard block |
||
231 | 231 | $expr = $eb->isNotNull($column); |
232 | 232 | break; |
233 | 233 | case 'in': |
234 | - if (!empty($value) && $value!=='()') { |
|
235 | - $expr = $column . ' IN ' . $value; |
|
234 | + if (!empty($value) && $value !== '()') { |
|
235 | + $expr = $column.' IN '.$value; |
|
236 | 236 | } else { |
237 | 237 | // odd case of a null set - this won't match anything |
238 | 238 | $expr = $eb->neq($column, $column); |
239 | 239 | } |
240 | 240 | break; |
241 | 241 | case 'not in': |
242 | - if (!empty($value) && $value!=='()') { |
|
243 | - $expr = $column . ' NOT IN ' . $value; |
|
242 | + if (!empty($value) && $value !== '()') { |
|
243 | + $expr = $column.' NOT IN '.$value; |
|
244 | 244 | } |
245 | 245 | break; |
246 | 246 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | } elseif (is_string($value)) { |
71 | 71 | $cleanValue = strtotime($value); |
72 | 72 | } else { |
73 | - $cleanValue = (int) $value; |
|
73 | + $cleanValue = (int)$value; |
|
74 | 74 | } |
75 | 75 | return $cleanValue; |
76 | 76 | } |
@@ -61,10 +61,10 @@ |
||
61 | 61 | public function cleanVar(XoopsObject $obj, $key) |
62 | 62 | { |
63 | 63 | $value = $obj->vars[$key]['value']; |
64 | - $value = ($value===null || $value==='' || $value===false) ? null : $value; |
|
65 | - if ($value!==null && null === json_decode($value, true)) { |
|
64 | + $value = ($value === null || $value === '' || $value === false) ? null : $value; |
|
65 | + if ($value !== null && null === json_decode($value, true)) { |
|
66 | 66 | $value = json_encode($value, JSON_FORCE_OBJECT); |
67 | - if ($value===false) { |
|
67 | + if ($value === false) { |
|
68 | 68 | \Xoops::getInstance()->logger()->warning( |
69 | 69 | sprintf('Failed to encode to JSON - %s', json_last_error_msg()) |
70 | 70 | ); |
@@ -93,6 +93,6 @@ |
||
93 | 93 | if (false === $decoded || !(isset($decoded['amount']) && isset($decoded['currency']))) { |
94 | 94 | return null; |
95 | 95 | } |
96 | - return new Money((int) $decoded['amount'], new Currency($decoded['currency'])); |
|
96 | + return new Money((int)$decoded['amount'], new Currency($decoded['currency'])); |
|
97 | 97 | } |
98 | 98 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | return $value; |
43 | 43 | } |
44 | 44 | if ($value != '' && !preg_match("/^http[s]*:\/\//i", $value)) { |
45 | - $value = 'http://' . $value; |
|
45 | + $value = 'http://'.$value; |
|
46 | 46 | } |
47 | 47 | return $value; |
48 | 48 | } |