@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | class PropertyHiderInObject extends PropertyHider { |
| 4 | 4 | private function getPhysicalPropertyName($name) { |
| 5 | - return '_' . $name; |
|
| 5 | + return '_'.$name; |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | /** |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | protected function checkPropertyExists($name) { |
| 82 | 82 | if (!array_key_exists($name, static::$_properties)) { |
| 83 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR); |
|
| 83 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | protected function checkOverwriteAdjusted($name) { |
| 88 | 88 | if (array_key_exists($name, $this->propertiesAdjusted)) { |
| 89 | - throw new PropertyAccessException('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
| 89 | + throw new PropertyAccessException('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | $result = null; |
| 170 | 170 | // Now deciding - will we call a protected setter or will we work with protected property |
| 171 | 171 | // Todo - on init recalc all method_exists |
| 172 | - if (method_exists($this, $methodName = $action . ucfirst($name))) { |
|
| 172 | + if (method_exists($this, $methodName = $action.ucfirst($name))) { |
|
| 173 | 173 | // If method exists - just calling it |
| 174 | 174 | // TODO - should return TRUE if value changed or FALSE otherwise |
| 175 | 175 | $result = call_user_func_array(array($this, $methodName), array($value)); |
| 176 | 176 | } elseif ($this->isPropertyActionAvailable($name, $action)) { |
| 177 | 177 | // No setter exists - works directly with protected property |
| 178 | - $result = $this->{$action . 'Property'}($name, $value); |
|
| 178 | + $result = $this->{$action.'Property'}($name, $value); |
|
| 179 | 179 | } else { |
| 180 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR); |
|
| 180 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return $result; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @return string |
| 269 | 269 | */ |
| 270 | 270 | protected function adjustPropertyString($name, $diff) { |
| 271 | - return (string)$this->$name . (string)$diff; |
|
| 271 | + return (string) $this->$name.(string) $diff; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | * @return array |
| 279 | 279 | */ |
| 280 | 280 | protected function adjustPropertyArray($name, $diff) { |
| 281 | - $copy = (array)$this->$name; |
|
| 282 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
| 281 | + $copy = (array) $this->$name; |
|
| 282 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
| 283 | 283 | |
| 284 | 284 | return $copy; |
| 285 | 285 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @return int |
| 292 | 292 | */ |
| 293 | 293 | protected function deltaInteger($name, $diff) { |
| 294 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
| 294 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @return float |
| 302 | 302 | */ |
| 303 | 303 | protected function deltaDouble($name, $diff) { |
| 304 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
| 304 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @return string |
| 312 | 312 | */ |
| 313 | 313 | protected function deltaString($name, $diff) { |
| 314 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
| 314 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | * @return array |
| 322 | 322 | */ |
| 323 | 323 | protected function deltaArray($name, $diff) { |
| 324 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
| 324 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
| 325 | 325 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
| 326 | 326 | |
| 327 | 327 | return $copy; |
@@ -344,10 +344,10 @@ discard block |
||
| 344 | 344 | // Capitalizing type name |
| 345 | 345 | $methodName = explode(' ', $type); |
| 346 | 346 | array_walk($methodName, 'DbSqlHelper::UCFirstByRef'); |
| 347 | - $methodName = $prefix . implode('', $methodName); |
|
| 347 | + $methodName = $prefix.implode('', $methodName); |
|
| 348 | 348 | |
| 349 | 349 | if (!method_exists($this, $methodName)) { |
| 350 | - throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult'); |
|
| 350 | + throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult'); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return call_user_func(array($this, $methodName), $name, $diff); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | ->setIdField($object::$idField) |
| 14 | 14 | ->field('*') |
| 15 | 15 | ->from($object::$tableName) |
| 16 | - ->where($object::$idField . ' = "' . $rowId . '"'); |
|
| 16 | + ->where($object::$idField.' = "'.$rowId.'"'); |
|
| 17 | 17 | |
| 18 | 18 | $object->setRow($stmt->selectRow()); |
| 19 | 19 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function deleteById($object) { |
| 27 | 27 | $db = classSupernova::$gc->db; |
| 28 | 28 | |
| 29 | - $db->doquery("DELETE FROM `{{" . $object::$tableName . "}}` WHERE `{$object::$idField}` = '{$object->getDbId()}' LIMIT 1;"); |
|
| 29 | + $db->doquery("DELETE FROM `{{".$object::$tableName."}}` WHERE `{$object::$idField}` = '{$object->getDbId()}' LIMIT 1;"); |
|
| 30 | 30 | |
| 31 | 31 | return $db->db_affected_rows(); |
| 32 | 32 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $query = array(); |
| 41 | 41 | foreach ($object->getRow() as $fieldName => $fieldValue) { |
| 42 | - if($fieldName == $object::$idField) { |
|
| 42 | + if ($fieldName == $object::$idField) { |
|
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | $fieldValue = $db->db_escape($fieldValue); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return 0; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $db->doquery("INSERT INTO `{{" . $object::$tableName . "}}` SET " . $query); |
|
| 55 | + $db->doquery("INSERT INTO `{{".$object::$tableName."}}` SET ".$query); |
|
| 56 | 56 | |
| 57 | 57 | // TODO Exceptiion if db_insert_id() is empty |
| 58 | 58 | $dbId = $db->db_insert_id(); |