public static function first(array $data, ?string $key = null)
    {
        if (count($data) === 0) {
            return null;
        }
        reset($data);
        $element = current($data);
        if ($key !== null && is_array($element) && isset($element[$key])) {
            return $element[$key];
        }
        return $element;
    }