RedBeanPHP\QueryWriter\AQueryWriter::getParametersForInClause PHP Method

getParametersForInClause() protected method

This method calculates the correct number of slots to insert in the SQL snippet and determines the correct type of slot. If the bindings array contains named parameters this method will return named ones and update the keys in the value list accordingly (that's why we use the &). If you pass an offset the bindings will be re-added to the value list. Some databases cant handle duplicate parameter names in queries.
protected getParametersForInClause ( &$valueList, array $otherBindings, integer $offset ) : string
$otherBindings array list of additional bindings
$offset integer start counter at...
return string
    protected function getParametersForInClause(&$valueList, $otherBindings, $offset = 0)
    {
        if (is_array($otherBindings) && count($otherBindings) > 0) {
            reset($otherBindings);
            $key = key($otherBindings);
            if (!is_numeric($key)) {
                $filler = array();
                $newList = !$offset ? array() : $valueList;
                $counter = $offset;
                foreach ($valueList as $value) {
                    $slot = ':slot' . $counter++;
                    $filler[] = $slot;
                    $newList[$slot] = $value;
                }
                // Change the keys!
                $valueList = $newList;
                return implode(',', $filler);
            }
        }
        return implode(',', array_fill(0, count($valueList), '?'));
    }