@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function __construct($object) { |
| 9 | 9 | if ($object instanceof \stdclass) { |
| 10 | - $this->readClosure = function() use ($object) { return $object; }; |
|
| 11 | - $this->writeClosure = function ($field, $value) use ($object) { $object->$field = $value; }; |
|
| 10 | + $this->readClosure = function() use ($object) { return $object; }; |
|
| 11 | + $this->writeClosure = function($field, $value) use ($object) { $object->$field = $value; }; |
|
| 12 | 12 | } |
| 13 | 13 | else { |
| 14 | 14 | $visOverride = $this; |
| 15 | 15 | $this->readClosure = function() use ($visOverride) { |
| 16 | - return (object) array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']); |
|
| 16 | + return (object)array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']); |
|
| 17 | 17 | }; |
| 18 | 18 | $this->readClosure = $this->readClosure->bindTo($object, $object); |
| 19 | 19 | |
| 20 | - $this->writeClosure = function ($field, $value) { $this->$field = $value; }; |
|
| 20 | + $this->writeClosure = function($field, $value) { $this->$field = $value; }; |
|
| 21 | 21 | $this->writeClosure = $this->writeClosure->bindTo($object, $object); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function write($data) { |
| 35 | 35 | if ($data != null) { |
| 36 | 36 | foreach ($data as $key => $value) { |
| 37 | - ($this->writeClosure)($key, $this->processDates($value)); |
|
| 37 | + ($this->writeClosure)($key, $this->processDates($value)); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | private function addRelationData($object, $name, $relation, $siblings) { |
| 29 | - if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) { |
|
| 29 | + if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation)) { |
|
| 30 | 30 | //After overwriting the relation, does the parent object ($object) need overwriting as well? |
| 31 | 31 | if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object; |
| 32 | 32 | } |