private static function &dataByPath(array &$data, string $key, bool $create = false, $defaultValue = null)
    {
        if ($key === '') {
            return $data;
        }
        $pathSegments = explode('.', $key);
        foreach ($pathSegments as $pathSegment) {
            if (!is_array($data)) {
                $data = [];
            }
            if (!array_key_exists($pathSegment, $data) && !$create) {
                return $defaultValue;
            }
            $data = &$data[$pathSegment];
        }
        return $data;
    }