| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | public function __construct($object) { |
||
| 9 | if ($object instanceof \stdclass) { |
||
| 10 | $this->readClosure = function() use ($object) { return $object; }; |
||
| 11 | $this->writeClosure = function ($field, $value) use ($object) { $object->$field = $value; }; |
||
| 12 | } |
||
| 13 | else { |
||
| 14 | $visOverride = $this; |
||
| 15 | $this->readClosure = function() use ($visOverride) { |
||
| 16 | return (object) array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']); |
||
| 17 | }; |
||
| 18 | $this->readClosure = $this->readClosure->bindTo($object, $object); |
||
| 19 | |||
| 20 | $this->writeClosure = function ($field, $value) { $this->$field = $value; }; |
||
| 21 | $this->writeClosure = $this->writeClosure->bindTo($object, $object); |
||
| 22 | } |
||
| 47 |