| Total Complexity | 7 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | class ImageTransformation implements ArrayAccess |
||
| 8 | { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param array $transformation |
||
| 12 | */ |
||
| 13 | public function __construct(protected array $transformation) { |
||
| 14 | } |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param $offset |
||
| 18 | * @return bool |
||
| 19 | */ |
||
| 20 | public function offsetExists($offset): bool |
||
| 21 | { |
||
| 22 | return isset($this->$transformation[$offset]); |
||
|
|
|||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param $offset |
||
| 27 | * @return mixed|null |
||
| 28 | */ |
||
| 29 | public function offsetGet($offset): mixed |
||
| 30 | { |
||
| 31 | return $this->transformation[$offset] ?? null; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param $offset |
||
| 36 | * @param $value |
||
| 37 | * @return void |
||
| 38 | */ |
||
| 39 | public function offsetSet($offset, $value): void |
||
| 40 | { |
||
| 41 | if (is_null($offset)) { |
||
| 42 | $this->transformation[] = $value; |
||
| 43 | } else { |
||
| 44 | $this->transformation[$offset] = $value; |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param $offset |
||
| 50 | * @return void |
||
| 51 | */ |
||
| 52 | public function offsetUnset($offset): void |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Allows direct access to the Image Transformer object and it’s __toString |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function __toString(): string |
||
| 65 | } |
||
| 66 | } |