/** * Returns an array of Survival statistics for this user like revived * teammates * * If the Survival statistics haven't been parsed already, parsing is done * now. * * @return array The stats for the Survival mode */ public function getSurvivalStats() { if (!$this->isPublic()) { return null; } if (empty($this->survivalStats)) { parent::getSurvivalStats(); $this->survivalStats['maps'] = []; foreach ($this->xmlData->stats->survival->maps->children() as $mapData) { $this->survivalStats['maps'][$mapData->getName()] = new L4DMap($mapData); } } return $this->survivalStats; }
/** * Returns an array of Survival statistics for this user like revived * teammates. * If the Survival statistics haven't been parsed already, parsing is done * now. * * The XML layout for the Survival statistics for Left4Dead 2 differs a bit * from Left4Dead's Survival statistics. So we have to use a different way * of parsing for the maps and we use a different map class (L4D2Map) which * holds the additional information provided in Left4Dead 2's statistics. */ public function getSurvivalStats() { if (!$this->isPublic()) { return; } if (empty($this->survivalStats)) { parent::getSurvivalStats(); $this->survivalStats['maps'] = array(); foreach ($this->xmlData->stats->survival->maps->children() as $mapData) { $map = new L4D2Map($mapData); $this->survivalStats['maps'][$map->getId()] = $map; } } return $this->survivalStats; }