private function getPairs(array $array, $space, $omit, callable $encode, & $omitted = true)
    {
        $pairs = [];
        $nextIndex = 0;
        $omitted = true;
        $format = '%s' . $space . '=>' . $space . '%s';

        foreach ($array as $key => $value) {
            if ($omit && $this->canOmitKey($key, $nextIndex)) {
                $pairs[] = $encode($value, 1);
            } else {
                $pairs[] = sprintf($format, $encode($key, 1), $encode($value, 1));
                $omitted = false;
            }
        }

        return $pairs;
    }