@@ -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 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function getFindCommand($criteria) |
135 | 135 | { |
136 | - if($criteria === null) |
|
136 | + if ($criteria === null) |
|
137 | 137 | return $this->getBuilder()->createFindCommand(); |
138 | 138 | $where = $criteria->getCondition(); |
139 | 139 | $parameters = $criteria->getParameters()->toArray(); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function findByPk($keys) |
153 | 153 | { |
154 | - if($keys === null) |
|
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()); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function findAllByIndex($criteria, $fields, $values) |
173 | 173 | { |
174 | 174 | $index = $this->getIndexKeyCondition($this->getTableInfo(), $fields, $values); |
175 | - if(strlen($where = $criteria->getCondition()) > 0) |
|
175 | + if (strlen($where = $criteria->getCondition()) > 0) |
|
176 | 176 | $criteria->setCondition("({$index}) AND ({$where})"); |
177 | 177 | else |
178 | 178 | $criteria->setCondition($index); |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function deleteByPk($keys) |
189 | 189 | { |
190 | - if(count($keys) == 0) |
|
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(); |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | return 'FALSE'; |
203 | 203 | $columns = []; |
204 | 204 | $tableName = $table->getTableFullName(); |
205 | - foreach($fields as $field) |
|
206 | - $columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName(); |
|
207 | - return '(' . implode(', ', $columns) . ') IN ' . $this->quoteTuple($values); |
|
205 | + foreach ($fields as $field) |
|
206 | + $columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName(); |
|
207 | + return '('.implode(', ', $columns).') IN '.$this->quoteTuple($values); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -216,19 +216,19 @@ discard block |
||
216 | 216 | { |
217 | 217 | $primary = $this->getTableInfo()->getPrimaryKeys(); |
218 | 218 | $count = count($primary); |
219 | - if($count === 0) |
|
219 | + if ($count === 0) |
|
220 | 220 | { |
221 | 221 | throw new TDbException('dbtablegateway_no_primary_key_found', |
222 | 222 | $this->getTableInfo()->getTableFullName()); |
223 | 223 | } |
224 | - if(!is_array($values) || count($values) === 0) |
|
224 | + if (!is_array($values) || count($values) === 0) |
|
225 | 225 | { |
226 | 226 | throw new TDbException('dbtablegateway_missing_pk_values', |
227 | 227 | $this->getTableInfo()->getTableFullName()); |
228 | 228 | } |
229 | - if($count > 1 && (!isset($values[0]) || !is_array($values[0]))) |
|
229 | + if ($count > 1 && (!isset($values[0]) || !is_array($values[0]))) |
|
230 | 230 | $values = [$values]; |
231 | - if($count > 1 && count($values[0]) !== $count) |
|
231 | + if ($count > 1 && count($values[0]) !== $count) |
|
232 | 232 | { |
233 | 233 | throw new TDbException('dbtablegateway_pk_value_count_mismatch', |
234 | 234 | $this->getTableInfo()->getTableFullName()); |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | { |
246 | 246 | $conn = $this->getDbConnection(); |
247 | 247 | $data = []; |
248 | - foreach($array as $k => $v) |
|
248 | + foreach ($array as $k => $v) |
|
249 | 249 | $data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v); |
250 | - return '(' . implode(', ', $data) . ')'; |
|
250 | + return '('.implode(', ', $data).')'; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | protected function getPrimaryKeyCondition($values) |
259 | 259 | { |
260 | 260 | $primary = $this->getTableInfo()->getPrimaryKeys(); |
261 | - if(count($primary) === 0) |
|
261 | + if (count($primary) === 0) |
|
262 | 262 | { |
263 | 263 | throw new TDbException('dbtablegateway_no_primary_key_found', |
264 | 264 | $this->getTableInfo()->getTableFullName()); |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $criteria = []; |
267 | 267 | $bindings = []; |
268 | 268 | $i = 0; |
269 | - foreach($primary as $key) |
|
269 | + foreach ($primary as $key) |
|
270 | 270 | { |
271 | 271 | $column = $this->getTableInfo()->getColumn($key)->getColumnName(); |
272 | - $criteria[] = $column . ' = :' . $key; |
|
273 | - $bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++]; |
|
272 | + $criteria[] = $column.' = :'.$key; |
|
273 | + $bindings[$key] = isset($values[$key]) ? $values[$key] : $values[$i++]; |
|
274 | 274 | } |
275 | 275 | return [implode(' AND ', $criteria), $bindings]; |
276 | 276 | } |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $ordering = $criteria->getOrdersBy(); |
309 | 309 | $limit = $criteria->getLimit(); |
310 | 310 | $offset = $criteria->getOffset(); |
311 | - if(count($ordering) > 0) |
|
311 | + if (count($ordering) > 0) |
|
312 | 312 | $sql = $this->getBuilder()->applyOrdering($sql, $ordering); |
313 | - if($limit >= 0 || $offset >= 0) |
|
313 | + if ($limit >= 0 || $offset >= 0) |
|
314 | 314 | $sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset); |
315 | 315 | $command = $this->getBuilder()->createCommand($sql); |
316 | 316 | $this->getBuilder()->bindArrayValues($command, $criteria->getParameters()->toArray()); |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function count($criteria) |
326 | 326 | { |
327 | - if($criteria === null) |
|
328 | - return (int)$this->getBuilder()->createCountCommand()->queryScalar(); |
|
327 | + if ($criteria === null) |
|
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 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $command = $this->getBuilder()->createInsertCommand($data); |
349 | 349 | $this->onCreateCommand($command, new TSqlCriteria(null, $data)); |
350 | 350 | $command->prepare(); |
351 | - if($this->onExecuteCommand($command, $command->execute()) > 0) |
|
351 | + if ($this->onExecuteCommand($command, $command->execute()) > 0) |
|
352 | 352 | { |
353 | 353 | $value = $this->getLastInsertId(); |
354 | 354 | return $value !== null ? $value : true; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | { |
377 | 377 | $fields = $this->extractMatchingConditions($method, $condition); |
378 | 378 | $args = count($args) === 1 && is_array($args[0]) ? $args[0] : $args; |
379 | - if(count($fields) > count($args)) |
|
379 | + if (count($fields) > count($args)) |
|
380 | 380 | { |
381 | 381 | throw new TDbException('dbtablegateway_mismatch_args_exception', |
382 | 382 | $method, count($fields), count($args)); |
@@ -395,21 +395,21 @@ discard block |
||
395 | 395 | { |
396 | 396 | $table = $this->getTableInfo(); |
397 | 397 | $columns = $table->getLowerCaseColumnNames(); |
398 | - $regexp = '/(' . implode('|', array_keys($columns)) . ')(and|_and_|or|_or_)?/i'; |
|
398 | + $regexp = '/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i'; |
|
399 | 399 | $matches = []; |
400 | - if(!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER)) |
|
400 | + if (!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER)) |
|
401 | 401 | { |
402 | 402 | throw new TDbException('dbtablegateway_mismatch_column_name', |
403 | 403 | $method, implode(', ', $columns), $table->getTableFullName()); |
404 | 404 | } |
405 | 405 | |
406 | 406 | $fields = []; |
407 | - foreach($matches as $match) |
|
407 | + foreach ($matches as $match) |
|
408 | 408 | { |
409 | 409 | $key = $columns[$match[1]]; |
410 | 410 | $column = $table->getColumn($key)->getColumnName(); |
411 | - $sql = $column . ' = ? '; |
|
412 | - if(count($match) > 2) |
|
411 | + $sql = $column.' = ? '; |
|
412 | + if (count($match) > 2) |
|
413 | 413 | $sql .= strtoupper(str_replace('_', '', $match[2])); |
414 | 414 | $fields[] = $sql; |
415 | 415 | } |
@@ -133,8 +133,9 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function getFindCommand($criteria) |
135 | 135 | { |
136 | - if($criteria === null) |
|
137 | - return $this->getBuilder()->createFindCommand(); |
|
136 | + if($criteria === null) { |
|
137 | + return $this->getBuilder()->createFindCommand(); |
|
138 | + } |
|
138 | 139 | $where = $criteria->getCondition(); |
139 | 140 | $parameters = $criteria->getParameters()->toArray(); |
140 | 141 | $ordering = $criteria->getOrdersBy(); |
@@ -151,8 +152,9 @@ discard block |
||
151 | 152 | */ |
152 | 153 | public function findByPk($keys) |
153 | 154 | { |
154 | - if($keys === null) |
|
155 | - return null; |
|
155 | + if($keys === null) { |
|
156 | + return null; |
|
157 | + } |
|
156 | 158 | list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys); |
157 | 159 | $command = $this->getBuilder()->createFindCommand($where, $parameters); |
158 | 160 | $this->onCreateCommand($command, new TSqlCriteria($where, $parameters)); |
@@ -172,10 +174,11 @@ discard block |
||
172 | 174 | public function findAllByIndex($criteria, $fields, $values) |
173 | 175 | { |
174 | 176 | $index = $this->getIndexKeyCondition($this->getTableInfo(), $fields, $values); |
175 | - if(strlen($where = $criteria->getCondition()) > 0) |
|
176 | - $criteria->setCondition("({$index}) AND ({$where})"); |
|
177 | - else |
|
178 | - $criteria->setCondition($index); |
|
177 | + if(strlen($where = $criteria->getCondition()) > 0) { |
|
178 | + $criteria->setCondition("({$index}) AND ({$where})"); |
|
179 | + } else { |
|
180 | + $criteria->setCondition($index); |
|
181 | + } |
|
179 | 182 | $command = $this->getFindCommand($criteria); |
180 | 183 | $this->onCreateCommand($command, $criteria); |
181 | 184 | return $this->onExecuteCommand($command, $command->query()); |
@@ -187,8 +190,9 @@ discard block |
||
187 | 190 | */ |
188 | 191 | public function deleteByPk($keys) |
189 | 192 | { |
190 | - if(count($keys) == 0) |
|
191 | - return 0; |
|
193 | + if(count($keys) == 0) { |
|
194 | + return 0; |
|
195 | + } |
|
192 | 196 | $where = $this->getCompositeKeyCondition((array)$keys); |
193 | 197 | $command = $this->getBuilder()->createDeleteCommand($where); |
194 | 198 | $this->onCreateCommand($command, new TSqlCriteria($where, $keys)); |
@@ -198,12 +202,14 @@ discard block |
||
198 | 202 | |
199 | 203 | public function getIndexKeyCondition($table, $fields, $values) |
200 | 204 | { |
201 | - if (!count($values)) |
|
202 | - return 'FALSE'; |
|
205 | + if (!count($values)) { |
|
206 | + return 'FALSE'; |
|
207 | + } |
|
203 | 208 | $columns = []; |
204 | 209 | $tableName = $table->getTableFullName(); |
205 | - foreach($fields as $field) |
|
206 | - $columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName(); |
|
210 | + foreach($fields as $field) { |
|
211 | + $columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName(); |
|
212 | + } |
|
207 | 213 | return '(' . implode(', ', $columns) . ') IN ' . $this->quoteTuple($values); |
208 | 214 | } |
209 | 215 | |
@@ -226,8 +232,9 @@ discard block |
||
226 | 232 | throw new TDbException('dbtablegateway_missing_pk_values', |
227 | 233 | $this->getTableInfo()->getTableFullName()); |
228 | 234 | } |
229 | - if($count > 1 && (!isset($values[0]) || !is_array($values[0]))) |
|
230 | - $values = [$values]; |
|
235 | + if($count > 1 && (!isset($values[0]) || !is_array($values[0]))) { |
|
236 | + $values = [$values]; |
|
237 | + } |
|
231 | 238 | if($count > 1 && count($values[0]) !== $count) |
232 | 239 | { |
233 | 240 | throw new TDbException('dbtablegateway_pk_value_count_mismatch', |
@@ -245,8 +252,9 @@ discard block |
||
245 | 252 | { |
246 | 253 | $conn = $this->getDbConnection(); |
247 | 254 | $data = []; |
248 | - foreach($array as $k => $v) |
|
249 | - $data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v); |
|
255 | + foreach($array as $k => $v) { |
|
256 | + $data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v); |
|
257 | + } |
|
250 | 258 | return '(' . implode(', ', $data) . ')'; |
251 | 259 | } |
252 | 260 | |
@@ -308,10 +316,12 @@ discard block |
||
308 | 316 | $ordering = $criteria->getOrdersBy(); |
309 | 317 | $limit = $criteria->getLimit(); |
310 | 318 | $offset = $criteria->getOffset(); |
311 | - if(count($ordering) > 0) |
|
312 | - $sql = $this->getBuilder()->applyOrdering($sql, $ordering); |
|
313 | - if($limit >= 0 || $offset >= 0) |
|
314 | - $sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset); |
|
319 | + if(count($ordering) > 0) { |
|
320 | + $sql = $this->getBuilder()->applyOrdering($sql, $ordering); |
|
321 | + } |
|
322 | + if($limit >= 0 || $offset >= 0) { |
|
323 | + $sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset); |
|
324 | + } |
|
315 | 325 | $command = $this->getBuilder()->createCommand($sql); |
316 | 326 | $this->getBuilder()->bindArrayValues($command, $criteria->getParameters()->toArray()); |
317 | 327 | $this->onCreateCommand($command, $criteria); |
@@ -324,8 +334,9 @@ discard block |
||
324 | 334 | */ |
325 | 335 | public function count($criteria) |
326 | 336 | { |
327 | - if($criteria === null) |
|
328 | - return (int)$this->getBuilder()->createCountCommand()->queryScalar(); |
|
337 | + if($criteria === null) { |
|
338 | + return (int)$this->getBuilder()->createCountCommand()->queryScalar(); |
|
339 | + } |
|
329 | 340 | $where = $criteria->getCondition(); |
330 | 341 | $parameters = $criteria->getParameters()->toArray(); |
331 | 342 | $ordering = $criteria->getOrdersBy(); |
@@ -409,8 +420,9 @@ discard block |
||
409 | 420 | $key = $columns[$match[1]]; |
410 | 421 | $column = $table->getColumn($key)->getColumnName(); |
411 | 422 | $sql = $column . ' = ? '; |
412 | - if(count($match) > 2) |
|
413 | - $sql .= strtoupper(str_replace('_', '', $match[2])); |
|
423 | + if(count($match) > 2) { |
|
424 | + $sql .= strtoupper(str_replace('_', '', $match[2])); |
|
425 | + } |
|
414 | 426 | $fields[] = $sql; |
415 | 427 | } |
416 | 428 | return $fields; |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function init($xml) |
62 | 62 | { |
63 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
63 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
64 | 64 | { |
65 | - if(isset($xml['database']) && is_array($xml['database'])) |
|
65 | + if (isset($xml['database']) && is_array($xml['database'])) |
|
66 | 66 | { |
67 | 67 | $db = $this->getDbConnection(); |
68 | - foreach($xml['database'] as $name => $value) |
|
68 | + foreach ($xml['database'] as $name => $value) |
|
69 | 69 | $db->setSubProperty($name, $value); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | else |
73 | 73 | { |
74 | - if($prop = $xml->getElementByTagName('database')) |
|
74 | + if ($prop = $xml->getElementByTagName('database')) |
|
75 | 75 | { |
76 | 76 | $db = $this->getDbConnection(); |
77 | - foreach($prop->getAttributes() as $name => $value) |
|
77 | + foreach ($prop->getAttributes() as $name => $value) |
|
78 | 78 | $db->setSubproperty($name, $value); |
79 | 79 | } |
80 | 80 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getDbConnection() |
109 | 109 | { |
110 | - if($this->_conn === null) |
|
110 | + if ($this->_conn === null) |
|
111 | 111 | { |
112 | - if($this->_connID !== '') |
|
112 | + if ($this->_connID !== '') |
|
113 | 113 | $this->_conn = $this->findConnectionByID($this->getConnectionID()); |
114 | 114 | else |
115 | 115 | $this->_conn = Prado::createComponent($this->getConnectionClass()); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function setConnectionClass($value) |
147 | 147 | { |
148 | - if($this->_conn !== null) |
|
148 | + if ($this->_conn !== null) |
|
149 | 149 | throw new TConfigurationException('datasource_dbconnection_exists', $value); |
150 | 150 | $this->_connClass = $value; |
151 | 151 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | protected function findConnectionByID($id) |
160 | 160 | { |
161 | 161 | $conn = $this->getApplication()->getModule($id); |
162 | - if($conn instanceof TDbConnection) |
|
162 | + if ($conn instanceof TDbConnection) |
|
163 | 163 | return $conn; |
164 | - elseif($conn instanceof TDataSourceConfig) |
|
164 | + elseif ($conn instanceof TDataSourceConfig) |
|
165 | 165 | return $conn->getDbConnection(); |
166 | 166 | else |
167 | 167 | throw new TConfigurationException('datasource_dbconnection_invalid', $id); |
@@ -65,17 +65,18 @@ discard block |
||
65 | 65 | if(isset($xml['database']) && is_array($xml['database'])) |
66 | 66 | { |
67 | 67 | $db = $this->getDbConnection(); |
68 | - foreach($xml['database'] as $name => $value) |
|
69 | - $db->setSubProperty($name, $value); |
|
68 | + foreach($xml['database'] as $name => $value) { |
|
69 | + $db->setSubProperty($name, $value); |
|
70 | + } |
|
70 | 71 | } |
71 | - } |
|
72 | - else |
|
72 | + } else |
|
73 | 73 | { |
74 | 74 | if($prop = $xml->getElementByTagName('database')) |
75 | 75 | { |
76 | 76 | $db = $this->getDbConnection(); |
77 | - foreach($prop->getAttributes() as $name => $value) |
|
78 | - $db->setSubproperty($name, $value); |
|
77 | + foreach($prop->getAttributes() as $name => $value) { |
|
78 | + $db->setSubproperty($name, $value); |
|
79 | + } |
|
79 | 80 | } |
80 | 81 | } |
81 | 82 | } |
@@ -109,10 +110,11 @@ discard block |
||
109 | 110 | { |
110 | 111 | if($this->_conn === null) |
111 | 112 | { |
112 | - if($this->_connID !== '') |
|
113 | - $this->_conn = $this->findConnectionByID($this->getConnectionID()); |
|
114 | - else |
|
115 | - $this->_conn = Prado::createComponent($this->getConnectionClass()); |
|
113 | + if($this->_connID !== '') { |
|
114 | + $this->_conn = $this->findConnectionByID($this->getConnectionID()); |
|
115 | + } else { |
|
116 | + $this->_conn = Prado::createComponent($this->getConnectionClass()); |
|
117 | + } |
|
116 | 118 | } |
117 | 119 | return $this->_conn; |
118 | 120 | } |
@@ -145,8 +147,9 @@ discard block |
||
145 | 147 | */ |
146 | 148 | public function setConnectionClass($value) |
147 | 149 | { |
148 | - if($this->_conn !== null) |
|
149 | - throw new TConfigurationException('datasource_dbconnection_exists', $value); |
|
150 | + if($this->_conn !== null) { |
|
151 | + throw new TConfigurationException('datasource_dbconnection_exists', $value); |
|
152 | + } |
|
150 | 153 | $this->_connClass = $value; |
151 | 154 | } |
152 | 155 | |
@@ -159,11 +162,12 @@ discard block |
||
159 | 162 | protected function findConnectionByID($id) |
160 | 163 | { |
161 | 164 | $conn = $this->getApplication()->getModule($id); |
162 | - if($conn instanceof TDbConnection) |
|
163 | - return $conn; |
|
164 | - elseif($conn instanceof TDataSourceConfig) |
|
165 | - return $conn->getDbConnection(); |
|
166 | - else |
|
167 | - throw new TConfigurationException('datasource_dbconnection_invalid', $id); |
|
165 | + if($conn instanceof TDbConnection) { |
|
166 | + return $conn; |
|
167 | + } elseif($conn instanceof TDataSourceConfig) { |
|
168 | + return $conn->getDbConnection(); |
|
169 | + } else { |
|
170 | + throw new TConfigurationException('datasource_dbconnection_invalid', $id); |
|
171 | + } |
|
168 | 172 | } |
169 | 173 | } |
@@ -54,26 +54,26 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public static function get($object, $path) |
56 | 56 | { |
57 | - if(!is_array($object) && !is_object($object)) |
|
57 | + if (!is_array($object) && !is_object($object)) |
|
58 | 58 | return $object; |
59 | 59 | $properties = explode('.', $path); |
60 | - foreach($properties as $prop) |
|
60 | + foreach ($properties as $prop) |
|
61 | 61 | { |
62 | - if(is_array($object) || $object instanceof \ArrayAccess) |
|
62 | + if (is_array($object) || $object instanceof \ArrayAccess) |
|
63 | 63 | { |
64 | - if(array_key_exists($prop, $object)) |
|
64 | + if (array_key_exists($prop, $object)) |
|
65 | 65 | $object = $object[$prop]; |
66 | 66 | else |
67 | 67 | throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
68 | 68 | } |
69 | - elseif(is_object($object)) |
|
69 | + elseif (is_object($object)) |
|
70 | 70 | { |
71 | - $getter = 'get' . $prop; |
|
72 | - if(method_exists($object, $getter) && is_callable([$object, $getter])) |
|
71 | + $getter = 'get'.$prop; |
|
72 | + if (method_exists($object, $getter) && is_callable([$object, $getter])) |
|
73 | 73 | $object = $object->{$getter}(); |
74 | - elseif(in_array($prop, array_keys(get_object_vars($object)))) |
|
74 | + elseif (in_array($prop, array_keys(get_object_vars($object)))) |
|
75 | 75 | $object = $object->{$prop}; |
76 | - elseif(method_exists($object, '__get') && is_callable([$object, '__get'])) |
|
76 | + elseif (method_exists($object, '__get') && is_callable([$object, '__get'])) |
|
77 | 77 | $object = $object->{$prop}; |
78 | 78 | else |
79 | 79 | throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
@@ -91,26 +91,26 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function has($object, $path) |
93 | 93 | { |
94 | - if(!is_array($object) && !is_object($object)) |
|
94 | + if (!is_array($object) && !is_object($object)) |
|
95 | 95 | return false; |
96 | 96 | $properties = explode('.', $path); |
97 | - foreach($properties as $prop) |
|
97 | + foreach ($properties as $prop) |
|
98 | 98 | { |
99 | - if(is_array($object) || $object instanceof \ArrayAccess) |
|
99 | + if (is_array($object) || $object instanceof \ArrayAccess) |
|
100 | 100 | { |
101 | - if(array_key_exists($prop, $object)) |
|
101 | + if (array_key_exists($prop, $object)) |
|
102 | 102 | $object = $object[$prop]; |
103 | 103 | else |
104 | 104 | return false; |
105 | 105 | } |
106 | - elseif(is_object($object)) |
|
106 | + elseif (is_object($object)) |
|
107 | 107 | { |
108 | - $getter = 'get' . $prop; |
|
109 | - if(method_exists($object, $getter) && is_callable([$object, $getter])) |
|
108 | + $getter = 'get'.$prop; |
|
109 | + if (method_exists($object, $getter) && is_callable([$object, $getter])) |
|
110 | 110 | $object = $object->{$getter}(); |
111 | - elseif(in_array($prop, array_keys(get_object_vars($object)))) |
|
111 | + elseif (in_array($prop, array_keys(get_object_vars($object)))) |
|
112 | 112 | $object = $object->{$prop}; |
113 | - elseif(method_exists($object, '__get') && is_callable([$object, '__get'])) |
|
113 | + elseif (method_exists($object, '__get') && is_callable([$object, '__get'])) |
|
114 | 114 | $object = $object->{$prop}; |
115 | 115 | else |
116 | 116 | return false; |
@@ -132,18 +132,18 @@ discard block |
||
132 | 132 | { |
133 | 133 | $properties = explode('.', $path); |
134 | 134 | $prop = array_pop($properties); |
135 | - if(count($properties) > 0) |
|
135 | + if (count($properties) > 0) |
|
136 | 136 | $object = self::get($originalObject, implode('.', $properties)); |
137 | 137 | else |
138 | 138 | $object = &$originalObject; |
139 | 139 | |
140 | - if(is_array($object) || $object instanceof \ArrayAccess) |
|
140 | + if (is_array($object) || $object instanceof \ArrayAccess) |
|
141 | 141 | { |
142 | 142 | $object[$prop] = $value; |
143 | 143 | } |
144 | - elseif(is_object($object)) |
|
144 | + elseif (is_object($object)) |
|
145 | 145 | { |
146 | - $setter = 'set' . $prop; |
|
146 | + $setter = 'set'.$prop; |
|
147 | 147 | if (method_exists($object, $setter) && is_callable([$object, $setter])) |
148 | 148 | $object->{$setter}($value); |
149 | 149 | else |
@@ -54,32 +54,34 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public static function get($object, $path) |
56 | 56 | { |
57 | - if(!is_array($object) && !is_object($object)) |
|
58 | - return $object; |
|
57 | + if(!is_array($object) && !is_object($object)) { |
|
58 | + return $object; |
|
59 | + } |
|
59 | 60 | $properties = explode('.', $path); |
60 | 61 | foreach($properties as $prop) |
61 | 62 | { |
62 | 63 | if(is_array($object) || $object instanceof \ArrayAccess) |
63 | 64 | { |
64 | - if(array_key_exists($prop, $object)) |
|
65 | - $object = $object[$prop]; |
|
66 | - else |
|
67 | - throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
68 | - } |
|
69 | - elseif(is_object($object)) |
|
65 | + if(array_key_exists($prop, $object)) { |
|
66 | + $object = $object[$prop]; |
|
67 | + } else { |
|
68 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
69 | + } |
|
70 | + } elseif(is_object($object)) |
|
70 | 71 | { |
71 | 72 | $getter = 'get' . $prop; |
72 | - if(method_exists($object, $getter) && is_callable([$object, $getter])) |
|
73 | - $object = $object->{$getter}(); |
|
74 | - elseif(in_array($prop, array_keys(get_object_vars($object)))) |
|
75 | - $object = $object->{$prop}; |
|
76 | - elseif(method_exists($object, '__get') && is_callable([$object, '__get'])) |
|
77 | - $object = $object->{$prop}; |
|
78 | - else |
|
79 | - throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
73 | + if(method_exists($object, $getter) && is_callable([$object, $getter])) { |
|
74 | + $object = $object->{$getter}(); |
|
75 | + } elseif(in_array($prop, array_keys(get_object_vars($object)))) { |
|
76 | + $object = $object->{$prop}; |
|
77 | + } elseif(method_exists($object, '__get') && is_callable([$object, '__get'])) { |
|
78 | + $object = $object->{$prop}; |
|
79 | + } else { |
|
80 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
81 | + } |
|
82 | + } else { |
|
83 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
80 | 84 | } |
81 | - else |
|
82 | - throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
83 | 85 | } |
84 | 86 | return $object; |
85 | 87 | } |
@@ -91,32 +93,34 @@ discard block |
||
91 | 93 | */ |
92 | 94 | public static function has($object, $path) |
93 | 95 | { |
94 | - if(!is_array($object) && !is_object($object)) |
|
95 | - return false; |
|
96 | + if(!is_array($object) && !is_object($object)) { |
|
97 | + return false; |
|
98 | + } |
|
96 | 99 | $properties = explode('.', $path); |
97 | 100 | foreach($properties as $prop) |
98 | 101 | { |
99 | 102 | if(is_array($object) || $object instanceof \ArrayAccess) |
100 | 103 | { |
101 | - if(array_key_exists($prop, $object)) |
|
102 | - $object = $object[$prop]; |
|
103 | - else |
|
104 | - return false; |
|
105 | - } |
|
106 | - elseif(is_object($object)) |
|
104 | + if(array_key_exists($prop, $object)) { |
|
105 | + $object = $object[$prop]; |
|
106 | + } else { |
|
107 | + return false; |
|
108 | + } |
|
109 | + } elseif(is_object($object)) |
|
107 | 110 | { |
108 | 111 | $getter = 'get' . $prop; |
109 | - if(method_exists($object, $getter) && is_callable([$object, $getter])) |
|
110 | - $object = $object->{$getter}(); |
|
111 | - elseif(in_array($prop, array_keys(get_object_vars($object)))) |
|
112 | - $object = $object->{$prop}; |
|
113 | - elseif(method_exists($object, '__get') && is_callable([$object, '__get'])) |
|
114 | - $object = $object->{$prop}; |
|
115 | - else |
|
116 | - return false; |
|
112 | + if(method_exists($object, $getter) && is_callable([$object, $getter])) { |
|
113 | + $object = $object->{$getter}(); |
|
114 | + } elseif(in_array($prop, array_keys(get_object_vars($object)))) { |
|
115 | + $object = $object->{$prop}; |
|
116 | + } elseif(method_exists($object, '__get') && is_callable([$object, '__get'])) { |
|
117 | + $object = $object->{$prop}; |
|
118 | + } else { |
|
119 | + return false; |
|
120 | + } |
|
121 | + } else { |
|
122 | + return false; |
|
117 | 123 | } |
118 | - else |
|
119 | - return false; |
|
120 | 124 | } |
121 | 125 | return true; |
122 | 126 | } |
@@ -132,25 +136,26 @@ discard block |
||
132 | 136 | { |
133 | 137 | $properties = explode('.', $path); |
134 | 138 | $prop = array_pop($properties); |
135 | - if(count($properties) > 0) |
|
136 | - $object = self::get($originalObject, implode('.', $properties)); |
|
137 | - else |
|
138 | - $object = &$originalObject; |
|
139 | + if(count($properties) > 0) { |
|
140 | + $object = self::get($originalObject, implode('.', $properties)); |
|
141 | + } else { |
|
142 | + $object = &$originalObject; |
|
143 | + } |
|
139 | 144 | |
140 | 145 | if(is_array($object) || $object instanceof \ArrayAccess) |
141 | 146 | { |
142 | 147 | $object[$prop] = $value; |
143 | - } |
|
144 | - elseif(is_object($object)) |
|
148 | + } elseif(is_object($object)) |
|
145 | 149 | { |
146 | 150 | $setter = 'set' . $prop; |
147 | - if (method_exists($object, $setter) && is_callable([$object, $setter])) |
|
148 | - $object->{$setter}($value); |
|
149 | - else |
|
150 | - $object->{$prop} = $value; |
|
151 | + if (method_exists($object, $setter) && is_callable([$object, $setter])) { |
|
152 | + $object->{$setter}($value); |
|
153 | + } else { |
|
154 | + $object->{$prop} = $value; |
|
155 | + } |
|
156 | + } else { |
|
157 | + throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path); |
|
151 | 158 | } |
152 | - else |
|
153 | - throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path); |
|
154 | 159 | } |
155 | 160 | |
156 | 161 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | $id = 'keyList'; |
47 | 47 | if ($this->_cacheModel instanceof TSqlMapCacheModel) |
48 | - $id .= '_' . $this->_cacheModel->getId(); |
|
48 | + $id .= '_'.$this->_cacheModel->getId(); |
|
49 | 49 | return $id; |
50 | 50 | } |
51 | 51 | /** |
@@ -44,8 +44,9 @@ |
||
44 | 44 | protected function getKeyListId() |
45 | 45 | { |
46 | 46 | $id = 'keyList'; |
47 | - if ($this->_cacheModel instanceof TSqlMapCacheModel) |
|
48 | - $id .= '_' . $this->_cacheModel->getId(); |
|
47 | + if ($this->_cacheModel instanceof TSqlMapCacheModel) { |
|
48 | + $id .= '_' . $this->_cacheModel->getId(); |
|
49 | + } |
|
49 | 50 | return $id; |
50 | 51 | } |
51 | 52 | /** |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $this->_cache->add($key, $value); |
42 | 42 | $this->_keyList->add($key); |
43 | - if($this->_keyList->getCount() > $this->_cacheSize) |
|
43 | + if ($this->_keyList->getCount() > $this->_cacheSize) |
|
44 | 44 | { |
45 | 45 | $oldestKey = $this->_keyList->removeAt(0); |
46 | 46 | $this->_cache->remove($oldestKey); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | array_shift($args); |
31 | 31 | $n = count($args); |
32 | 32 | $tokens = []; |
33 | - for($i = 0;$i < $n;++$i) |
|
33 | + for ($i = 0; $i < $n; ++$i) |
|
34 | 34 | { |
35 | - if($args[$i] instanceof SimpleXMLElement) |
|
36 | - $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
|
35 | + if ($args[$i] instanceof SimpleXMLElement) |
|
36 | + $tokens['{'.$i.'}'] = $this->implodeNode($args[$i]); |
|
37 | 37 | else |
38 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
38 | + $tokens['{'.$i.'}'] = TPropertyValue::ensureString($args[$i]); |
|
39 | 39 | } |
40 | 40 | parent::__construct(strtr($errorMessage, $tokens)); |
41 | 41 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | protected function implodeNode($node) |
48 | 48 | { |
49 | 49 | $attributes = []; |
50 | - foreach($node->attributes() as $k => $v) |
|
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
52 | - return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
|
50 | + foreach ($node->attributes() as $k => $v) |
|
51 | + $attributes[] = $k.'="'.(string) $v.'"'; |
|
52 | + return '<'.$node->getName().' '.implode(' ', $attributes).'>'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | { |
60 | 60 | $lang = Prado::getPreferredLanguage(); |
61 | 61 | $dir = dirname(__FILE__); |
62 | - $msgFile = $dir . '/messages-' . $lang . '.txt'; |
|
63 | - if(!is_file($msgFile)) |
|
64 | - $msgFile = $dir . '/messages.txt'; |
|
62 | + $msgFile = $dir.'/messages-'.$lang.'.txt'; |
|
63 | + if (!is_file($msgFile)) |
|
64 | + $msgFile = $dir.'/messages.txt'; |
|
65 | 65 | return $msgFile; |
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -32,10 +32,11 @@ discard block |
||
32 | 32 | $tokens = []; |
33 | 33 | for($i = 0;$i < $n;++$i) |
34 | 34 | { |
35 | - if($args[$i] instanceof SimpleXMLElement) |
|
36 | - $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
|
37 | - else |
|
38 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
35 | + if($args[$i] instanceof SimpleXMLElement) { |
|
36 | + $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
|
37 | + } else { |
|
38 | + $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | parent::__construct(strtr($errorMessage, $tokens)); |
41 | 42 | } |
@@ -47,8 +48,9 @@ discard block |
||
47 | 48 | protected function implodeNode($node) |
48 | 49 | { |
49 | 50 | $attributes = []; |
50 | - foreach($node->attributes() as $k => $v) |
|
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
51 | + foreach($node->attributes() as $k => $v) { |
|
52 | + $attributes[] = $k . '="' . (string)$v . '"'; |
|
53 | + } |
|
52 | 54 | return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
53 | 55 | } |
54 | 56 | |
@@ -60,8 +62,9 @@ discard block |
||
60 | 62 | $lang = Prado::getPreferredLanguage(); |
61 | 63 | $dir = dirname(__FILE__); |
62 | 64 | $msgFile = $dir . '/messages-' . $lang . '.txt'; |
63 | - if(!is_file($msgFile)) |
|
64 | - $msgFile = $dir . '/messages.txt'; |
|
65 | + if(!is_file($msgFile)) { |
|
66 | + $msgFile = $dir . '/messages.txt'; |
|
67 | + } |
|
65 | 68 | return $msgFile; |
66 | 69 | } |
67 | 70 | } |
68 | 71 | \ No newline at end of file |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | public function getType() |
52 | 52 | { |
53 | - if($this->_type === null) |
|
53 | + if ($this->_type === null) |
|
54 | 54 | return get_class($this); |
55 | 55 | else |
56 | 56 | return $this->_type; |
@@ -50,10 +50,11 @@ |
||
50 | 50 | |
51 | 51 | public function getType() |
52 | 52 | { |
53 | - if($this->_type === null) |
|
54 | - return get_class($this); |
|
55 | - else |
|
56 | - return $this->_type; |
|
53 | + if($this->_type === null) { |
|
54 | + return get_class($this); |
|
55 | + } else { |
|
56 | + return $this->_type; |
|
57 | + } |
|
57 | 58 | } |
58 | 59 | |
59 | 60 | public function setType($value) |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getDbTypeHandler($dbType = 'NULL') |
33 | 33 | { |
34 | - foreach($this->_typeHandlers as $handler) |
|
35 | - if($handler->getDbType() === $dbType) |
|
34 | + foreach ($this->_typeHandlers as $handler) |
|
35 | + if ($handler->getDbType() === $dbType) |
|
36 | 36 | return $handler; |
37 | 37 | } |
38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getTypeHandler($class) |
44 | 44 | { |
45 | - if(isset($this->_typeHandlers[$class])) |
|
45 | + if (isset($this->_typeHandlers[$class])) |
|
46 | 46 | return $this->_typeHandlers[$class]; |
47 | 47 | } |
48 | 48 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function createInstanceOf($type = '') |
65 | 65 | { |
66 | - if(strlen($type) > 0) |
|
66 | + if (strlen($type) > 0) |
|
67 | 67 | { |
68 | - switch(strtolower($type)) |
|
68 | + switch (strtolower($type)) |
|
69 | 69 | { |
70 | 70 | case 'string': return ''; |
71 | 71 | case 'array': return []; |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | case 'bool': case 'boolean': return false; |
75 | 75 | } |
76 | 76 | |
77 | - if(class_exists('Prado', false)) |
|
77 | + if (class_exists('Prado', false)) |
|
78 | 78 | return Prado::createComponent($type); |
79 | - elseif(class_exists($type, false)) //NO auto loading |
|
79 | + elseif (class_exists($type, false)) //NO auto loading |
|
80 | 80 | return new $type; |
81 | 81 | else |
82 | 82 | throw new TSqlMapException('sqlmap_unable_to_find_class', $type); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function convertToType($type, $value) |
93 | 93 | { |
94 | - switch(strtolower($type)) |
|
94 | + switch (strtolower($type)) |
|
95 | 95 | { |
96 | 96 | case 'integer': case 'int': |
97 | 97 | $type = 'integer'; break; |
@@ -31,9 +31,10 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getDbTypeHandler($dbType = 'NULL') |
33 | 33 | { |
34 | - foreach($this->_typeHandlers as $handler) |
|
35 | - if($handler->getDbType() === $dbType) |
|
34 | + foreach($this->_typeHandlers as $handler) { |
|
35 | + if($handler->getDbType() === $dbType) |
|
36 | 36 | return $handler; |
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | /** |
@@ -42,8 +43,9 @@ discard block |
||
42 | 43 | */ |
43 | 44 | public function getTypeHandler($class) |
44 | 45 | { |
45 | - if(isset($this->_typeHandlers[$class])) |
|
46 | - return $this->_typeHandlers[$class]; |
|
46 | + if(isset($this->_typeHandlers[$class])) { |
|
47 | + return $this->_typeHandlers[$class]; |
|
48 | + } |
|
47 | 49 | } |
48 | 50 | |
49 | 51 | /** |
@@ -74,12 +76,14 @@ discard block |
||
74 | 76 | case 'bool': case 'boolean': return false; |
75 | 77 | } |
76 | 78 | |
77 | - if(class_exists('Prado', false)) |
|
78 | - return Prado::createComponent($type); |
|
79 | - elseif(class_exists($type, false)) //NO auto loading |
|
79 | + if(class_exists('Prado', false)) { |
|
80 | + return Prado::createComponent($type); |
|
81 | + } elseif(class_exists($type, false)) { |
|
82 | + //NO auto loading |
|
80 | 83 | return new $type; |
81 | - else |
|
82 | - throw new TSqlMapException('sqlmap_unable_to_find_class', $type); |
|
84 | + } else { |
|
85 | + throw new TSqlMapException('sqlmap_unable_to_find_class', $type); |
|
86 | + } |
|
83 | 87 | } |
84 | 88 | } |
85 | 89 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $statement = $mappedStatement->getStatement(); |
60 | 60 | $registry = $mappedStatement->getManager()->getTypeHandlers(); |
61 | 61 | $list = $statement->createInstanceOfListClass($registry); |
62 | - if(!is_object($list)) |
|
62 | + if (!is_object($list)) |
|
63 | 63 | throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID()); |
64 | 64 | return new TObjectProxy($handler, $list); |
65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function fetchListData() |
81 | 81 | { |
82 | - if($this->_loaded == false) |
|
82 | + if ($this->_loaded == false) |
|
83 | 83 | { |
84 | 84 | $this->_innerList = $this->_statement->executeQueryForList($this->_connection, $this->_param); |
85 | 85 | $this->_loaded = true; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function hasMethod($method) |
97 | 97 | { |
98 | 98 | $this->fetchListData(); |
99 | - if(is_object($this->_innerList)) |
|
99 | + if (is_object($this->_innerList)) |
|
100 | 100 | return in_array($method, get_class_methods($this->_innerList)); |
101 | 101 | return false; |
102 | 102 | } |
@@ -59,8 +59,9 @@ discard block |
||
59 | 59 | $statement = $mappedStatement->getStatement(); |
60 | 60 | $registry = $mappedStatement->getManager()->getTypeHandlers(); |
61 | 61 | $list = $statement->createInstanceOfListClass($registry); |
62 | - if(!is_object($list)) |
|
63 | - throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID()); |
|
62 | + if(!is_object($list)) { |
|
63 | + throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID()); |
|
64 | + } |
|
64 | 65 | return new TObjectProxy($handler, $list); |
65 | 66 | } |
66 | 67 | |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | public function hasMethod($method) |
97 | 98 | { |
98 | 99 | $this->fetchListData(); |
99 | - if(is_object($this->_innerList)) |
|
100 | - return in_array($method, get_class_methods($this->_innerList)); |
|
100 | + if(is_object($this->_innerList)) { |
|
101 | + return in_array($method, get_class_methods($this->_innerList)); |
|
102 | + } |
|
101 | 103 | return false; |
102 | 104 | } |
103 | 105 | } |
104 | 106 | \ No newline at end of file |