public static function toComparable($boundary)
    {
        $isInternallyType = \is_numeric($boundary) || \is_bool($boundary) || \is_string($boundary);

        $comparable = null;
        if ($isInternallyType) {
            $comparable = $boundary;
        } elseif ($boundary instanceof \DateTimeInterface) {
            $comparable = $boundary->getTimestamp();
        } else {
            throw new \UnexpectedValueException('Unexpected boundary type');
        }

        return $comparable;
    }