Resolve quality.
@return string The resolved quality.
17855
public function getQuality()
    {
        $default = 90;

        if (!is_numeric($this->q)) {
            return $default;
        }

        if ($this->q < 0 or $this->q > 100) {
            return $default;
        }

        return (int) $this->q;
    }
929979
public function resolve(): array
    {
        $file = sprintf($this->template, $this->typeResolver->resolve());

        if (!file_exists($file)) {
            $file = sprintf($this->template, 'default');
        }

        return json_decode(file_get_contents($file), true);
    }
1167972
private function getQuality($quality, $extension) {

		if(false === ('-' . intval($quality) == '-' . $quality)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($quality)), E_USER_ERROR);
		}

		if(false === is_string($extension)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($extension)), E_USER_ERROR);
		}

		if(strtolower($extension) === 'png' && $quality > 9) {
			$quality = floor(($quality - 1) / 10);
		}

		return $quality;
	}
338873
def accept_quality(accept, default=1):
    """"""
    quality = default
    if accept and ";" in accept:
        accept, rest = accept.split(";", 1)
        accept_quality = RE_ACCEPT_QUALITY.search(rest)
        if accept_quality:
            quality = float(accept_quality.groupdict().get('quality', quality).strip())

    return (quality, accept.strip())
1261694
public function getDefaultJpegQuality()
    {
        $result = $this->config->get('concrete.misc.default_jpeg_image_compression');
        if ($this->valn->integer($result, 0, 100)) {
            $result = (int) $result;
        } else {
            $result = static::DEFAULT_JPEG_QUALITY;
        }

        return $result;
    }
1197839
private function getInputLevelConfiguration()
    {
        $resolver = new OptionsResolver();
        foreach ($this->baseMetrics as $metric => $values) {
            $resolver
                ->setRequired($metric)
                ->setAllowedValues($metric, array_keys($values))
            ;
            if ($metric == 'PR') {
                $resolver->setNormalizer($metric, function (Options $options, $value) use ($metric) {
                    switch ($value) {
                        case 'L':
                        case 'H':
                            if ($this->vectorInputs['S'] == 'U') {
                                $value = (float) $this->baseMetrics[$metric][$value]['unchanged'];
                            }
                            elseif ($this->vectorInputs['S'] == 'C') {
                                $value = (float) $this->baseMetrics[$metric][$value]['changed'];
                            }
                            break;
                        default:
                            $value = (float) $this->baseMetrics[$metric][$value];
                            break;
                    }
                    return $value;
                });
            }
            else { //if ($metric != 'S') {
                $resolver->setNormalizer($metric, function (Options $options, $value) use ($metric) {
                    return (float) $this->baseMetrics[$metric][$value];
                });
            }
        }

        foreach ($this->temporalMetrics as $metric => $values) {
            $resolver
                ->setDefault($metric, 'X')
                ->setAllowedValues($metric, array_keys($values))
                ->setNormalizer($metric, function (Options $options, $value) use ($metric) {
                    return (float) $this->temporalMetrics[$metric][$value];
                })
            ;
        }

        foreach ($this->environmentalMetrics as $metric => $values) {
            $resolver
                ->setDefault($metric, 'X')
                ->setAllowedValues($metric, array_keys($values))
            ;
            switch ($metric) {
//                case 'MS': break;
                case 'MPR':
                    $resolver->setNormalizer($metric, function (Options $options, $value) use ($metric) {
                        $modifiedScope = isset($this->vectorInputs['MS']) && $this->vectorInputs['MS'] != 'X' ? $this->vectorInputs['MS'] : $this->vectorInputs['S'];
                        switch ($value) {
                            case 'X':
                                if ($this->vectorInputs[substr($metric, 1)] == 'N') {
                                    $value = (float)$this->baseMetrics[substr($metric, 1)][$this->vectorInputs[substr($metric, 1)]];
                                }
                                else {
                                    switch ($modifiedScope) {
                                        case 'U':
                                            $value = (float)$this->baseMetrics[substr($metric, 1)][$this->vectorInputs[substr($metric, 1)]]['unchanged'];
                                            break;
                                        case 'C':
                                            $value = (float)$this->baseMetrics[substr($metric, 1)][$this->vectorInputs[substr($metric, 1)]]['changed'];
                                            break;
                                    }
                                }
                                break;
                            case 'L':
                            case 'H':
                                switch ($modifiedScope) {
                                    case 'U':
                                        $value = (float) $this->environmentalMetrics[$metric][$value]['unchanged'];
                                        break;
                                    case 'C':
                                        $value = (float) $this->environmentalMetrics[$metric][$value]['changed'];
                                        break;
                                }
                                break;
                            default:
                                $value = (float) $this->environmentalMetrics[$metric][$value];
                                break;
                        }

                        return $value;
                    });
                    break;
                case 'CR':
                case 'IR':
                case 'AR':
                    $resolver->setNormalizer($metric, function (Options $options, $value) use ($metric) {
                        return (float) $this->environmentalMetrics[$metric][$value];
                    });
                    break;
                default:
                    $resolver->setNormalizer($metric, function (Options $options, $value) use ($metric) {
                        if ($value == 'X') {
                            $value = (float) $options[substr($metric, 1)];
                        }
                        else {
                            $value = (float) $this->environmentalMetrics[$metric][$value];
                        }
                        return $value;
                    });
                    break;
            }
        }

        return $resolver;
    }
