private function buildDimensionalArray(array $keys, $dimensions, $value)
    {
        $result = [];

        // add first dimension
        $result[$keys[0]] = [];
        $pointer = &$result[$keys[0]];

        for ($i = 1; $i < $dimensions; $i++) {
            if ($i === ($dimensions - 1)) {
                $pointer[$keys[$i]] = $value;
            } else {
                $pointer[$keys[$i]] = [];
                $pointer = &$pointer[$keys[$i]];
            }
        }

        return $result;
    }