Retrieve a tournament's match list.

@param  string $tournament
@return array
485927
public function getMatches($tournament)
    {
        $response = Guzzle::get("tournaments/{$tournament}/matches");

        $matches = [];
        foreach ($response as $match) {
            $matchModel = new Match($match->match);
            $matchModel->tournament_slug = $tournament;
            $matches[] = $matchModel;
        }

        return $matches;
    }
821266
private function getMatches()
    {

        if (empty($this->urlPart) || !$this->validate($this->urlPart)) {
            return [];
        }

        if (!preg_match($this->_current_pattern, $this->urlPart, $matches)) {
            return [];
        }

        return $matches;
    }
17746
public function search($query)
    {
        $searchProviders = [];

        foreach ($this->searchProviders as $searchProvider) {
            if (!$searchProvider instanceof SearchProviderInterface) {
                continue;
            }

            $role = $searchProvider->getRole();
            if ($role && !$this->authorizationChecker->isGranted($role)) {
                continue;
            }

            $searchProviders[] = $searchProvider;
        }

        $explodedQuery = explode(':', $query);
        if (count($explodedQuery) > 1) {
            $keySearchProviders = [];
            $keyWord = strtolower(array_shift($explodedQuery));

            foreach ($searchProviders as $searchProvider) {
                $searchKey = $searchProvider->getSearchKey();
                if ($searchKey === $keyWord) {
                    $keySearchProviders[] = $searchProvider;
                }
            }

            if (count($keySearchProviders)) {
                $searchProviders = $keySearchProviders;
                $query = trim(implode(':', $explodedQuery));
            }
        }

        $results = [];
        foreach ($searchProviders as $searchProvider) {
            $searchResults = $searchProvider->search($query);
            foreach ($searchResults as $searchResult) {
                $results[] = $searchResult->toArray();
            }
        }

        return $results;
    }
955455
public function listTables($pattern = '/.*/')
    {
        $tables                 = [];
        $lastEvaluatedTableName = null;
        do {
            $args = [
                "Limit" => 30,
            ];
            if ($lastEvaluatedTableName) {
                $args['ExclusiveStartTableName'] = $lastEvaluatedTableName;
            }
            $cmd    = $this->db->getCommand(
                'ListTables',
                $args
            );
            $result = $this->db->execute($cmd);
            if (isset($result['LastEvaluatedTableName'])) {
                $lastEvaluatedTableName = $result['LastEvaluatedTableName'];
            }
            else {
                $lastEvaluatedTableName = null;
            }
            
            foreach ($result['TableNames'] as $tableName) {
                if (preg_match($pattern, $tableName)) {
                    $tables[] = $tableName;
                }
            }
        } while ($lastEvaluatedTableName != null);
        
        return $tables;
    }
325257
public function matchAll($regex)
    {
        $matches = array();
        $result = preg_match_all($regex, $this->toString(), $matches, PREG_SET_ORDER);
        if($this->isValidRegex($regex) && $result!==false && $result>0)
        {
            return ArrayList::asObjectArray($matches);
        }
        return null;
    }
963015
protected function _fetchTableIndexes($table)
    {
        $return = array();
        $query  = $this->getObject('lib:database.query.show')
            ->show('INDEX')
            ->from($table);

        if($indexes = $this->select($query, Database::FETCH_OBJECT_LIST))
        {
            foreach($indexes as $index) {
                $return[$index->Key_name][$index->Seq_in_index] = $index;
            }
        }

        return $return;
    }
909800
public function randomizeParticipants($tournament)
    {
        $response = Guzzle::post("tournaments/{$tournament}/participants/randomize");

        $participants = [];
        foreach ($response as $team) {
            $participant = new Participant($team->participant);
            $participant->tournament_slug = $tournament;
            $participants[] = $participant;
        }

        return $participants;
    }
432760
public function getTableIndexes( $table )
    {
        $query = "SELECT * FROM sqlite_master WHERE type='index' AND tbl_name = '$table'";

        $results = $this->query( $query );

        $indexes = [ ];

        foreach ( $results as $result )
        {
            $indexes[ ] = $result[ 'name' ];
        }

        return $indexes;
    }