201989
public function resolveAction()
    {
        $success    = null;
        $failed     = null;
        $service    = $this->getServiceLocator();
        $userModel  = $service->get( 'Grid\User\Model\User\Model' );
        $confirm    = $service->get( 'Grid\User\Model\ConfirmHash' );
        $hash       = $this->params()
                           ->fromRoute( 'hash' );

        if ( $confirm->has( $hash ) &&
             ( $email = $confirm->find( $hash ) ) )
        {
            $user = $userModel->findByEmail( $email );

            if ( ! empty( $user ) &&
                 $user->state != UserStructure::STATE_BANNED )
            {
                $request    = $this->getRequest();
                $data       = $request->getPost();
                $form       = $service->get( 'Form' )
                                      ->get( 'Grid\User\PasswordChangeRequest\Resolve' );

                if ( $request->isPost() )
                {
                    $form->setData( $data );

                    if ( $form->isValid() )
                    {
                        $data = $form->getData();
                        $user->state        = UserStructure::STATE_ACTIVE;
                        $user->confirmed    = true;
                        $user->password     = $data['password'];

                        if ( $user->save() )
                        {
                            $confirm->delete( $hash );
                            $success = true;
                        }
                    }
                    else
                    {
                        $success = false;
                    }
                }
            }
            else
            {
                $failed = true;
            }
        }
        else
        {
            $failed = true;
        }

        if ( $failed === true )
        {
            $this->messenger()
                 ->add( 'user.form.passwordChange.failed',
                        'user', Message::LEVEL_ERROR );

            return $this->redirect()
                        ->toRoute( 'Grid\User\PasswordChangeRequest\Create', array(
                            'locale'    => (string) $this->locale(),
                            'returnUri' => '/',
                        ) );
        }

        if ( $success === true )
        {
            $this->messenger()
                 ->add( 'user.form.passwordChange.success',
                        'user', Message::LEVEL_INFO );

            return $this->redirect()
                        ->toRoute( 'Grid\User\Authentication\Login', array(
                            'locale'    => (string) $this->locale(),
                            'returnUri' => '/',
                        ) );
        }

        if ( $success === false )
        {
            $this->messenger()
                 ->add( 'user.form.passwordChange.resolve.failed',
                        'user', Message::LEVEL_ERROR );
        }

        $this->paragraphLayout();

        return new MetaContent( 'user.passwordChangeRequest', array(
            'success'   => $success,
            'form'      => $form,
        ) );
    }
245258
private function getResolverHandlerChain()
    {
        $randomResolver = $this->resolverFactory->create(Random::class);
        $nonMutualResolver = $this->resolverFactory->create(NonMutual::class, $randomResolver);

        return $this->resolverFactory->create(FromExistingPair::class, $nonMutualResolver);
    }
