public static function setUpBeforeClass() { $data = json_decode(file_get_contents(dirname(__DIR__) . '/fixtures/character.json'), true); self::$obj = new Character(); self::$obj->setServiceLocator(new ServiceLocator()); self::$obj->populate($data); }
/** * @inheritdoc */ public function populate($data) { parent::populate($data); $this->data['stats'] = $this->serviceLocator->get('wow.entity.arena.statistic'); if (isset($this->headers)) { $this->data['stats']->setResponseHeaders($this->headers); } $this->data['stats']->populate($data['statistic']); }
/** * @inheritdoc */ public function populate($data) { parent::populate($data); $this->data['lastmod'] = null; $this->data['lastModDate'] = null; if (isset($data['lastModified'])) { $this->data['lastModDate'] = new \DateTime('@' . round($data['lastModified'] / 1000, 0), new \DateTimeZone('UTC')); $this->data['lastmod'] = $data['lastModified']; } foreach ($this->services as $key => $service) { if (isset($data[$key])) { $array = $data[$key]; if ($key === 'pvp') { $array['realm'] = $data['realm']; } $this->data[$key] = $this->serviceLocator->get($service); if (isset($this->headers)) { $this->data[$key]->setResponseHeaders($this->headers); } $this->data[$key]->populate($array); } } }