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


PHP Player::getPlayerId方法代码示例

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


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

示例1: update

 public function update(Player $object)
 {
     $q = "UPDATE " . self::TABLE . " SET `name`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "', `teamId`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getTeamId()) . "' WHERE playerId='" . addslashes($object->getPlayerId()) . "'";
     $pk = $object->getPlayerId();
     if ($object->isNew()) {
         if (empty($pk)) {
             $q = "INSERT INTO " . self::TABLE . " (`name`, `teamId`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getTeamId()) . "')";
         } else {
             $q = "INSERT INTO " . self::TABLE . " (`name`, `teamId`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getPlayerId()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getTeamId()) . "')";
         }
     }
     $this->db->updateQuery($q);
     if (empty($pk)) {
         $pk = $this->db->selectQuery("SELECT playerId from " . self::TABLE . " ORDER BY playerId DESC limit 1")->getSingleton();
     }
     $result = $this->findByPrimaryKey($pk);
     parent::$dbCache->resetEntity("Player");
     parent::$dbCache->setSingle("Player", $pk, $result);
     return $result;
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:20,代码来源:PlayerPersistence.php

示例2: __construct

 public function __construct()
 {
     $this->arrErrors = parse_ini_file('INI/Errors.ini', true);
     $this->arrRooms = parse_ini_file('INI/Rooms.ini', true);
     $this->arrServers = parse_ini_file('INI/Servers.ini', true);
     $this->addListener('e', function ($arrPacket) {
         $intError = $arrPacket[3];
         echo 'Received error: ', $intError, '!', chr(10);
     });
     $this->addListener('lp', function ($arrPacket) {
         $arrPlayer = XTParser::ParseVertical($arrPacket[3]);
         $this->objPlayer = new Player($arrPlayer);
     });
     $this->addListener('jr', function ($arrPacket) {
         $intInternal = $arrPacket[2];
         $intRoom = $arrPacket[3];
         $this->intInternalRoom = $intInternal;
         $this->intExternalRoom = $intRoom;
         $this->arrRoom = array();
         array_shift($arrPacket);
         array_shift($arrPacket);
         array_shift($arrPacket);
         foreach ($arrPacket as $strPenguin) {
             $arrPlayer = XTParser::ParseVertical($strPenguin);
             if (!empty($arrPlayer)) {
                 if ($arrPlayer[0] != $this->intPlayerId) {
                     $objPlayer = new Player($arrPlayer);
                     $this->arrRoom[$objPlayer->getPlayerId()] = $objPlayer;
                 }
             }
         }
     });
     $this->addListener('ap', function ($arrPacket) {
         $arrPlayer = XTParser::ParseVertical($arrPacket[3]);
         if ($arrPlayer[0] != $this->intPlayerId) {
             $objPlayer = new Player($arrPlayer);
             $this->arrRoom[$objPlayer->getPlayerId()] = $objPlayer;
         }
     });
     $this->addListener('rp', function ($arrPacket) {
         $intPlayer = $arrPacket[3];
         unset($this->arrRoom[$intPlayer]);
     });
 }
开发者ID:baybay619,项目名称:Penguin,代码行数:44,代码来源:CPClient.php

示例3: foreach

                if ($game === null) {
                    $game = Game::getGameByGameSecondTeamId($pdo, $team->getTeamId());
                }
                //get player statistic by game
                //response from api
                for ($week = 1; $week <= 21; $week++) {
                    $response = file_get_contents("https://api.fantasydata.net/nfl/v2/JSON/PlayerGameStatsByPlayerID/{$season}/{$week}/{$player->PlayerID}", 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 {
                            $statistic = $statistic[0];
                        }
                        if (empty($statisticData->{$statisticName}) === false) {
                            $playerStatisticToInsert = new PlayerStatistic($game->getGameId(), $playerToInsert->getPlayerId(), $team->getTeamId(), $statistic->getStatisticId(), $statisticData->{$statisticName});
                            $playerStatisticToInsert->insert($pdo);
                        }
                    }
                }
            }
        }
    }
} 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,代码行数:31,代码来源:apiDataDownLoaderNfl.php

