当前位置: 首页>>代码示例>>PHP>>正文


PHP Team::getTeamId方法代码示例

本文整理汇总了PHP中Team::getTeamId方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::getTeamId方法的具体用法?PHP Team::getTeamId怎么用?PHP Team::getTeamId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Team的用法示例。


在下文中一共展示了Team::getTeamId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

     foreach ($_GET as $t_teamId => $PA) {
         if (preg_match('/^t_[a-z]\\w{0,20}$/i', $t_teamId)) {
             $PA = intval($PA);
             // is the targeted team in the game?
             if (!$targetTeam->get($gameId, substr($t_teamId, 2))) {
                 punishAndDie($team, $game);
             }
             // is the total PA used coherent?
             if ($PA > 0) {
                 $totalPA = $totalPA + $PA;
             }
             if ($totalPA > $team->getPA()) {
                 punishAndDie($team, $game);
             }
             // register action
             $team->addAction($gameId, $round, $targetTeam->getTeamId(), $PA);
         }
     }
     http_response_code(200);
     break;
     // ------------------------------
     // worldState
     // ------------------------------
 // ------------------------------
 // worldState
 // ------------------------------
 case 'worldState':
     header('Content-Type: application/json');
     // check inputs
     if (!isset($_GET['gameId']) or !isset($_GET['round']) or !isset($_GET['teamId']) or !isset($_GET['teamToken'])) {
         rollbackAndDie();
开发者ID:jcaillon,项目名称:battle-code,代码行数:31,代码来源:BackEndController.php

示例2: getTeams

/**
 * @param string $league
 * @param int $teamSportId
 */
function getTeams(string $league, int $teamSportId)
{
    try {
        // grab the db connection
        $pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/sprots.ini");
        $config = readConfig("/etc/apache2/capstone-mysql/sprots.ini");
        $apiKeys = json_decode($config["fantasyData"]);
        $opts = array('http' => array('method' => "GET", 'header' => "Content-Type: application/json\r\nOcp-Apim-Subscription-key: " . $apiKeys->{$league}, 'content' => "{body}"));
        $context = stream_context_create($opts);
        // response from api
        $response = file_get_contents("https://api.fantasydata.net/{$league}/v2/JSON/teams", false, $context);
        $data = json_decode($response);
        // Places team in designated sport, and populates teams in team db with response from api
        $sport = Sport::getSportBySportLeague($pdo, $league);
        foreach ($data as $team) {
            $team = new Team(null, $sport->getSportId(), $team->TeamID, $team->City, $team->Name);
            $team->insert($pdo);
            // get team statistics by game
            $game = Game::getGameByGameFirstTeamId($pdo, $team->getTeamId());
            if ($game === null) {
                $game = Game::getGameByGameSecondTeamId($pdo, $team->getTeamId());
                if ($game === null) {
                    continue;
                }
            }
            $gameDate = $game->getGameTime()->format("Y-m-d");
            // response from api
            $response = file_get_contents("https://api.fantasydata.net/{$league}/v2/JSON/TeamGameStatsByDate/{$gameDate}");
            $statisticData = json_decode($response);
            // adds statistics to database
            foreach ($GLOBALS['stats'] as $statisticName) {
                $statistic = Statistic::getStatisticByStatisticName($pdo, $statisticName);
                if ($statistic === null || $statistic->getSize() <= 0) {
                    $statistic = new Statistic(null, $statisticName);
                    $statistic->insert($pdo);
                } else {
                    $statistic = $statistic[0];
                }
                $statisticValue = null;
                if (empty($statisticData->{$statisticName}) === false) {
                    $statisticValue = $statisticData->{$statisticName};
                }
                if ($statisticValue !== null) {
                    //					$statisticValue = "";
                    $teamStatisticToInsert = new TeamStatistic($game->getGameId(), $team->getTeamId(), $statistic->getTeamStatisticStatisticId(), $statisticValue);
                    $teamStatisticToInsert->insert($pdo);
                } else {
                    echo "<p> team statistics isn't working </p>" . PHP_EOL;
                }
            }
        }
    } catch (Exception $exception) {
        echo "Something went wrong: " . $exception->getMessage() . PHP_EOL;
    } catch (TypeError $typeError) {
        echo "Something went wrong: " . $typeError->getMessage() . PHP_EOL;
    }
}
开发者ID:chrispaul3625,项目名称:sprots,代码行数:61,代码来源:genericDownloader.php

示例3: foreach

 foreach ($seasoning as $season) {
     $pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/sprots.ini");
     $config = readConfig("/etc/apache2/capstone-mysql/sprots.ini");
     $apiKeys = json_decode($config["fantasyData"]);
     $opts = array('http' => array('method' => "GET", 'header' => "Content-Type: application/json\r\nOcp-Apim-Subscription-key: " . $apiKeys->NFL, 'content' => "{body}"));
     $context = stream_context_create($opts);
     $response = file_get_contents("https://api.fantasydata.net/nfl/v2/JSON/Teams/{$season}", false, $context);
     $data = json_decode($response);
     $stats = ["TeamID", "PlayerID", "City", "Name", "Conference", "Division", "FullName", "StadiumID", "ByeWeek", "AverageDraftPosition", "AverageDraftPositionPPR", "HeadCoach", "OffensiveCoordinator", "DefensiveCoordinator", "SpecialTeamsCoach", "OffensiveScheme", "DefensiveScheme", "UpcomingOpponent", "UpcomingOpponentRank ", "UpcomingOpponentPositionRank"];
     $sport = Sport::getSportBySportLeague($pdo, "NFL");
     foreach ($data as $teamData) {
         $team = Team::getTeamByTeamApiId($pdo, $teamData->Key);
         if ($team === null) {
             $team = new Team(null, $sport->getSportId(), $teamData->Key, $teamData->City, $teamData->Name);
             $team->insert($pdo);
             $game = Game::getGameByGameFirstTeamId($pdo, $team->getTeamId());
             if ($game === null) {
                 $game = Game::getGameByGameSecondTeamId($pdo, $team->getTeamId());
             }
             // response from api
             //get team statistics by game
             for ($week = 1; $week <= 21; $week++) {
                 $response = file_get_contents("https://api.fantasydata.net/nfl/v2/JSON/GameStatsByWeek/{$season}/{$week}", false, $context);
                 $statisticData = json_decode($response);
                 //adds statistic to database
                 foreach ($stats as $statisticName) {
                     $statistic = Statistic::getStatisticByStatisticName($pdo, $statisticName);
                     if ($statistic === null || $statistic->getSize() <= 0) {
                         $statistic = new Statistic(null, $statisticName);
                         $statistic->insert($pdo);
                     } else {
开发者ID:chrispaul3625,项目名称:sprots,代码行数:31,代码来源:apiDataDownLoaderNfl.php

示例4: history

 private function history()
 {
     $current_team = new Team($this->getTeamId());
     $current_team->build();
     db_insert('team_history')->fields(array('teamid' => $current_team->getTeamId(), 'name' => $current_team->getName(), 'active_yn' => $current_team->getActiveYN(), 'saved_userid' => $current_team->getSavedUserID(), 'saved_datetime' => $current_team->getSavedDateTime(), 'history_userid' => $this->getSavedUserID(), 'history_datetime' => $this->getSavedDateTime()))->execute();
 }
开发者ID:andrewfahl,项目名称:Hockey-Stats,代码行数:6,代码来源:Team.php


注:本文中的Team::getTeamId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。