Get game mode information by ID

@param integer $gameModeId
@param array $fields
@return \StdClass
@throws \Exception
519816
public function getGameMode($gameModeId, $fields = ['name', 'slug', 'url'])
    {
        $apiUrl = $this->getEndpoint('game_modes');
        $apiUrl .= $gameModeId;

        $params = array(
            'fields' => implode(',', $fields)
        );

        $apiData = $this->apiGet($apiUrl, $params);

        return $this->decodeSingle($apiData);
    }
1342179
public function get($scriptTagId, array $fields = array())
    {
        $params = array();
        if (!empty($fields)) {
            $params['fields'] = implode(',', $fields);
        }
        $data = $this->request('/admin/script_tags/'.$scriptTagId.'.json', 'GET', $params);
        return $this->createObject(ScriptTag::class, $data['script_tag']);
    }
1285482
public function get($id, array $additionalFields = array())
    {
        return $this->getSingle(
            'region/get',
            'Region',
            array('id' => (int)$id, 'fields' => self::getArray($additionalFields))
        );
    }
352294
protected function getReplayDirPath($region, $gameId)
    {
        $stringGameId = (string) $gameId;

        return sprintf(
            '%s/%s/%s/%s/%s/%s',
            $this->replaysDirPath,
            $region,
            $stringGameId[0] . $stringGameId[1],
            $stringGameId[2],
            $stringGameId[3],
            $gameId
        );
    }
1127510
public static function read($sql, $mode = Driver::INDEX)
    {
        return self::$driver->read($sql, $mode);
    }
884747
protected function translateFieldCode(FieldsDefinition $fields, $fieldId)
    {
        $field = $fields->getField($fieldId);
        if ($field instanceof FieldInterface) {
            return  '{f' . $field->getOrder() . '}';
        }

        return $fieldId;
    }
318796
public function getLastChunkInfo($region, $gameId, $currentChunkId, &$keyframeId = null)
    {
        $metas = $this->getMetas($region, $gameId);

        // Game loading information
        //$firstChunkId = $replayManager->findFirstChunkId($metas);
        $firstChunkId = $metas['firstChunkId'];

        // A bug appears when endStartupChunkId = 3 and startGameChunkId = 5, the game won't load
        if ($metas['endStartupChunkId'] + 2 == $firstChunkId) {
            $firstChunkId = $metas['startGameChunkId'] + 2;
        }

        $keyframeId = $this->findKeyframeByChunkId($metas, $firstChunkId);

        $lastChunkInfo = array(
            'chunkId'            => $firstChunkId,
            'availableSince'     => 30000,
            'nextAvailableChunk' => 30000,
            'keyFrameId'         => $keyframeId,
            'nextChunkId'        => $firstChunkId,
            'endStartupChunkId'  => $metas['endStartupChunkId'],
            'startGameChunkId'   => $metas['startGameChunkId'],
            'endGameChunkId'     => 0,
            'duration'           => 30000
        );

        // In game information
        if ($firstChunkId != $metas['startGameChunkId'] && $currentChunkId - 1 == $metas['startGameChunkId']) {
            $currentChunkId = $firstChunkId;
        }

        if ($currentChunkId > $metas['startGameChunkId']) {
            if ($currentChunkId > $metas['lastChunkId']) {
                $currentChunkId = $metas['lastChunkId'];
            } elseif ($currentChunkId < $metas['firstChunkId']) {
                $currentChunkId = $metas['firstChunkId'];
            }

            $keyframeId = $this->findKeyframeByChunkId($metas, $currentChunkId);

            $lastChunkInfo['chunkId']            = $currentChunkId;
            $lastChunkInfo['nextChunkId']        = $metas['lastChunkId'];
            $lastChunkInfo['keyFrameId']         = $keyframeId;
            $lastChunkInfo['nextAvailableChunk'] = $currentChunkId == $firstChunkId + 6 ? 30000 : 100; // wait for full loading
        }

        // End game, stop downloading
        if ($currentChunkId == $metas['lastChunkId']) {
            $lastChunkInfo['nextAvailableChunk'] = 90000;
            $lastChunkInfo['endGameChunkId']     = $metas['endGameChunkId'];
        }

        return $lastChunkInfo;
    }
694572
public function loadFieldDefinition($fieldDefinitionId)
    {
        $response = $this->client->request(
            'GET',
            $fieldDefinitionId,
            new Message(
                array('Accept' => $this->outputVisitor->getMediaType('FieldDefinition'))
            )
        );

        return $this->inputDispatcher->parse($response);
    }
1129189
public function get($blogId, array $fields = array())
    {
        $params = array();
        if (!empty($fields)) {
            $params['fields'] = implode(',', $fields);
        }
        $endpoint = '/admin/blogs/'.$blogId.'.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createObject(Blog::class, $response['blog']);
    }
