示例#1
0
文件: Player.php 项目: snowiow/cocurl
 /**
  * Creates a player object with the given data
  * @param array $data an associative array to fill up the members of the
  * player class
  * @return Player a player object with the data given as it's members
  */
 public static function create(array $data) : Player
 {
     $player = new Player();
     parent::fill($data, $player);
     if (is_array($player->clan)) {
         $player->clan = Clan::create($player->clan);
     }
     if (is_array($player->league)) {
         $player->league = League::create($player->league);
     }
     return $player;
 }
示例#2
0
文件: Clan.php 项目: snowiow/cocurl
 /**
  * Creates a clan object with the given data
  * @param array $data an associative array to fill up the members of the
  * clan class
  * @return Clan a clan object with the data given as it's members
  */
 public static function create(array $data) : Clan
 {
     $clan = new Clan();
     parent::fill($data, $clan);
     if (is_array($clan->location)) {
         $clan->location = Location::create($clan->location);
     }
     if (is_array($clan->memberList)) {
         $members = [];
         foreach ($clan->memberList as $member) {
             $members[] = Player::create($member);
         }
         $clan->memberList = $members;
     }
     return $clan;
 }
示例#3
0
文件: League.php 项目: snowiow/cocurl
 /**
  * Creates a league object with the given data
  * @param array $data an associative array to fill up the members of the
  * league class
  * @return League a league object with the data given as it's members
  */
 public static function create(array $data) : League
 {
     $league = new League();
     parent::fill($data, $league);
     return $league;
 }
示例#4
0
 /**
  * Creates a location object with the given data
  * @param array $data an associative array to fill up the members of the
  * location class
  * @return Location a location object with the data given as it's members
  */
 public static function create(array $data) : Location
 {
     $location = new Location();
     parent::fill($data, $location);
     return $location;
 }