示例4: savePlayer

 public function savePlayer(Player $player)
 {
     $playerId = $player->getPlayerId();
     $playerName = $player->getPlayerName();
     $birthDate = $player->getBirthDate();
     $position = $player->getPosition();
     $squadNumber = $player->getSquadNumber();
     $clubId = $player->getClub()->getClubId();
     $query = "INSERT INTO players VALUES ({$playerId}, '{$playerName}', '{$birthDate}', '{$position}', {$squadNumber}, {$clubId})";
     $rs = $this->connection->query($query);
     if (!$rs) {
         throw new Exception('Could not save player!');
     }
 }
开发者ID:cvetan,项目名称:restwebservices,代码行数:14,代码来源:DatabaseBroker.php

示例5: history

 private function history()
 {
     $current_player = new Player($this->getPlayerId());
     $current_player->build();
     db_insert('player_history')->fields(array('playerid' => $current_player->getPlayerId(), 'first_name' => $current_player->getFirstName(), 'last_name' => $current_player->getLastName(), 'player_positionid' => $current_player->getPlayerPositionId(), 'secondary_player_positionid' => $current_player->getSecondaryPlayerPositionId(), 'active_yn' => $current_player->getActiveYN(), 'saved_userid' => $current_player->getSavedUserID(), 'saved_datetime' => $current_player->getSavedDateTime(), 'history_userid' => $this->getSavedUserID(), 'history_datetime' => $this->getSavedDateTime()))->execute();
 }
开发者ID:andrewfahl,项目名称:Hockey-Stats,代码行数:6,代码来源:Player.php

示例6: getPlayers

function getPlayers(string $league)
{
    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/Players", false, $context);
        $data = json_decode($response);
        $sport = Sport::getSportBySportLeague($pdo, $league);
        /*todo
        
        		Get Teams
        		Get Game
        		Use the player's team key to get team IDs from your database
        		Use team ID to get games
        		Use game date time + player api ID to get game stats
        
        		*/
        // Adds players to database
        foreach ($data as $player) {
            $team = Team::getTeamByTeamApiId($pdo, $player->TeamID);
            if ($team !== null) {
                $playerToInsert = new Player(null, $player->PlayerID, $team->getTeamId(), $sport->getSportId(), $player->FirstName . " " . $player->LastName);
                $playerToInsert->insert($pdo);
                $game = Game::getGameByGameFirstTeamId($pdo, $team->getTeamId());
                if ($game === null) {
                    $game = Game::getGameByGameSecondTeamId($pdo, $team->getTeamId());
                }
                $gameDate = $game->getGameTime()->format("Y-m-d");
                // Get player statistics by game
                // response from api
                $response = file_get_contents("https://api.fantasydata.net/{$league}/v2/JSON/PlayerGameStatsByPlayer/{$gameDate}/{$player->PlayerID}", false, $context);
                $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];
                    }
                    if (empty($statisticData->{$statisticName}) === false) {
                        $playerStatisticToInsert = new PlayerStatistic($game->getGameId(), $playerToInsert->getPlayerId(), $team->getTeamId(), $statistic->getStatisticId(), $statisticData->{$statisticName});
                        $playerStatisticToInsert->insert($pdo);
                    }
                    //					var_dump($statisticData);
                    //					var_dump($statisticName);
                    //					var_dump($statistic);
                    //					var_dump($statisticValue);
                }
            } else {
                echo "<p>* * * SIX OF THIRTEEN IS NOT A TEAM PLAYER * * *</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,代码行数:65,代码来源:genericDownloader.php

示例7: testGetValidPlayerByPlayerId

 /**
  * test inserting a valid Player and regrabbing it from mySQL
  **/
 public function testGetValidPlayerByPlayerId()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("player");
     // create a new Player and insert to into mySQL
     $player = new Player(null, $this->player->getPlayerId(), $this->VALID_PLAYER);
     $player->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoPlayer = Player::getPlayerByPlayerId($this->getPDO(), $player->getPlayerId());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("player"));
     $this->assertEquals($pdoPlayer->getPlayerId(), $this->game->getPlayerId());
 }
开发者ID:chrispaul3625,项目名称:sprots,代码行数:15,代码来源:MasterTestIgnore.php


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