Returns a gap range between two ranges.

@param   DateRange  $range  The range to compare to.

@return  DateRange

@since   2.0.0
4939
public function gap(DateRange $range)
	{
		return self::cast($this->range->gap($range->range));
	}
1009653
public function findVisitsDays(Range $interval): ?Result
	{
		$builder = $this->builder()
			->select('DATE([datefield]) datefield, SUM([visits]) visits')
			->andWhere('DATE([datefield]) BETWEEN DATE(%dt) AND DATE(%dt)', $interval->from, $interval->to)
			->addGroupBy('DATE([datefield])');
		return $this->execute($builder);
	}
1351626
public final boolean adjacent(final DateRange range) {
        boolean adjacent = false;
        if (rangeStart.equals(range.getRangeEnd())) {
            adjacent = true;
        } else if (rangeEnd.equals(range.getRangeStart())) {
            adjacent = true;
        }
        return adjacent;
    }
627666
protected function getRanges(array $values)
	{
		$i      = 0;
		$cnt    = count($values);
		$start  = $values[0];
		$end    = $start;
		$ranges = [];
		while (++$i < $cnt)
		{
			if ($values[$i] === $end + 1)
			{
				++$end;
			}
			else
			{
				$ranges[] = [$start, $end];
				$start = $end = $values[$i];
			}
		}
		$ranges[] = [$start, $end];

		return $ranges;
	}
401589
protected function getListElement( $range )
	{

		$service = tao_models_classes_ListService::singleton();

		/**
		 * @var tao_helpers_form_elements_xhtml_Combobox $element
		 */
		$element = tao_helpers_form_FormFactory::getElement( "{$this->getIndex()}_range_list", 'Combobox' );
		$element->setDescription( __( 'List values' ) );
		$element->addAttribute( 'class', 'property-template list-template' );
		$element->addAttribute( 'disabled', 'disabled' );
		$element->setEmptyOption( ' --- ' . __( 'select' ) . ' --- ' );
		$listOptions = array();

		foreach ($service->getLists() as $list) {
			$listOptions[tao_helpers_Uri::encode( $list->getUri() )] = $list->getLabel();
			if (null !== $range && $range->getUri() === $list->getUri()) {
				$element->setValue( $list->getUri() );
			}
		}

		$listOptions['new'] = ' + ' . __( 'Add / Edit lists' );
		$element->setOptions( $listOptions );

		return $element;
	}
909763
public function range($from, $to, $condition = true) {
		$range = new Range($this, !$condition);
		$range->setFrom($from);
		$range->setTo($to);
		return $range;
	}
1046404
public function asWeek(DatespanRange $range = null)
    {
        return $this->handleFilter(
                function() use($range)
                {
                    return filter\RangeFilter::wrap(
                            filter\WeekFilter::instance(),
                            $range
                    );
                }
        );
    }
1126525
public function findVisitsDays(Range $interval): ?Result
	{
		$this->checkVisits($interval);
		return $this->orm->trackingVisits->findVisitsDays($interval);
	}
84474
public function getPageRange($range = 4)
    {
        $from = max(1, $this->getPage() - $range);
        $to = min($this->getPageCount(), $this->getPage() + $range);

        return range($from, $to);
    }
1172711
public static function DateRangeDiff(string $from, string $to)
    {
        $date_Range = new \Phunc\DateRange\DateRange();
        $date_Range->fillFromString($from, $to);
        $date_Range->getFrom()->hour(0)->minute(0)->second(0);
        $date_Range->getTo()->hour(24); //->minute(59)->second(59);
        return $date_Range->diffInDays();
    }
297612
private function parseCidrRange($range)
    {
        list($address, $mask) = explode('/', $range);
        $longAddress = ip2long($address);
        return array(
            $longAddress & (((1 << $mask) - 1) << (32 - $mask)),
            $longAddress | ((1 << (32 - $mask)) - 1)
        );
    }
151184
public function setRange($range)
    {
        $allowed_values = array('station', 'region', 'solarsystem', '1', '2', '3', '4', '5', '10', '20', '30', '40');
        if ((!in_array($range, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'range', must be one of 'station', 'region', 'solarsystem', '1', '2', '3', '4', '5', '10', '20', '30', '40'");
        }
        $this->container['range'] = $range;

        return $this;
    }
170278
protected function getForPeriod($key, \DatePeriod $period)
    {
        $ranges = $this->getRanges($period);

        if (count($ranges) > 0) {
            if (count($ranges) == 1 && !($ranges[0] instanceof DateRange)) {
                return new DateValue($ranges[0], $this->repository->getFor($key, $ranges[0]));
            }

            $values = array();

            /** @var \Krucas\Counter\DateRange $range */
            foreach ($ranges as $range) {
                $values[] = new RangeValue(
                    $range,
                    $this->repository->getForRange($key, $range->getStartDate(), $range->getEndDate())
                );
            }

            return $values;
        }

        return null;
    }
789932
@Override
    public SequenceQuality getRange(Range range) {
        byte[] rdata = Arrays.copyOfRange(data, range.getLower(), range.getUpper());
        if (range.isReverse())
            ArraysUtils.reverse(rdata);
        return new SequenceQuality(rdata, true);
    }
607586
public function getRange(): string
    {
        if (empty($this->_rangeEnd)) {
            return $this->_rangeStart;
        } else {
            return $this->_rangeStart . ',' . $this->_rangeEnd;
        }
    }
474193
public static function rangeLastMonth()
    {
        $lastMonth = date('m') - 1;
        if ($lastMonth <= 0) {
            $lastMonth = 12;
        }
        $lastMonth = date('Y') . '-' . $lastMonth . '-01';

        return [self::toTs($lastMonth), self::toTs($lastMonth) + (86400 * (date('t', strtotime($lastMonth))-1))];
    }
669771
public function calendarRange($layout)
    {
        $rangeConfig = [
          'start' => $layout->getCalendarStart(),
          'end' => $layout->getCalendarEnd()
        ];
        $elements = [];
        $diurnalMax = $rangeConfig['end'] > $rangeConfig['start'] ? $rangeConfig['end'] : 23;
        for ($i = $rangeConfig['start']; $i <= $diurnalMax; $i++) {
            $elements[] = $i;
        }
        if ($diurnalMax != $rangeConfig['end']) {
            for ($i = 0; $i <= $rangeConfig['end']; $i++) {
                $elements[] = $i;
            }
        }

        return $elements;
    }