@@ -64,9 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | // Convert key to a propertyname in $this |
| 66 | 66 | $propertyName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $itemKey)))); |
| 67 | - $propertyName = (property_exists($this, $propertyName)) ? $propertyName : |
|
| 68 | - (property_exists($this, lcfirst($propertyName)) ? lcfirst($propertyName) : |
|
| 69 | - preg_replace_callback('/([A-Z])/', function ($match) { |
|
| 67 | + $propertyName = (property_exists($this, $propertyName)) ? $propertyName : (property_exists($this, lcfirst($propertyName)) ? lcfirst($propertyName) : preg_replace_callback('/([A-Z])/', function ($match) { |
|
| 70 | 68 | return strtolower('_' . $match[1]); |
| 71 | 69 | }, lcfirst($propertyName)) |
| 72 | 70 | ); |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function getPropertyValue($key) { |
| 64 | 64 | $methodName = 'get' . $this->getMethodName($key); |
| 65 | - if(method_exists($this, $methodName)) { |
|
| 65 | + if (method_exists($this, $methodName)) { |
|
| 66 | 66 | return $this->{$methodName}(); |
| 67 | 67 | } |
| 68 | 68 | return false; |
@@ -60,7 +60,8 @@ |
||
| 60 | 60 | * @param $key |
| 61 | 61 | * @return mixed |
| 62 | 62 | */ |
| 63 | - public function getPropertyValue($key) { |
|
| 63 | + public function getPropertyValue($key) |
|
| 64 | + { |
|
| 64 | 65 | $methodName = 'get' . $this->getMethodName($key); |
| 65 | 66 | if(method_exists($this, $methodName)) { |
| 66 | 67 | return $this->{$methodName}(); |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | public function getClassFromClassProperty($class, $property) |
| 15 | 15 | { |
| 16 | - if(!class_exists($class)) { |
|
| 17 | - throw new \Exception($class. ' not found or does not exist'); |
|
| 16 | + if (!class_exists($class)) { |
|
| 17 | + throw new \Exception($class . ' not found or does not exist'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if(!property_exists($class, $property)) { |
|
| 20 | + if (!property_exists($class, $property)) { |
|
| 21 | 21 | throw new \Exception($class . ' has no property with the name ' . $property); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | if (preg_match('~\@var[\s]+([A-Za-z0-9\\\\]+)~', $comment, $matches)) { |
| 37 | 37 | if ($includeNamespaces) { |
| 38 | 38 | if ($reflectionClass instanceof \ReflectionClass && !in_array($matches[1], HydratableTrait::$nonObjectTypes)) { |
| 39 | - return ($reflectionClass->getNamespaceName()) ? sprintf('\%s\%s', $reflectionClass->getNamespaceName(), $matches[1]) : sprintf('\%s', $matches[1]); |
|
| 39 | + return ($reflectionClass->getNamespaceName()) ? sprintf('\%s\%s', $reflectionClass->getNamespaceName(), $matches[1]) : sprintf('\%s', $matches[1]); |
|
| 40 | 40 | } |
| 41 | 41 | return $matches[1]; |
| 42 | 42 | } |