Custom data holder
- Create an object in DataHolders namespace
- Extend
\Wrkflow\GetValue\DataHolders - Implement
getValue(string|array $key): mixedthat should return required value (make it nullable). - Implement
public function get(): arraythat should return whole data when you need it.
<?php
declare(strict_types=1);
namespace Wrkflow\GetValue\DataHolders;
class ArrayData extends AbstractData{ public function __construct(private readonly array $flatArray) { }
public function getValue(string|array $key): mixed { return $this->flatArray[implode('.', $key)] ?? null; }
public function get(): array { return $this->flatArray; }}