919095
public function checkIfTagMatchesRecords($tag)
    {
        // if tag list is empty, fetch them from the result list
        // otherwise use the cached result list
        if (!$this->tagsInSearchResult) {
            $this->tagsInSearchResult = $this->pObj->tagsInSearchResult = $this->db->getTagsFromSearchResult();
            $GLOBALS['TSFE']->fe_user->setKey('ses', 'ke_search.tagsInSearchResults', $this->tagsInSearchResult);
        }

        return array_key_exists($tag, $this->tagsInSearchResult);
    }
1358166
public function getTables($matchPrefix = true)
    {
        if ($matchPrefix) {
            $prefix = str_replace('_', '\\_', $this->getPrefix());
            $sql = "SHOW TABLES LIKE '{$prefix}%'";
        } else {
            $sql = 'SHOW TABLES';
        }

        $tables = $this->getValues($sql);

        return $tables;
    }
212772
public function getRequestMatchers()
    {
        if (is_null($this->enabledRequestMatchers)) {
            return array_values($this->availableRequestMatchers);
        }

        return array_values(array_intersect_key(
            $this->availableRequestMatchers,
            array_flip($this->enabledRequestMatchers)
        ));
    }
262248
private function _getMatchesIdsFromMatches()
    {
        $_matchesIdsFromSlots = $this->_getMatchesIdsFromSlots();
        $db = Db::obtain();
        // basic matches data
        $matchesQuery = 'SELECT * FROM ' . Db::realTablename('matches') . '';
        $where = '';
        $data = array();

        if (null !== $this->getLeagueId()) {
            $where .= 'leagueid = ? AND ';
            array_push($data, $this->getLeagueId());
        }

        if (null !== $this->getTeamId()) {
            $where .= '(radiant_team_id = ? OR dire_team_id = ?) AND ';
            array_push($data, $this->getTeamId());
            array_push($data, $this->getTeamId());
        }

        if (count($_matchesIdsFromSlots)) {
            $where .= 'match_id IN (' . implode(',', $_matchesIdsFromSlots) . ') AND ';
        }

        if (null !== $this->getStartAtMatchId()) {
            $where .= 'match_id > ? AND ';
            array_push($data, $this->getStartAtMatchId());
        }

        if (trim($where) !== '') {
            $matchesQuery .= ' WHERE ' . substr($where, 0, strlen($where) - 4);
        }

        $matchesQuery .= ' ORDER BY start_time DESC';

        if (null !== $this->getMatchesRequested()) {
            $matchesQuery .= ' LIMIT ?';
            array_push($data, $this->getMatchesRequested());
        }

        $matchesInfo = $db->fetchArrayPDO($matchesQuery, $data);
        // no one match found
        if (count($matchesInfo) === 0) {
            return array();
        }
        return $matchesInfo;
    }
841422
public function getAttachmentsTags($list = true)
    {
        $tags = $this->config('tags');

        if (!$list) {
            return $tags;
        }

        $tagsList = [];
        foreach ($tags as $key => $tag) {
            $tagsList[$key] = $tag['caption'];
        }

        return $tagsList;
    }
420921
private function getArgumentsFromMatch($match = array())
    {
        if (is_array($match['params']) && count($match['params'])) {
            $params = $match['params'];
            return is_array($params) ? $params : array($params);
        }

        return array();
    }
1204115
public static function selectMatchList(
        $matchState
    ) {
        $matchState = (object) $matchState;

        $matchList = [];
        foreach ($matchState->match as $matchKey => $matchItem) {
            $matchList[$matchKey] = $matchItem;
        }

        return $matchList;
    }
1006918
public function getRecipients($event)
    {
        $groupIds = $this->Groups()->column('ID');
        if (count($groupIds)) {
            $members = Member::get()->filter('Groups.ID', $groupIds);
            return $members;
        }
        return [];
    }
876623
function get_suggestions($word)
    {
        $matches = $word ? $this->check($word) : $this->matches;

        if ($matches[0][4]) {
            return $matches[0][4];
        }

        return array();
    }