Returns the currency code for active locale

@param Request $request

@return string
772249
protected function getLocaleCurrency(Request $request)
    {
        $currentLocale = $request->getLocale();
        $locale        = $this->container->get('locale.repository')->findOneBy(['code' => $currentLocale]);

        if (null !== $locale && $locale->getCurrency() instanceof Currency) {
            return $locale->getCurrency()->getCode();
        }

        return null;
    }
1241862
protected function getRedirectionUrl(Request $request)
    {
        $locale = $request->segment(1, null);

        if ($this->getSupportedLocales()->has($locale))
            return $this->isDefaultLocaleHidden($locale)
                ? $this->localization->getNonLocalizedURL()
                : false;

        // If the current url does not contain any locale
        // The system redirect the user to the very same url "localized" we use the current locale to redirect him
        if (
            $this->getCurrentLocale() !== $this->getDefaultLocale() ||
            ! $this->hideDefaultLocaleInURL()
        ) {
            return $this->localization->getLocalizedURL(session('locale'), $request->fullUrl());
        }

        return false;
    }
34091
public function getValueFromRequest(\Illuminate\Http\Request $request)
    {
        if ($request->hasSession() && ! is_null($value = $request->old($this->getPath()))) {
            return $value;
        }

        return $request->input($this->getPath());
    }
1133386
public function getActionAlias(Request $request): string
    {
        $actionAlias = str_replace('/', ':', $request->query->get('route'));

        if (empty($actionAlias)) {
            return $this->getConfiguration()->getDefaultController() . ':' . $this->getConfiguration()->getDefaultAction();
        }

        if (!strpos($actionAlias, ':')) {
            return $actionAlias . ':' . $this->getConfiguration()->getDefaultAction();
        }

        $aliases = array_keys($this->getQueryMap([]));

        foreach ($aliases as $alias) {
            if (strtolower($alias) === strtolower($actionAlias)) {
                $actionAlias = $alias;

                break;
            }
        }

        return $actionAlias;
    }
1309750
protected function getRequestClass($request)
    {
        $parts = explode('\\', $request);
        $lastIndex = count($parts) - 1;

        switch ($parts[$lastIndex]) {
            case 'Void':
                $parts[$lastIndex] = 'Cancel';
                break;
            case 'AVS':
            case 'INPay':
            case 'ABNiDEAL':
                $this->throwDeprecatedTransactionType();
                break;
            case 'Payin':
            case 'Payout':
                if ($this->getParentClass($parts, $lastIndex) === 'Citadel') {
                    $this->throwDeprecatedTransactionType();
                }
                break;
            case 'oBeP':
                if ($this->getParentClass($parts, $lastIndex) === 'PayByVouchers') {
                    $this->throwDeprecatedTransactionType();
                }
                break;
        }

        return sprintf(
            '\Genesis\API\Request\%s',
            implode('\\', $parts)
        );
    }
529961
public function apply(Request $request)
    {
        if (IpUtils::checkIp($request->getClientIp(), $this->subnet)) {
            $name = $this->extractFieldInfo($request->headers, $this->headerField);
            if (!empty($name)) {
                return $name;
            }
        }

        return '';
    }
416704
public function resolve(Request $request)
    {
        //locale
        switch ($this->localePattern) {
            case self::PATTERN_DOMAIN:
                $locale = $this->resolveFromDomain($request);
                $request->setLocale($locale);
                break;
        }

        return $request->getLocale();
    }
787732
protected function getFormat(Request $request)
    {
        $format = $request->getQueryParam('format');
        if (!isset($format)) {
            $format = $this->defaultFormat;
        }

        return $format;
    }
