diff --git a/src/Model/MoveToTopProperty.php b/src/Model/MoveToTopProperty.php new file mode 100644 index 0000000..103af4e --- /dev/null +++ b/src/Model/MoveToTopProperty.php @@ -0,0 +1,29 @@ + + */ +class MoveToTopProperty implements ConvertPropertyInterface +{ + use PropertyAccessorTrait; + + public function __construct(public string $deep) + { + } + + public function convert(array $arr): array + { + $accessor = self::getPropertyAccessor(); + if (!$accessor->isReadable($arr, $this->deep)) { + return $arr; + } + + return $accessor->getValue($arr, $this->deep); + } +} \ No newline at end of file