public function getRanges($type, $includeExpired = false)
    {
        $sql = 'SELECT * FROM LoginControlIpRanges WHERE lcirType = ?';
        $params = [(int) $type];
        if (!$includeExpired) {
            $sql .= ' AND (lcirExpires IS NULL OR lcirExpires > ' . $this->connection->getDatabasePlatform()->getNowExpression() . ')';
        }
        $sql .= ' ORDER BY lcirID';
        $result = [];
        $dateTimeFormat = $this->connection->getDatabasePlatform()->getDateTimeFormatString();
        $rs = $this->connection->executeQuery($sql, $params);
        while (($row = $rs->fetch()) !== false) {
            yield IPRange::createFromRow($row, $dateTimeFormat);
        }
    }