308773
public function detectLocale(HTTPRequest $request)
    {
        // Given multiple canditates, narrow down the final result using the client's preferred languages
        $inputLocales = $request->getHeader('Accept-Language');
        if (empty($inputLocales)) {
            return null;
        }

        // Generate mapping of priority => list of locales at this priority
        // break up string into pieces (languages and q factors)
        preg_match_all(
            '/(?<code>[a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(?<priority>1|0\.[0-9]+))?/i',
            $inputLocales,
            $parsedLocales
        );

        $prioritisedLocales = [];
        if (count($parsedLocales['code'])) {
            // create a list like "en" => 0.8
            $parsedLocales = array_combine($parsedLocales['code'], $parsedLocales['priority']);

            // Generate nested list of priorities => [locales]
            foreach ($parsedLocales as $locale => $priority) {
                $priority = empty($priority) ? "1.0" : (string)floatval($priority);
                if (empty($prioritisedLocales[$priority])) {
                    $prioritisedLocales[$priority] = [];
                }
                $prioritisedLocales[$priority][] = $locale;
            }

            // sort list based on value
            krsort($prioritisedLocales, SORT_NUMERIC);
        }

        // Check each requested locale against loaded locales
        $locales = Locale::getLocales(true);
        foreach ($prioritisedLocales as $priority => $parsedLocales) {
            foreach ($parsedLocales as $browserLocale) {
                foreach ($locales as $localeObj) {
                    /** @var Locale $localeObj */
                    if ($localeObj->isLocale($browserLocale)) {
                        return $localeObj;
                    }
                }
            }
        }
        return null;
    }
1276654
protected function getRequestToken($request)
    {
        $name = $this->getName();
        $header = 'X-' . ucwords(strtolower($name));
        if ($token = $request->getHeader($header)) {
            return $token;
        }

        // Get from request var
        return $request->requestVar($name);
    }
690540
private function getPostRequestEncoding( Request $request ) {
		if ( $request instanceof MultipartRequest ) {
			return 'multipart';
		}
		foreach ( $request->getParams() as $value ) {
			if ( is_resource( $value ) ) {
				return 'multipart';
			}
		}
		return 'form_params';
	}
1243713
public function determineLocale(Request $request)
    {
        $locale = $this->determiners
            ->map(function ($determiner) use ($request) {
                return $determiner->determineLocale($request);
            })
            ->filter()
            ->first();

        return $locale ?: $this->fallback;
    }
1237149
public function calculateGrossPrice(Request $request)
    {
        if (!$request->has('netPrice')) {
            return Response::json([
                'error' => "The 'netPrice' parameter is missing",
            ], 422);
        }

        $valid_vat_id = null;
        $valid_company = false;
        if ($request->has('vat_number')) {
            $valid_company = $this->validateVATID($request->get('vat_number'));
            $valid_company = $valid_company['is_valid'];
            $valid_vat_id = $valid_company;
        }

        return [
            'gross_price'   => $this->calculator->calculate($request->get('netPrice'), $request->get('country'), $request->get('postal_code'), $valid_company),
            'net_price'     => $this->calculator->getNetPrice(),
            'tax_rate'      => $this->calculator->getTaxRate(),
            'tax_value'     => $this->calculator->getTaxValue(),
            'valid_vat_id'  => $valid_vat_id,
        ];
    }
381739
private function setUserCurrency($currency, $request)
    {
        $currency = strtoupper($currency);

        // Set user selection globally
        currency()->setUserCurrency($currency);

        // Save it for later too!
        $request->getSession()->put(['currency' => $currency]);

        return $currency;
    }
677292
public static function detectLanguageFromRequest(Request $request)
    {
        $splitURL = explode("/", $request->path());
        if(isset($splitURL[0])) {
            // validate language
            if(self::findBySlug($splitURL[0])) {
                return $splitURL[0];
            }
        }
        return false;
    }
1148765
protected function getBestLanguage(Request $request, $default = null)
    {
        foreach ($request->getLanguages() as $language) {
            if (strpos($language, '_') !== false) {
                return $language;
            }
        }

        return $default;
    }
267631
protected function getSortingFromRequest(Request $request)
    {
        return $this->extractValues($this->getValuesFromRequest($request), $this->getSortingPrefix());
    }