private function prepareFormat($value, $format)
    {
        if (!is_array($format)) {
            return [$format, [$value]];
        }
        if (!isset($format[0])) {
            throw new InvalidParamException('The $format array must contain at least one element.');
        }
        $f = $format[0];
        $format[0] = $value;
        $params = $format;
        $format = $f;
        return [$format, $params];
    }