tokenMatches

@param  \Modulus\Http\Request  $request
@return void
187723
protected function tokenMatches($request) : bool
  {
    if (!isset( $_SESSION['_saini']) || !$_SESSION['_saini']) return false;

    $csrfToken = $request->has('csrf_token') ? $request->input('csrf_token') : ($request->headers->has('X-CSRF-TOKEN') ? $request->header('X-CSRF-TOKEN') : null);
    $sessionToken =  $_SESSION['_saini'];

    if (!hash_equals($sessionToken, $csrfToken)) {
      return false;
    }

    return true;
  }
87197
protected function bindPathParameters($request)
    {
        $path = '/'.ltrim($request->decodedPath(), '/');

        preg_match($this->route->compiled->getRegex(), $path, $matches);

        return $this->matchToKeys(array_slice($matches, 1));
    }
72427
public function parse(\Request $request)
	{
		$uri = $request->uri->get();
		$method = $request->get_method();

		if ($uri === '' and $this->path === '_root_')
		{
			return $this->matched();
		}

		$result = $this->_parse_search($uri, null, $method);

		if ($result)
		{
			return $result;
		}

		return false;
	}
1344194
protected function checkCsrfToken(Request $request)
    {
        if (!$request->headers->has(self::CSRF_TOKEN_HEADER)) {
            return false;
        }

        return $this->csrfTokenManager->isTokenValid(
            new CsrfToken(
                $this->csrfTokenIntention,
                $request->headers->get(self::CSRF_TOKEN_HEADER)
            )
        );
    }
209259
public function matches(Route $route, Request $request)
	{
		if (is_null($route->getCompiled()->getHostRegex())) return true;

		return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
	}
1071971
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $request->setResult([
            Constants::FIELD_PAID => false,
        ]);
    }
697799
private function route(Request $request) : RouteMatch
    {
        foreach ($this->routes as $route) {
            try {
                $match = $route->match($request);
            }
            catch (RoutingException $e) {
                throw new HttpNotFoundException($e->getMessage(), $e);
            }

            if ($match !== null) {
                if ($match instanceof RouteMatch) {
                    return $match;
                }

                throw $this->invalidReturnValue('route', Route::class . ' or NULL', $match);
            }
        }

        throw new HttpNotFoundException('No route matches the request.');
    }
18593
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var SyliusPaymentInterface $payment */
        $payment = $request->getModel();

        /** @var OrderInterface $order */
        $order = $payment->getOrder();

        $this->gateway->execute($status = new GetStatus($payment));
        if ($status->isNew()) {
            try {
                $this->gateway->execute($convert = new Convert($payment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            } catch (RequestNotSupportedException $e) {
                $totalAmount = $order->getTotal();
                $payumPayment = new PayumPayment();
                $payumPayment->setNumber($order->getNumber());
                $payumPayment->setTotalAmount($totalAmount);
                $payumPayment->setCurrencyCode($order->getCurrencyCode());
                $payumPayment->setClientEmail($order->getCustomer()->getEmail());
                $payumPayment->setClientId($order->getCustomer()->getId());
                $payumPayment->setDescription($this->paymentDescriptionProvider->getPaymentDescription($payment));
                $payumPayment->setDetails($payment->getDetails());

                $this->gateway->execute($convert = new Convert($payumPayment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            }
        }

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        try {
            $request->setModel($details);
            $this->gateway->execute($request);
        } finally {
            $payment->setDetails((array) $details);
        }
    }
81644
public function matches(Route $route, Request $request)
    {
        return in_array($request->getMethod(), $route->getMethods());
    }
295204
protected function bindPathParameters(Request $request)
    {
        preg_match($this->compiled->getRegex(), '/' .$request->decodedPath(), $matches);

        return $matches;
    }
802450
protected function getRequestToken(Request $request)
    {
        /** @var TokenExtractorInterface $tokenExtractor */
        foreach ($this->tokenExtractors as $tokenExtractor) {
            if (($token = $tokenExtractor->extract($request))) {
                return $token;
            }
        }
    }
576126
public function handleRequest(Request $request): void
    {
        $this->getForm()->handleRequest($request);
        $this->handleForm($request->get('page'));
    }
23651
public function validate(Request $request)
    {
        $prefix = $this->filterAndExplode($this->prefix);

        $path = $this->filterAndExplode($request->getPathInfo());

        return ! \is_null($this->prefix) && $prefix == \array_slice($path, 0, \count($prefix));
    }
477863
public function parse(Request $request)
    {
        if (!$request->has($this->name)) {
            return;
        }

        $this->applied = true;

        $this->extractTokens($request->input($this->name));

        $this->value = [
            Carbon::parse($this->from)->setTimezone('UTC'),
            Carbon::parse($this->to)->setTimezone('UTC')
        ];
    }
200730
public function bindParameters(Request $request)
    {
        // If the route has a regular expression for the host part of the URI, we will
        // compile that and get the parameter matches for this domain. We will then
        // merge them into this parameters array so that this array is completed.
        $params = $this->matchToKeys(
            array_slice($this->bindPathParameters($request), 1)
        );

        // If the route has a regular expression for the host part of the URI, we will
        // compile that and get the parameter matches for this domain. We will then
        // merge them into this parameters array so that this array is completed.
        if (! is_null($this->compiled->getHostRegex())) {
            $params = $this->bindHostParameters($request, $params);
        }

        return $this->parameters = $this->replaceDefaults($params);
    }
561120
public function matches(Request $request)
    {
        $this->checkCasSessionParam($request);
        // Already logged using CAS or CAS path
        $casMatcher = new RequestMatcher('^/cas');
        $loginCheckMatcher = new RequestMatcher('^/login_check');
        $isCASTicket = $request->query->get('ticket') !== null ?
            preg_match('/^ST/', $request->query->get('ticket')) :
            false;
        if (
            !empty($request->getSession()->get('LOGGED_VIA_CAS')) ||
            ($this->casConfiguration->isActive() &&
                ($casMatcher->matches($request) || ($loginCheckMatcher->matches($request) && $isCASTicket))
            )
        ) {
            return false;
        }

        return true;
    }
1133661
protected function tokensMatch($request)
	{
		$token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');

		if ( ! $token && $header = $request->header('X-XSRF-TOKEN'))
		{
			$token = $this->encrypter->decrypt($header);
		}

		return StringUtils::equals($request->session()->token(), $token);
	}