private function expandPlaceholders($statement, array $parameters)
    {
        $index = 0;

        return preg_replace_callback(
            '/[\.]{3}\?|\?/',
            function ($match) use (&$index, &$statement, &$parameters) {
                if ($match[0] != '...?') {
                    ++$index;

                    return $match[0];
                }

                if (!is_array($parameters[$index]) || count($parameters[$index]) == 0) {
                    throw new OperationException(
                        sprintf(
                            'Variable length parameter %d is not an array.',
                            $index
                        ),
                        $statement
                    );
                }

                $result = implode(',', array_fill(0, count($parameters[$index]), '?'));

                ++$index;

                return $result;
            },
            $statement
        );
    }