| Total Complexity | 3 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 3 | class PropertyWriter { |
||
| 4 | private $closure; |
||
| 5 | public function __construct($object) { |
||
| 6 | if ($object instanceof \stdclass) { |
||
| 7 | $this->closure = function ($field, $value) use ($object) { $object->$field = $value; }; |
||
| 8 | } |
||
| 9 | else { |
||
| 10 | $this->closure = function ($field, $value) { $this->$field = $value; }; |
||
| 11 | $this->closure = $this->closure->bindTo($object, $object); |
||
| 12 | } |
||
| 13 | } |
||
| 14 | |||
| 15 | public function __set($field, $value) { |
||
| 17 | } |
||
| 18 | } |