private function encodeInteger($float, callable $encode)
    {
        $minimum = \defined('PHP_INT_MIN') ? \PHP_INT_MIN : ~\PHP_INT_MAX;

        if ($float >= $minimum && $float <= \PHP_INT_MAX) {
            return $encode((int) $float);
        }

        return number_format($float, 0, '.', '');
    }