Parse resolution.

@param string $resolution
Resolution string, i.e. "360x640".

@return $this
186045
public function parse($resolution) {
    preg_match_all(self::RESOLUTION_FORMAT, $resolution, $matches);
    $message = "Cannot parse provided resolution '{$resolution}'. It must be in the following format: 360x640";
    Assert::notEmpty($matches, $message);
    Assert::keyExists($matches, 0, $message);
    Assert::keyExists($matches, 1, $message);
    Assert::keyExists($matches, 2, $message);
    Assert::notEmpty($matches[1][0], $message);
    Assert::notEmpty($matches[2][0], $message);
    $this->setWidth($matches[1][0]);
    $this->setHeight($matches[2][0]);
    return $this;
  }
575978
protected function resolve($modifier)
    {
        if ($modifier > 0 && !($modifier & $this->allowedModifiers)) {
            throw new BadArgumentException('Given modifier ":name[0x:bit]" don\'t allowed for this statement ":stmt"', [
                'name' => isset(static::$modifiersNameMap[$modifier]) ? static::$modifiersNameMap[$modifier] : 'UNKNOWN',
                'bit'  => dechex($modifier),
                'stmt' => $this->statementName,
            ]);
        }
        
        return $modifier;
    }
195778
public function getCdnForImage($originalUr)
    {
        if (0 === strpos($originalUr, 'data:')) {
            throw new ResolutionException('Encoded image are not resolvable');
        }

        foreach ($this->cdnConfigurations as $configuration) {
            $originalPath = parse_url($originalUr, PHP_URL_PATH);
            $originalHost = parse_url($originalUr, PHP_URL_HOST);

            if (null === $originalPath) {
                throw new ResolutionException('Image has no path');
            }

            if (!$this->isDomainMatch($originalHost, $configuration->getSourceDomains())) {
                continue;
            }

            if (!$this->isPatternMatch($configuration, $originalPath)) {
                continue;
            }

            return $configuration;
        }

        throw new ResolutionException(sprintf('Cannot find cdn configuration match for image %s', $originalUr));
    }
879669
public function setDocoptDefinition($doc) {
        if ($this->frozen)    throw new RuntimeException('Configuration of "'.get_class($this).'" is frozen');
        if (!is_string($doc)) throw new IllegalTypeException('Illegal type of parameter $doc: '.gettype($doc));

        $parser = new DocoptParser();
        $this->docoptResult = $parser->parse($doc);

        $this->docoptDefinition = $doc;
        return $this;
    }
715039
protected function resolveDependency(ReflectionParameter $dep) {
        $depName = $dep->getName();

        if ($dep->getClass()) {
            $depName = $dep->getClass()->name;
        }

        // bound
        if (array_key_exists($depName, $this->bindings)) {
            return $this->resolve($depName);
        }

        // unbound
        if (class_exists('\\' . $depName)) {
            return $this->make($depName);
        }

        // check for default val
        if ($dep->isDefaultValueAvailable()) {
            return $dep->getDefaultValue();
        }

        throw new ResolutionException(
            "Unable to resolve dependency {$depName} for {$dep->getDeclaringClass()->name}"
        );
    }
698958
protected function setSpecificPrecisionFormat($precision)
    {
        if ($precision < 0) {
            throw new \InvalidArgumentException('Precision must be positive');
        }
        if ($precision > 3) {
            throw new \InvalidArgumentException('Invalid precision. Binary suffix converter can only represent values in '.
                'up to three decimal places');
        }

        $icuFormat = '#';
        if ($precision > 0) {
            $icuFormat .= \str_pad('#.', (2 + $precision), '0');
        }

        foreach ($this->binaryPrefixes as $size => $unitPattern) {
            if ($size >= 1024) {
                $symbol = \substr($unitPattern, \strpos($unitPattern, ' '));
                $this->binaryPrefixes[$size] = $icuFormat.$symbol;
            }
        }
    }
54343
public function parseIncludes($includes)
    {
        $includes = $this->normalizeIncludesOrExcludes($includes);

        $this->includes = array_merge($this->includes, (array) $includes);

        return $this;
    }
892202
public static function createFrom(self $resolving = null, string $key): self
    {
        $instance = null === $resolving ? new self() : $resolving;
        if (false === $instance->has($key)) {
            $instance->add($key);
        }

        return $instance;
    }
1105457
public static ResourceResolutionComponent[] resolve(Object... resolutionParams) {
        ResourceResolutionComponent[] components = new ResourceResolutionComponent[resolutionParams.length];
        for (int i = 0; i < resolutionParams.length; i++) {
            if (resolutionParams[i] == null) {
                components[i] = new StringResolutionComponent("");
            } else if (resolutionParams[i] instanceof ResourceResolutionComponent) {
                components[i] = (ResourceResolutionComponent) resolutionParams[i];
            } else if (resolutionParams[i] instanceof Locale) {
                components[i] = new LocaleResolutionComponent((Locale) resolutionParams[i]);
            } else if (resolutionParams[i] instanceof String) {
                components[i] = new StringResolutionComponent((String) resolutionParams[i]);
            } else if (resolutionParams[i] instanceof String[]) {
                components[i] = new StringResolutionComponent((String[]) resolutionParams[i]);
            } else {
                components[i] = new StringResolutionComponent(String.valueOf(resolutionParams[i]));
            }
        }
	    return components;
    }
163393
public function setMax(?string $max) : self
    {
        if ($max !== null) {
            $max = Decimal::parse($max);
        }

        $this->max = $max;

        return $this;
    }
443446
public function setVersion ($version)
    {
        $version = strtolower(strval($version));
        if (! self::isValid($version)) {
            $version = self::DEFAULT_UNRESOLVED_VERSION;
        }
        
        $this->numbers = self::parse($version);
        $this->version = $version;
        return $this;
    }
809980
function set_image_resolution($val)
    {
        $parsed = $this->parse_image_resolution($val);

        $this->_prop_cache["image_resolution"] = null;
        $this->_props["image_resolution"] = $parsed;
    }
1229917
public function resolution($width = null, $height = null)
    {
        return [
            'width' => $width ?: $this->widths[array_rand($this->widths)],
            'height' => $height ?: $this->heights[array_rand($this->heights)]
        ];
    }
118776
public function scale($ratio)
    {
        $_width = (int)$this->do_getWidth();
        $_height = (int)$this->do_getHeight();

        if ($ratio === 1) {
            return $this;
        }

        $width = (int)($_width * $ratio);
        $height = (int)($_height * $ratio);

        $this->do_resize($width, $height);

        return $this;
    }
72078
public function round($precision = 0)
    {
        $precision = max(0, (int) $precision);
        if ($this->hasDecimals()) {
            if ($this->isPositive()) {
                $this->number = bcadd($this->number, '0.' . str_repeat('0', $precision) . '5', $precision);

                return $this;
            }

            $this->number = bcsub($this->number, '0.' . str_repeat('0', $precision) . '5', $precision);
        }

        return $this;
    }
1272679
protected int getResolutionIndex(double resolution) {
		if (layer instanceof TileBasedLayer) {
			return ((TileBasedLayer) layer).getTileConfiguration().getResolutionIndex(resolution);
		}
		return viewPort.getResolutionIndex(resolution);
	}
97855
public function resolve($reference)
    {
        if (empty($reference)) {
            return $reference;
        }

        if ($this->isResolvableAnonymousReference($reference)) {
            return $this->resolveAnonymousReference($reference);
        }

        return $this->resolveInternal($reference);
    }