/** * @param string $month * @param string $year * @param array $data * @return Talk */ public static function createFromArray($year, $month, array $data) { $talk = new Talk(); $talk->setAbstract(isset($data['abstract']) ? $data['abstract'] : ''); $talk->setAvatar(isset($data['avatar']) ? $data['avatar'] : ''); $talk->setDate(isset($data['twitter']) ? new \DateTime($data['date'], new \DateTimeZone('Europe/London')) : null); $talk->setFeedbackUrl(isset($data['feedbackUrl']) ? $data['feedbackUrl'] : ''); $talk->setMonth($month); $talk->setPdf("/pdfs/{$year}_{$month}.pdf"); $talk->setResources(isset($data['resources']) ? $data['resources'] : []); $talk->setSpeaker(isset($data['speaker']) ? $data['speaker'] : ''); $talk->setTitle(isset($data['title']) ? $data['title'] : ''); $talk->setVideo(isset($data['video']) ? $data['video'] : ''); $talk->setTwitter(isset($data['twitter']) ? $data['twitter'] : ''); $talk->setYear($year); if (isset($data['cues'])) { $talk->setCues(array_map(function ($cue) { list($mins, $secs) = explode(':', $cue); return $mins * 60 + $secs; }, $data['cues'])); } return $talk; }