216684
public function resolve()
    {
        $this->page
            ->setName($this->name)
            ->setOnline(!empty($this->online))
            ->setTitle($this->title)
            ->setMeta(array('title' => $this->title))
            ->setPath($this->getFullPath())
        ;

        $this->assertEntityIsValid($this->page, array('Page', 'creation'));

        $this->fireEvent(
            PageEvents::PAGE_CREATED,
            new PageEvent($this->page, $this)
        );

        return $this->page;
    }
190578
protected function getDesiredImageQuality($ext, $format)
    {
        switch ($ext) {
            case 'jpeg':
            case 'jpg':
                $qualityConfig = $this->jpegQuality;
                break;

            case 'png':
                $qualityConfig = $this->pngQuality;
                break;

            default:
                $qualityConfig = null;
        }

        if (empty($qualityConfig)) {
            return null;
        }
        if (is_array($qualityConfig)) {
            if (isset($qualityConfig[$format])) {
                return $qualityConfig[$format];
            }
            if (isset($qualityConfig['default'])) {
                return $qualityConfig['default'];
            }
        }
        return $qualityConfig;
    }
167727
public function getResolutions()
	{
		// Fetch resolutions when the method is called for the first time.
		if ( $this->resolutions === null ) {
			$resolutions = array();
			$result = $this->api(self::REQUEST_GET, '/rest/api/2/resolution', array(), true);

			foreach ( $result as $resolution ) {
				$resolutions[$resolution['id']] = $resolution;
			}

			$this->resolutions = $resolutions;
		}

		return $this->resolutions;
	}
140929
public function getResolver()
    {
        if ($this->resolver === null) {
            $config = $this->getConfig('resolver');
            if ($config !== null) {
                $this->resolver = $this->buildResolver($config);
            } else {
                throw new RuntimeException('Resolver has not been set.');
            }
        }

        return $this->resolver;
    }
412706
public function resolve()
    {
        $this->zone = new $this->zoneClass();
        $this->zone->setZoneType($this->zoneType);
        $this->zone->setComponents(
            $this->components->buildRanking()
        );

        $this->assertEntityIsValid($this->zone, array('Zone', 'creation'));

        $this->fireEvent(
            ZoneEvents::ZONE_CREATED,
            new ZoneEvent($this->zone, $this)
        );

        return $this->zone;
    }
1234452
private static function resolveScheme(){
        $scheme = filter_input(INPUT_SERVER, "REQUEST_SCHEME");
        $https  = filter_input(INPUT_SERVER, "HTTPS");

        if(is_string($scheme)){
            return strtolower($scheme);
        }

        if(null !== $https){
            if(is_bool($https)){
                return $https ? "https" : "http";
            }

            return "off" === $https ? "http" : "https";
        }

        return "http";
    }
579261
public function getResolver()
    {
        if (null !== $this->typeResolver) {
            return $this->typeResolver;
        }

        $classResolver = $this->getDefaultTypeResolverClass();
        $r = new ReflectionClass($classResolver);
        $resolver = $r->newInstance();
        $this->typeResolver = $resolver;

        return $this->typeResolver;
    }
54142
public function resolve()
    {
       $url = $this->request->url();
       $tmp = explode('/', $url);
       $last_seg = end($tmp);

       return $this->repository->findBySlug($last_seg);
    }
818360
public static function resolve()
    {
        // Get current URL
        $oRequest = new Request();
        $sUrl = $oRequest->url();
        // Set default separator
        if (Configuration::check('routing.default_separator') === true) {
            $cDefaultSeparator = Configuration::read('routing.default_separator');
            RouteCollection::setDefaultSeparator($cDefaultSeparator);
        }
        // Remove last char of URL if it's a separator
        $sUrl = self::removeLastSeparator($sUrl);
        // Get list of separator for this URL
        $arcUrlSeparator = self::listSeparator($sUrl);
        // Get list of value of this URL
        $arsUrlValue = self::listValue($sUrl);
        // Check route
        $bCheckResult = self::checkRoute($arcUrlSeparator, $arsUrlValue);
        if ($bCheckResult === false && Configuration::read('routing.auto') === true) {
            self::autoResolve($arsUrlValue);
        }
        self::checkController();
        self::setParameterInGlobal();
    }