Check whether the filter matches the specified tour and/or context.

@param   tour        $tour       The tour to check
@param   context     $context    The context to check
@return  boolean
492854
public static function filter_matches(tour $tour, context $context) {
        $values = $tour->get_filter_values(self::get_filter_name());
        if (empty($values) || empty($values[0])) {
            // There are no values configured, meaning all.
            return true;
        }
        if ($context->contextlevel < CONTEXT_COURSECAT) {
            return false;
        }
        return self::check_contexts($context, $values);
    }
44857
public static function filter_matches(tour $tour, context $context) {
        global $PAGE;

        $values = $tour->get_filter_values('theme');

        if (empty($values)) {
            // There are no values configured.
            // No values means all.
            return true;
        }

        // Presence within the array is sufficient. Ignore any value.
        $values = array_flip($values);
        return isset($values[$PAGE->theme->name]);
    }
913908
public function match(
       ServerRequestInterface &$request,
       RouteInterface $route): bool
   {
        if ($this->matchAction($request, $route)
         && $this->matchPath($request, $route)) {
            $request = $request->withAttribute("route", $route);
            return true;
        }
        return false;
   }
407298
public function compareFields($value, $field, $context) {
		if (!isset($context['data'][$field])) {
			return true;
		}
		if ($value === $context['data'][$field]) {
			return true;
		}

		return false;
	}
431183
public function check($value, array $context = [])
    {
        if ($this->checkContainerType($value, $context) === false) {
            return false;
        }

        foreach ($value as $item) {
            if ($this->valueConstraint->check($item, $context) === false) {
                return false;
            }
        }

        return true;
    }
84801
protected function checkContext(Context $context, string $method) : void
    {
        if ($this->context != $context) { // non-strict equality on purpose
            throw MoneyMismatchException::contextMismatch($method);
        }
    }
545055
public static function verify(&$context, $template) {
        $template = SafeString::stripExtendedComments($template);
        $context['level'] = 0;
        Parser::setDelimiter($context);

        while (preg_match($context['tokens']['search'], $template, $matches)) {
            // Skip a token when it is slash escaped
            if ($context['flags']['slash'] && ($matches[Token::POS_LSPACE] === '') && preg_match('/^(.*?)(\\\\+)$/s', $matches[Token::POS_LOTHER], $escmatch)) {
                if (strlen($escmatch[2]) % 4) {
                    static::pushToken($context, substr($matches[Token::POS_LOTHER], 0, -2) . $context['tokens']['startchar']);
                    $matches[Token::POS_BEGINTAG] = substr($matches[Token::POS_BEGINTAG], 1);
                    $template = implode('', array_slice($matches, Token::POS_BEGINTAG));
                    continue;
                } else {
                    $matches[Token::POS_LOTHER] = $escmatch[1] . str_repeat('\\', strlen($escmatch[2]) / 2);
                }
            }
            $context['tokens']['count']++;
            $V = static::token($matches, $context);
            static::pushLeft($context);
            if ($V) {
                if (is_array($V)) {
                    array_push($V, $matches, $context['tokens']['partialind']);
                }
                static::pushToken($context, $V);
            }
            $template = "{$matches[Token::POS_RSPACE]}{$matches[Token::POS_ROTHER]}";
        }
        static::pushToken($context, $template);

        if ($context['level'] > 0) {
            array_pop($context['stack']);
            array_pop($context['stack']);
            $token = array_pop($context['stack']);
            $context['error'][] = 'Unclosed token ' . ($context['rawblock'] ? "{{{{{$token}}}}}" : ( $context['partialblock'] ? "{{#>{$token}}}" : "{{#{$token}}}")) . ' !!';
        }
    }
1081932
function(context) {

            // Check path
            var path = context.request.urlInfo.pathname;

            if (path.indexOf(this.$.path) === 0) {
                // path matches
                if (this.$.route !== null) {
                    return (new RegExp(this.$.route, "i")).test(path);
                }

                return true;
            }

            return false;
        }
545635
public function check($value, array $context = [])
    {
        foreach ($context as $field => $value) {
            if (in_array($field, $this->fields)) {
                return true;
            }
        }

        return false;
    }
1317800
protected function getValueFromContext($rule, $context)
    {
        $segments = explode('.', $rule->field);
        foreach ($segments as $segment) {
            if (!isset($context[$segment])) {
                $context = false;
                break;
            }
            $context = $context[$segment];
        }

        return $context;
    }
79558
public function routeMatched(ApiRoute $route, Request $request): void
	{
		if (($format = $request->getParameter(self::API_DOCU_STARTER_QUERY_KEY_GENERATE)) !== null) {
			$this->generator->generateAll($this->router);

			exit(0);
		}

		if (($format = $request->getParameter(self::API_DOCU_STARTER_QUERY_KEY_TARGET)) !== null) {
			$this->generator->generateTarget($route, $request);

			exit(0);
		}
	}
209259
public function matches(Route $route, Request $request)
	{
		if (is_null($route->getCompiled()->getHostRegex())) return true;

		return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
	}
115372
public static function is_context_expired(\context $context) : bool {
        $parents = $context->get_parent_contexts(true);
        foreach ($parents as $parent) {
            if ($parent instanceof \context_course) {
                // This is a context within a course. Check whether _this context_ is expired as a function of a course.
                return self::is_course_context_expired($context);
            }

            if ($parent instanceof \context_user) {
                // This is a context within a user. Check whether the _user_ has expired.
                return self::are_user_context_dependencies_expired($parent);
            }
        }

        return false;
    }
1160979
protected function before($instance, $route, $request, $method)
	{
		foreach ($instance->getBeforeFilters() as $filter)
		{
			if ($this->filterApplies($filter, $request, $method))
			{
				// Here we will just check if the filter applies. If it does we will call the filter
				// and return the responses if it isn't null. If it is null, we will keep hitting
				// them until we get a response or are finished iterating through this filters.
				$response = $this->callFilter($filter, $route, $request);

				if ( ! is_null($response)) return $response;
			}
		}
	}
211474
private function isMute(Context $context) {
	    // <fig:...> tag?
		if($context->view->isFigPrefix($this->name)) {
			return true;
		}

        return ($this->figMute) ? $this->evaluate($context, $this->figMute) : false;
	}
800347
public function getCachedMatchResults(RouteContext $routeContext)
    {
        $cachedResult = $this->routeCache->get($routeContext->getCacheEntryIdentifier());
        if ($cachedResult !== false) {
            $this->logger->debug(sprintf('Router route(): A cached Route with the cache identifier "%s" matched the request "%s (%s)".', $routeContext->getCacheEntryIdentifier(), $routeContext->getHttpRequest()->getUri(), $routeContext->getHttpRequest()->getMethod()));
        }

        return $cachedResult;
    }
339982
public function hasContext($context)
    {
        if ($this->contextConfiguration && array_key_exists($context, $this->contextConfiguration)) {
            return true;
        }

        return false;
    }