79636
protected function doDownload($region, $gameId, $encryptionKey, OutputInterface $output = null)
    {
        $hasOutput = null != $output;
        $replay = $this->createReplay($region, $gameId, $encryptionKey);

        // Download metas
        $this->downloadMetas($replay, $output);

        // Validate game criterias based on metas
        $this->isValid($replay, $output);

        // Retrieve last infos to download previous files
        if ($hasOutput) {
            $output->write("Retrieve last infos...\t\t\t");
        }

        $lastChunkInfo = $this->getLastChunkInfos($replay);
        $replay->setLastChunkId($lastChunkInfo['chunkId']);
        $replay->setLastKeyframeId($lastChunkInfo['keyFrameId']);

        if ($hasOutput) {
            $output->writeln('<info>OK</info>');
        }

        // Download previous chunks
        if ($hasOutput) {
            $output->write("Download all previous chunks (" . $replay->getLastChunkId() . ")...\t");
        }

        $this->downloadChunks($replay);

        if ($hasOutput) {
            $output->writeln('<info>OK</info>');
        }

        // Download previous keyframes
        if ($hasOutput) {
            $output->write("Download all previous keyframes (" . $replay->getLastKeyframeId() . ")...\t");
        }

        $this->downloadKeyframes($replay);

        if ($hasOutput) {
            $output->writeln(array('<info>OK</info>', ''));
        }

        // Download current chunks & keyframes
        if ($hasOutput) {
            $output->writeln("Download current game data :");
        }

        $this->downloadCurrentData($replay, $output);

        if ($hasOutput) {
            $output->writeln('');
        }

        // Update metas
        if ($hasOutput) {
            $output->write("Update metas...\t\t\t\t");
        }

        $this->updateMetas($replay);

        if ($hasOutput) {
            $output->writeln('<info>OK</info>');
        }

        return $replay;
    }
1246715
public function fetch($mode = \PDO::FETCH_CLASS)
    {
        $run = null;
        try {
            $run = $this->sth->fetch($mode);
        } catch (\PDOException $e) {
            $this->errorInfo('', $e->getMessage());
            throw $e;
        }
        yield $run;
    }
372623
public function getPrizeCategoryGames($categoryid)
    {
        $em = $this->serviceLocator->get('doctrine.entitymanager.orm_default');

        $query = $em->createQuery('SELECT g FROM PlaygroundGame\Entity\Game g
            WHERE (g.prizeCategory = :categoryid AND g.broadcastPlatform = 1)
            ORDER BY g.publicationDate DESC');
        $query->setParameter('categoryid', $categoryid);
        $games = $query->getResult();

        return $games;
    }
1099128
public function getEndStats($region, $gameId)
    {
        $filePath = $this->getReplayDirPath($region, $gameId) . '/endstats';

        if (!is_file($filePath)) {
            throw new ReplayEndStatsNotFoundException('The endstats for game #' . $gameId . ' is not found');
        }

        return $filePath;
    }
168751
public function recentGame($gameId)
	{
		if ( ! isset($this->info['recentGames']))
		{
			// no rune pages
			return null;
		}
		$recentGames = $this->info['recentGames'];

		return $recentGames->game($gameId);
	}
953530
function getMatch($matchId)
	{
		$match = $this->db->execute(
				'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 '.
				'FROM Matches '.
				'WHERE id = %d ',
				$matchId
			)->fetchObject(__NAMESPACE__.'\\Match');
		if(!$match)
			return false;

		$results = $this->db->execute(
				'SELECT P.login, P.teamId, P.rank, P.state '.
				'FROM Players P '.
				'WHERE P.matchId = %d ', $match->id
			)->fetchArrayOfAssoc();

		foreach($results as $row)
		{
			$match->players[] = $row['login'];
			$match->playersState[$row['login']] = $row['state'];

			if($row['rank'] !== null)
			{
					$match->ranking[$row['rank']][] = $row['login'];
			}

			if($row['teamId'] === null)
			{
				continue;
			}
			elseif((int)$row['teamId'] === 0)
			{
				$match->team1[] = $row['login'];
			}
			elseif((int)$row['teamId'] === 1)
			{
				$match->team2[] = $row['login'];
			}
		}
		uksort($match->ranking, function ($k1, $k2)
		{
			if($k1 == 0)
			{
				return 1;
			}
			if($k1 > $k2)
			{
				return 1;
			}
			else
			{
				return $k1 == $k2 ? 0: -1;
			}
		});
		return $match;
	}
29403
public function rankingMedalsAction($id)
    {
        $rankingMedals = $this
            ->getDoctrine()
            ->getRepository('VideoGamesRecordsCoreBundle:PlayerSerie')
            ->getRankingMedals($id, $this->getPlayer(), 100);

        $breadcrumbs = $this->get('white_october_breadcrumbs');
        $breadcrumbs->addRouteItem('Home', 'homepage');
        $breadcrumbs->addItem('serie.medalranking.full');

        return $this->render('VideoGamesRecordsCoreBundle:Ranking:player-medals.html.twig', ['rankingMedals' => $rankingMedals]);
    }
191544
public function getFranchise($franchiseId, $fields = ['*'])
    {
        $apiUrl = $this->getEndpoint('franchises');
        $apiUrl .= $franchiseId;

        $params = array(
            'fields' => implode(',', $fields)
        );

        $apiData = $this->apiGet($apiUrl, $params);

        return $this->decodeSingle($apiData);
    }