@@ -53,20 +53,20 @@ discard block |
||
| 53 | 53 | //+ |
| 54 | 54 | protected function checkPropertyExists($name) { |
| 55 | 55 | if (!array_key_exists($name, static::$_properties)) { |
| 56 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR); |
|
| 56 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | //+ |
| 61 | 61 | protected function checkOverwriteAdjusted($name) { |
| 62 | 62 | if (array_key_exists($name, $this->propertiesAdjusted)) { |
| 63 | - throw new PropertyAccessException('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
| 63 | + throw new PropertyAccessException('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //+ |
| 68 | 68 | private function getPhysicalPropertyName($name) { |
| 69 | - return '_' . $name; |
|
| 69 | + return '_'.$name; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | //+ |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $result = null; |
| 90 | 90 | // Now deciding - will we call a protected setter or will we work with protected property |
| 91 | - if (method_exists($this, $methodName = 'get' . ucfirst($name))) { |
|
| 91 | + if (method_exists($this, $methodName = 'get'.ucfirst($name))) { |
|
| 92 | 92 | // If method exists - just calling it |
| 93 | 93 | $result = call_user_func_array(array($this, $methodName), array()); |
| 94 | 94 | } elseif ($this->isPropertyDeclared($name)) { |
| 95 | 95 | // No getter exists - works directly with protected property |
| 96 | 96 | $result = $this->{$this->getPhysicalPropertyName($name)}; |
| 97 | 97 | } else { |
| 98 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have getter/property to get', ERR_ERROR); |
|
| 98 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have getter/property to get', ERR_ERROR); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $result; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | protected function _setUnsafe($name, $value) { |
| 115 | 115 | $result = null; |
| 116 | 116 | // Now deciding - will we call a protected setter or will we work with protected property |
| 117 | - if (method_exists($this, $methodName = 'set' . ucfirst($name))) { |
|
| 117 | + if (method_exists($this, $methodName = 'set'.ucfirst($name))) { |
|
| 118 | 118 | // If method exists - just calling it |
| 119 | 119 | // TODO - should return TRUE if value changed or FALSE otherwise |
| 120 | 120 | $result = call_user_func_array(array($this, $methodName), array($value)); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $this->{$this->getPhysicalPropertyName($name)} = $value; |
| 125 | 125 | // } |
| 126 | 126 | } else { |
| 127 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have setter/property to set', ERR_ERROR); |
|
| 127 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have setter/property to set', ERR_ERROR); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // TODO - should be primed only if value changed |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return string |
| 183 | 183 | */ |
| 184 | 184 | protected function _adjustValueString($name, $diff) { |
| 185 | - return (string)$this->$name . (string)$diff; |
|
| 185 | + return (string) $this->$name.(string) $diff; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | * @return array |
| 193 | 193 | */ |
| 194 | 194 | protected function _adjustValueArray($name, $diff) { |
| 195 | - $copy = (array)$this->$name; |
|
| 196 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
| 195 | + $copy = (array) $this->$name; |
|
| 196 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
| 197 | 197 | return $copy; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return int |
| 205 | 205 | */ |
| 206 | 206 | protected function _adjustValueIntegerDiff($name, $diff) { |
| 207 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
| 207 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @return float |
| 215 | 215 | */ |
| 216 | 216 | protected function _adjustValueDoubleDiff($name, $diff) { |
| 217 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
| 217 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @return string |
| 225 | 225 | */ |
| 226 | 226 | protected function _adjustValueStringDiff($name, $diff) { |
| 227 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
| 227 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @return array |
| 235 | 235 | */ |
| 236 | 236 | protected function _adjustValueArrayDiff($name, $diff) { |
| 237 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
| 237 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
| 238 | 238 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
| 239 | 239 | return $copy; |
| 240 | 240 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | array_walk($type, 'DbSqlHelper::UCFirstByRef'); |
| 259 | 259 | $type = implode('', $type); |
| 260 | 260 | |
| 261 | - if (!method_exists($this, $methodName = '_adjustValue' . $type . $suffix)) { |
|
| 261 | + if (!method_exists($this, $methodName = '_adjustValue'.$type.$suffix)) { |
|
| 262 | 262 | throw new ExceptionTypeUnsupported(); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $this->checkPropertyExists($name); |
| 305 | 305 | |
| 306 | 306 | // Now deciding - will we call a protected setter or will we work with protected property |
| 307 | - if (method_exists($this, $methodName = 'adj' . ucfirst($name))) { |
|
| 307 | + if (method_exists($this, $methodName = 'adj'.ucfirst($name))) { |
|
| 308 | 308 | // If method exists - just calling it |
| 309 | 309 | // Method returns new adjusted value |
| 310 | 310 | $newValue = call_user_func_array(array($this, $methodName), array($diff)); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Adding diff to adjustment accumulator |
| 326 | - if (method_exists($this, $methodName = 'adj' . ucfirst($name) . 'Diff')) { |
|
| 326 | + if (method_exists($this, $methodName = 'adj'.ucfirst($name).'Diff')) { |
|
| 327 | 327 | call_user_func_array(array($this, $methodName), array($diff)); |
| 328 | 328 | } else { |
| 329 | 329 | // TODO - property type checks |