Is setting related to query text - used when searching

@param string $query
@return bool true on related, false on not or failure
518302
public function is_related($query) {
        if (!$this->load_choices() or empty($this->choices)) {
            return false;
        }
        if (parent::is_related($query)) {
            return true;
        }

        foreach ($this->choices as $desc) {
            if (strpos(core_text::strtolower($desc), $query) !== false) {
                return true;
            }
        }
        return false;
    }
863057
public function countByQuery($query)
    {
        $queryCount = clone $query;
        $queryCount->setCols('count(*) as count');
        $result = $this->getDB()->execute($queryCount);

        if ($result->numRows()) {
            $row = $result->fetchResult();

            return (int)$row['count'];
        }

        return false;
    }
720906
public function is_related($query) {
        if (parent::is_related($query)) {
            return true;
        }

        $repositories= core_component::get_plugin_list('repository');
        foreach ($repositories as $p => $dir) {
            if (strpos($p, $query) !== false) {
                return true;
            }
        }
        foreach (repository::get_types() as $instance) {
            $title = $instance->get_typename();
            if (strpos(core_text::strtolower($title), $query) !== false) {
                return true;
            }
        }
        return false;
    }
1374911
public function setQuery($query)
    {
        if (!($query instanceof QueryString)) {
            $this->query = new QueryString($query);

            return $this;
        }

        $this->query = $query;

        return $this;
    }
927530
private static function isValidUriQuery(?string $query): bool
    {
        if ($query === null || $query === '') {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.4
        // query = *( pchar / "/" / "?" )
        // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:[%s%s\/?:@]|(?:%s))*\z/i',
            'a-z0-9\-._~',
            '!$&\'()*+,;=',
            '%[a-f0-9]{2}'
        );

        return !!preg_match($pattern, $query);
    }
407070
public static function isIndexedArray(array $query)
    {
        if (empty($query) || !isset($query[0])) {
            return false;
        }

        return array_keys($query) === range(0, count($query) - 1);
    }
156751
protected function wantsTemporary($query)
    {
        foreach ($query->getWhere() as $whereClause) {
            $from = array_values($query->getFrom());
            // SQLQuery will automatically add double quotes and single quotes to values, so check against that.
            $key = key($whereClause);
            if ($key == "{$from[0]}.\"MultiFormIsTemporary\" = ?" && current($whereClause[$key]) == 1) {
                return true;
            }
        }

        return false;
    }
1317698
public function setQuery($query)
    {
        $raw = SqlFormatter::removeComments($query);
        if ($this->noSplit) {
            $queries = array($raw);
        } else {
            $queries = SqlFormatter::splitQuery($raw);
        }

        foreach ($queries as $index => $q) {
            $this->addOrReplace($index, $q);
        }

        $this->removeFromIndex(count($queries));
    }
982553
public function queryFilter($query)
    {
        global $pagenow;

        if (!is_admin() || !$pagenow || $pagenow !== 'edit-comments.php' || !isset($_GET['post_type']) || !$_GET['post_type']) {
            return;
        }

        $query->set('post_type', $_GET['post_type']);
    }
192392
public function current($query = false)
	{
		return ($query ? $this->getUri() : rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'));
	}
691539
public function match($query)
    {
        foreach ($this->queryMatchers as $queryMatcher) {
            if ($queryMatcher->supports($query)) {
                return $queryMatcher->match($query);
            }
        }

        throw new NotSupportedException('The given $query is not supported by any registered matchers.');
    }
1108966
public static function Query(string $query)
        {
            if (!$query) {
                return false;
            }

            self::$queriesCnt++;
            $res = pg_query(self::GetConnection(), $query);

            if (!$res) {
                $backtrace = debug_backtrace();

                Log::Write('db',
                           "Error occurred while performing PostgreSQL query." .
                           "\n\tError: " . pg_last_error(self::GetConnection()) .
                           "\n\tCalled in {$backtrace[1]['file']} at line {$backtrace[1]['line']}",
                           'PostgreSQL',
                           Log::LEVEL_CRITICAL);
            }

            return $res;
        }
1323151
private function _query($query)
    {
        if ($this->encrypted) {
            return OneLogin_Saml2_Utils::query($this->decryptedDocument, $query);
        } else {
            return OneLogin_Saml2_Utils::query($this->document, $query);
        }
    }
66606
public function search($query) {
        global $CFG;
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;
        require_once($CFG->dirroot . '/question/engine/lib.php');
        foreach (core_component::get_plugin_list('qbehaviour') as $behaviour => $notused) {
            if (strpos(core_text::strtolower(question_engine::get_behaviour_name($behaviour)),
                    $query) !== false) {
                $found = true;
                break;
            }
        }
        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
1347798
public function scopeKeywords($query, $keyword)
    {
        return $query->where(function ($query) use ($keyword) {
            $query->where('name', 'LIKE', "%$keyword%")
            ->orWhere('description', 'LIKE', "%$keyword%");
        });
    }
811520
public function setQuery($query)
	{
		if (is_array($query))
		{
			$this->vars = $query;
		}
		else
		{
			if (strpos($query, '&amp;') !== false)
			{
				$query = str_replace('&amp;', '&', $query);
			}

			parse_str($query, $this->vars);
		}

		$this->query = null;

		return $this;
	}
1184977
public function setCommand($query)
    {
        if ($query) {
            $query = preg_replace("/[^\w]/", ' ', strtoupper($query));
            $query = strtok($query, ' ');
            $this->command = preg_replace('/[^A-Z]/', '', $query);
        }
    }