Try get the range instance starting from its string representation.

@param string|mixed $range

@return static|null
489342
public static function fromString($range)
    {
        $result = null;
        $address = Factory::addressFromString($range);
        if ($address !== null) {
            $result = new static($address);
        }

        return $result;
    }
840222
public static function fromArray(array $range)
    {
        $startType = null;
        $start = null;
        if (array_key_exists('startClosed', $range)) {
            $startType = self::TYPE_CLOSED;
            $start = $range['startClosed'];
        } elseif (array_key_exists('startOpen', $range)) {
            $startType = self::TYPE_OPEN;
            $start = $range['startOpen'];
        }

        $endType = null;
        $end = null;
        if (array_key_exists('endClosed', $range)) {
            $endType = self::TYPE_CLOSED;
            $end = $range['endClosed'];
        } elseif (array_key_exists('endOpen', $range)) {
            $endType = self::TYPE_OPEN;
            $end = $range['endOpen'];
        }

        return new self(array_filter([
            'startType' => $startType,
            'start' => $start,
            'endType' => $endType,
            'end' => $end
        ]));
    }
84474
public function getPageRange($range = 4)
    {
        $from = max(1, $this->getPage() - $range);
        $to = min($this->getPageCount(), $this->getPage() + $range);

        return range($from, $to);
    }
1199306
function range($min = null, $max = null)
	{
		$this->min($min);
		$this->max($max);
		return $this;
	}
607586
public function getRange(): string
    {
        if (empty($this->_rangeEnd)) {
            return $this->_rangeStart;
        } else {
            return $this->_rangeStart . ',' . $this->_rangeEnd;
        }
    }
682491
static function integer($range = Constants::RANGE)
    {
        # Test the length for validity.
        Helpers::rangeCheck($range, Constants::RANGE_MAX, Constants::RANGE_MIN, 'Entropy', 'integer');

        return \Sodium\randombytes_uniform($range) + 1;
    }
713434
public function has($name, $range = '') {
        $range = $range ?: $this->range;

        return isset($this->lang[$range][$name]);
    }
145175
public function range($subPattern = null)
    {
        $arguments = func_get_args();

        // odd number of arguments, must assume last is subPattern
        if (count($arguments) % 2 === 1) {
            $subPattern = array_pop($arguments);
        } else {
            $subPattern = null;
        }

        $value     = '[';

        for ($fromIndex = 0; $fromIndex < count($arguments); $fromIndex += 2) {
            $toIndex = $fromIndex + 1;
            if ($toIndex >= count($arguments)) {
                break;
            }

            $from = $this->sanitise($arguments[$fromIndex]);
            $to   = $this->sanitise($arguments[$toIndex]);

            $value .= $from . '-' . $to;
        }

        $value .= ']';

        return $this->add($value, $subPattern);
    }
430882
protected function getTreeElement( $range )
	{

		$dataService = TreeService::singleton();
		/**
		 * @var tao_helpers_form_elements_xhtml_Combobox $element
		 */
		$element     = tao_helpers_form_FormFactory::getElement( "{$this->getIndex()}_range_tree", 'Combobox' );
		$element->setDescription( __( 'Tree values' ) );
		$element->addAttribute( 'class', 'property-template tree-template' );
		$element->addAttribute( 'disabled', 'disabled' );
		$element->setEmptyOption( ' --- ' . __( 'select' ) . ' --- ' );
		$treeOptions = array();
		foreach ($dataService->getTrees() as $tree) {
			$treeOptions[tao_helpers_Uri::encode( $tree->getUri() )] = $tree->getLabel();
			if (null !== $range && $range->getUri() === $tree->getUri()) {
				$element->setValue( $tree->getUri() );
			}
		}
		$element->setOptions( $treeOptions );

		return $element;
	}
490375
public function equals(DateTimeRange $range)
	{
		return $this->start->equals($range->start) && $this->end->equals($range->end) && $this->interval->equals($range->interval);
	}
1018948
public function asDatespan(DatespanRange $range = null)
    {
        $this->checkDefaultType(function() { return $this->default instanceof Datespan;}, Datespan::class);
        return $this->default;
    }
42850
private function range($value, $range)
    {
        if (is_string($value)) {
            $value = strlen($value);
        }

        return $value >= $range[0] && $value <= $range[1]; // 如果是数字，则需要是一个数组,例array(5,22)
    }
558958
public function containsRange(RangeInterface $range)
    {
        $result = false;
        if ($range->getAddressType() === $this->getAddressType()) {
            if ($range->toString(false) === $this->toString(false)) {
                $result = true;
            }
        }

        return $result;
    }
1038592
public function inArray($range)
    {
        if (!is_array($range)) {
            throw new InvalidArrayException('range', $range);
        } elseif (empty($range)) {
            throw new InvalidNotEmptyException('range');
        }

        if (!in_array($this->value, $range, true)) {
            throw new ValueNotInArrayException($this->name, $this->value, $range);
        }

        return $this;
    }
1207386
public static function get($name = null, $range = null, $inherit=true)
    {
        $range = $range ?: self::$range;
        
        // load default
        static::autoload($range);
        
        $value = null;
        if (empty($name)) {// get all
            $value = isset(self::$data[$range]) ? self::$data[$range] : null;
        } elseif (isset(self::$data[$range][$name])){
            $value = self::$data[$range][$name];
        } elseif (strpos($name, '.')) { // has '.'
            $names    = explode('.', $name, 3);
            if (count($names) > 2) {
                $value = isset(self::$data[$range][$names[0]][$names[1]][$names[2]]) ? self::$data[$range][$names[0]][$names[1]][$names[2]] : null;
            } else {
                $value = isset(self::$data[$range][$names[0]][$names[1]]) ? self::$data[$range][$names[0]][$names[1]] : null;
            }
        }
        
        // if inherit get default range config  && 
        if ($range !== self::$range && $inherit) {
            if ($value === null) {
                $value = self::get($name, self::$range, false);
            } elseif (is_array($value)) {
                $vd = self::get($name, self::$range, false);
                $value = ArrayHelper::merge($vd, $value);
            }
        }
        
        return $value;
    }
805183
public function getInRange($range = null) {
        if(is_null($range))
            $range = $this->range;
        $current_range = array( ($this->current_page-$range < 1 ? 1 : $this->current_page-$range),
            ($this->current_page+$range > $this->getMax() ? $this->getMax() : $this->current_page+$range));
        $rangeIDs = array();
        for($x = $current_range[0]; $x <= $current_range[1]; ++$x) {
            $rangeIDs[] = $x;
        }
        return $rangeIDs;
    }
1122647
public static function range($range): ISeq
    {
        [$start, $end, $step] = Range::parse($range);

        if ($end === self::INFINITE) {
            $seq = new static(
                function () use ($start, $step) {
                    for ($i = $start; true; $i += $step) {
                        yield $i;
                    }
                }
            );

            return $seq->setIsInfinite();
        }

        return new static(range($start, $end, $step));
    }