@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | */ |
259 | 259 | protected function processSqlStatement($statement, $node) |
260 | 260 | { |
261 | - $commandText = (string)$node; |
|
261 | + $commandText = (string) $node; |
|
262 | 262 | if(strlen($extend = $statement->getExtends()) > 0) |
263 | 263 | { |
264 | 264 | $superNode = $this->getElementByIdValue($this->_document, '*', $extend); |
265 | 265 | if($superNode !== null) |
266 | - $commandText = (string)$superNode . $commandText; |
|
266 | + $commandText = (string) $superNode . $commandText; |
|
267 | 267 | else |
268 | 268 | throw new TSqlMapConfigurationException( |
269 | 269 | 'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile, $node); |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | protected function loadCacheModel($node) |
432 | 432 | { |
433 | 433 | $cacheModel = new TSqlMapCacheModel; |
434 | - $properties = ['id','implementation']; |
|
434 | + $properties = ['id', 'implementation']; |
|
435 | 435 | foreach($node->attributes() as $name => $value) |
436 | 436 | { |
437 | 437 | if(in_array(strtolower($name), $properties)) |
438 | - $cacheModel->{'set' . $name}((string)$value); |
|
438 | + $cacheModel->{'set' . $name}((string) $value); |
|
439 | 439 | } |
440 | 440 | $cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel); |
441 | 441 | $this->setObjectPropFromNode($cache, $node, $properties); |
@@ -476,19 +476,19 @@ discard block |
||
476 | 476 | switch(strToLower($name)) |
477 | 477 | { |
478 | 478 | case 'seconds': |
479 | - $duration += (integer)$value; |
|
479 | + $duration += (integer) $value; |
|
480 | 480 | break; |
481 | 481 | case 'minutes': |
482 | - $duration += 60 * (integer)$value; |
|
482 | + $duration += 60 * (integer) $value; |
|
483 | 483 | break; |
484 | 484 | case 'hours': |
485 | - $duration += 3600 * (integer)$value; |
|
485 | + $duration += 3600 * (integer) $value; |
|
486 | 486 | break; |
487 | 487 | case 'days': |
488 | - $duration += 86400 * (integer)$value; |
|
488 | + $duration += 86400 * (integer) $value; |
|
489 | 489 | break; |
490 | 490 | case 'duration': |
491 | - $duration = (integer)$value; |
|
491 | + $duration = (integer) $value; |
|
492 | 492 | break 2; // switch, foreach |
493 | 493 | } |
494 | 494 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | foreach($node->attributes() as $name => $value) |
510 | 510 | { |
511 | 511 | if(strtolower($name) === 'statement') |
512 | - $this->_FlushOnExecuteStatements[$id][] = (string)$value; |
|
512 | + $this->_FlushOnExecuteStatements[$id][] = (string) $value; |
|
513 | 513 | } |
514 | 514 | } |
515 | 515 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | if(isset($node['class'])) |
35 | 35 | { |
36 | - $obj = Prado::createComponent((string)$node['class']); |
|
36 | + $obj = Prado::createComponent((string) $node['class']); |
|
37 | 37 | $this->setObjectPropFromNode($obj, $node, ['class']); |
38 | 38 | return $obj; |
39 | 39 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | if(!in_array($name, $except)) |
56 | 56 | { |
57 | 57 | if($obj->canSetProperty($name)) |
58 | - $obj->{$name} = (string)$value; |
|
58 | + $obj->{$name} = (string) $value; |
|
59 | 59 | else |
60 | 60 | throw new TSqlMapConfigurationException( |
61 | 61 | 'sqlmap_invalid_property', $name, get_class($obj), |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | protected function getElementByIdValue($document, $tag, $value) |
106 | 106 | { |
107 | 107 | //hack to allow upper case and lower case attribute names. |
108 | - foreach(['id','ID','Id', 'iD'] as $id) |
|
108 | + foreach(['id', 'ID', 'Id', 'iD'] as $id) |
|
109 | 109 | { |
110 | 110 | $xpath = "//{$tag}[@{$id}='{$value}']"; |
111 | 111 | foreach($document->xpath($xpath) as $node) |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function loadGlobalProperty($node) |
92 | 92 | { |
93 | - $this->_properties[(string)$node['name']] = (string)$node['value']; |
|
93 | + $this->_properties[(string) $node['name']] = (string) $node['value']; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function loadSqlMappingFiles($node) |
121 | 121 | { |
122 | - if(strlen($resource = (string)$node['resource']) > 0) |
|
122 | + if(strlen($resource = (string) $node['resource']) > 0) |
|
123 | 123 | { |
124 | 124 | if(strpos($resource, '${') !== false) |
125 | 125 | $resource = $this->replaceProperties($resource); |
@@ -190,7 +190,7 @@ |
||
190 | 190 | if(($disc = $this->getDiscriminator()) !== null) |
191 | 191 | { |
192 | 192 | $value = $disc->getMapping()->getPropertyValue($registry, $row); |
193 | - $subMap = $disc->getSubMap((string)$value); |
|
193 | + $subMap = $disc->getSubMap((string) $value); |
|
194 | 194 | |
195 | 195 | if($subMap === null) |
196 | 196 | $subMap = $this; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function updateByPk($data, $keys) |
105 | 105 | { |
106 | - list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys); |
|
106 | + list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys); |
|
107 | 107 | return $this->update($data, new TSqlCriteria($where, $parameters)); |
108 | 108 | } |
109 | 109 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | if($keys === null) |
155 | 155 | return null; |
156 | - list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys); |
|
156 | + list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys); |
|
157 | 157 | $command = $this->getBuilder()->createFindCommand($where, $parameters); |
158 | 158 | $this->onCreateCommand($command, new TSqlCriteria($where, $parameters)); |
159 | 159 | return $this->onExecuteCommand($command, $command->queryRow()); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function findAllByPk($keys) |
166 | 166 | { |
167 | - $where = $this->getCompositeKeyCondition((array)$keys); |
|
167 | + $where = $this->getCompositeKeyCondition((array) $keys); |
|
168 | 168 | $command = $this->getBuilder()->createFindCommand($where); |
169 | 169 | $this->onCreateCommand($command, new TSqlCriteria($where, $keys)); |
170 | 170 | return $this->onExecuteCommand($command, $command->query()); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | if(count($keys) == 0) |
191 | 191 | return 0; |
192 | - $where = $this->getCompositeKeyCondition((array)$keys); |
|
192 | + $where = $this->getCompositeKeyCondition((array) $keys); |
|
193 | 193 | $command = $this->getBuilder()->createDeleteCommand($where); |
194 | 194 | $this->onCreateCommand($command, new TSqlCriteria($where, $keys)); |
195 | 195 | $command->prepare(); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | public function getIndexKeyCondition($table, $fields, $values) |
200 | 200 | { |
201 | - if (!count($values)) |
|
201 | + if(!count($values)) |
|
202 | 202 | return 'FALSE'; |
203 | 203 | $columns = []; |
204 | 204 | $tableName = $table->getTableFullName(); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | { |
271 | 271 | $column = $this->getTableInfo()->getColumn($key)->getColumnName(); |
272 | 272 | $criteria[] = $column . ' = :' . $key; |
273 | - $bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++]; |
|
273 | + $bindings[$key] = isset($values[$key]) ? $values[$key] : $values[$i++]; |
|
274 | 274 | } |
275 | 275 | return [implode(' AND ', $criteria), $bindings]; |
276 | 276 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | public function count($criteria) |
326 | 326 | { |
327 | 327 | if($criteria === null) |
328 | - return (int)$this->getBuilder()->createCountCommand()->queryScalar(); |
|
328 | + return (int) $this->getBuilder()->createCountCommand()->queryScalar(); |
|
329 | 329 | $where = $criteria->getCondition(); |
330 | 330 | $parameters = $criteria->getParameters()->toArray(); |
331 | 331 | $ordering = $criteria->getOrdersBy(); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $offset = $criteria->getOffset(); |
334 | 334 | $command = $this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset); |
335 | 335 | $this->onCreateCommand($command, $criteria); |
336 | - return $this->onExecuteCommand($command, (int)$command->queryScalar()); |
|
336 | + return $this->onExecuteCommand($command, (int) $command->queryScalar()); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $parameters = array_slice(func_get_args(), 1); |
58 | 58 | $this->_parameters = new TAttributeCollection; |
59 | 59 | $this->_parameters->setCaseSensitive(true); |
60 | - $this->_parameters->copyFrom((array)$parameters); |
|
60 | + $this->_parameters->copyFrom((array) $parameters); |
|
61 | 61 | $this->_ordersBy = new TAttributeCollection; |
62 | 62 | $this->_ordersBy->setCaseSensitive(true); |
63 | 63 | |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | $value = str_replace($matches[0], '', $value); // remove limit from query |
160 | 160 | if(strpos($matches[1], ',')) { // both offset and limit given |
161 | 161 | list($offset, $limit) = explode(',', $matches[1]); |
162 | - $this->_limit = (int)$limit; |
|
163 | - $this->_offset = (int)$offset; |
|
162 | + $this->_limit = (int) $limit; |
|
163 | + $this->_offset = (int) $offset; |
|
164 | 164 | } else { // only limit given |
165 | - $this->_limit = (int)$matches[1]; |
|
165 | + $this->_limit = (int) $matches[1]; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | 169 | if(preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) { |
170 | 170 | // condition contains offset |
171 | 171 | $value = str_replace($matches[0], '', $value); // remove offset from query |
172 | - $this->_offset = (int)$matches[1]; // set offset in criteria |
|
172 | + $this->_offset = (int) $matches[1]; // set offset in criteria |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $this->_condition = trim($value); |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | $this->_ordersBy->copyFrom($value); |
220 | 220 | else |
221 | 221 | { |
222 | - $value = trim(preg_replace('/\s+/', ' ', (string)$value)); |
|
222 | + $value = trim(preg_replace('/\s+/', ' ', (string) $value)); |
|
223 | 223 | $orderBys = []; |
224 | 224 | foreach(explode(',', $value) as $orderBy) |
225 | 225 | { |
226 | 226 | $vs = explode(' ', trim($orderBy)); |
227 | - $orderBys[$vs[0]] = isset($vs[1])?$vs[1]:'asc'; |
|
227 | + $orderBys[$vs[0]] = isset($vs[1]) ? $vs[1] : 'asc'; |
|
228 | 228 | } |
229 | 229 | $this->_ordersBy->copyFrom($orderBys); |
230 | 230 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | public function __toString() |
269 | 269 | { |
270 | 270 | $str = ''; |
271 | - if(strlen((string)$this->getCondition()) > 0) |
|
272 | - $str .= '"' . (string)$this->getCondition() . '"'; |
|
271 | + if(strlen((string) $this->getCondition()) > 0) |
|
272 | + $str .= '"' . (string) $this->getCondition() . '"'; |
|
273 | 273 | $params = []; |
274 | 274 | foreach($this->getParameters() as $k => $v) |
275 | 275 | $params[] = "{$k} => ${v}"; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function __sleep() |
142 | 142 | { |
143 | 143 | // $this->close(); - DO NOT CLOSE the current connection as serializing doesn't neccessarily mean we don't this connection anymore in the current session |
144 | - return array_diff(parent::__sleep(), ["\0Prado\Data\TDbConnection\0_pdo","\0Prado\Data\TDbConnection\0_active"]); |
|
144 | + return array_diff(parent::__sleep(), ["\0Prado\Data\TDbConnection\0_pdo", "\0Prado\Data\TDbConnection\0_active"]); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | try |
190 | 190 | { |
191 | - $this->_pdo = new PDO($this->getConnectionString(),$this->getUsername(), |
|
191 | + $this->_pdo = new PDO($this->getConnectionString(), $this->getUsername(), |
|
192 | 192 | $this->getPassword(), $this->_attributes); |
193 | 193 | // This attribute is only useful for PDO::MySql driver. |
194 | 194 | // Ignore the warning if a driver doesn't understand this. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $this->_active = true; |
198 | 198 | $this->setConnectionCharset(); |
199 | 199 | } |
200 | - catch(PDOException $e) |
|
200 | + catch (PDOException $e) |
|
201 | 201 | { |
202 | 202 | throw new TDbException('dbconnection_open_failed', $e->getMessage()); |
203 | 203 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function setConnectionCharset() |
223 | 223 | { |
224 | - if ($this->_charset === '' || $this->_active === false) |
|
224 | + if($this->_charset === '' || $this->_active === false) |
|
225 | 225 | return; |
226 | - switch ($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) |
|
226 | + switch($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) |
|
227 | 227 | { |
228 | 228 | case 'mysql': |
229 | 229 | case 'sqlite': |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * @return string the charset used for database connection. Defaults to emtpy string. |
292 | 292 | */ |
293 | - public function getCharset () |
|
293 | + public function getCharset() |
|
294 | 294 | { |
295 | 295 | return $this->_charset; |
296 | 296 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * @param string the charset used for database connection |
300 | 300 | */ |
301 | - public function setCharset ($value) |
|
301 | + public function setCharset($value) |
|
302 | 302 | { |
303 | 303 | $this->_charset = $value; |
304 | 304 | $this->setConnectionCharset(); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function setTransactionClass($value) |
373 | 373 | { |
374 | - $this->_transactionClass = (string)$value; |
|
374 | + $this->_transactionClass = (string) $value; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | $this->_statement = $this->getConnection()->getPdoInstance()->prepare($this->getText()); |
120 | 120 | } |
121 | - catch(Exception $e) |
|
121 | + catch (Exception $e) |
|
122 | 122 | { |
123 | 123 | throw new TDbException('dbcommand_prepare_failed', $e->getMessage(), $this->getText()); |
124 | 124 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | else |
198 | 198 | return $this->getConnection()->getPdoInstance()->exec($this->getText()); |
199 | 199 | } |
200 | - catch(Exception $e) |
|
200 | + catch (Exception $e) |
|
201 | 201 | { |
202 | 202 | throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText()); |
203 | 203 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText()); |
232 | 232 | return new TDbDataReader($this); |
233 | 233 | } |
234 | - catch(Exception $e) |
|
234 | + catch (Exception $e) |
|
235 | 235 | { |
236 | 236 | throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
237 | 237 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $this->_statement->closeCursor(); |
259 | 259 | return $result; |
260 | 260 | } |
261 | - catch(Exception $e) |
|
261 | + catch (Exception $e) |
|
262 | 262 | { |
263 | 263 | throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
264 | 264 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | else |
288 | 288 | return $result; |
289 | 289 | } |
290 | - catch(Exception $e) |
|
290 | + catch (Exception $e) |
|
291 | 291 | { |
292 | 292 | throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
293 | 293 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $fname = ucwords(str_replace('_', ' ', $name)); |
71 | 71 | $sorts[$name . ' ASC'] = $fname . ' Ascending'; |
72 | 72 | $sorts[$name . ' DESC'] = $fname . ' Descending'; |
73 | - $headers[] = $fname ; |
|
73 | + $headers[] = $fname; |
|
74 | 74 | } |
75 | 75 | $this->_sort->setDataSource($sorts); |
76 | 76 | $this->_sort->dataBind(); |