| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class ArrayEntryUpdater implements UpdatesTheProxyOwner |
||
| 17 | { |
||
| 18 | private $owner; |
||
| 19 | private $propertyShouldReference; |
||
| 20 | private $atPosition; |
||
| 21 | private $setter; |
||
| 22 | |||
| 23 | public function __construct( |
||
| 24 | $theOwner, |
||
| 25 | string $theProperty, |
||
| 26 | $atPosition, |
||
| 27 | Closure $setter = null |
||
| 28 | ) { |
||
| 29 | $this->owner = $theOwner; |
||
| 30 | $this->propertyShouldReference = $theProperty; |
||
| 31 | $this->atPosition = $atPosition; |
||
| 32 | $this->setter = $setter ?: function (string $property, $value, $position) : void |
||
| 33 | { |
||
| 34 | $this->$property[$position] = $value; |
||
| 35 | }; |
||
| 36 | } |
||
| 37 | |||
| 38 | public static function for( |
||
| 39 | $theOwner, |
||
| 40 | string $ofTheProperty, |
||
| 41 | $atPosition, |
||
| 42 | Closure $setter = null |
||
| 43 | ) : UpdatesTheProxyOwner |
||
| 44 | { |
||
| 45 | return new static($theOwner, $ofTheProperty, $atPosition, $setter); |
||
| 46 | } |
||
| 47 | |||
| 48 | public function updateWith($theLoadedInstance) : void |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |