/** * @param string $type * @param string $name * @param string $imageUrl * * @return \LolEspCal\Calendar */ function create($type = 'all', $name = null, $imageUrl = null) { $iCalendar = new iCalendar('www.lolesports.com|' . $this->calendarName($this->getFullName($type, $name))); $iCalendar->setName($this->getReadableName($type, $name)); $calendar = new Calendar(); $calendar->setICalendar($iCalendar)->setType($type)->setName($name)->setFilename(str_replace(' ', '-', $this->calendarFilename($this->getFullName($type, $name))))->setImageUrl($imageUrl); return $calendar; }
/** * @param \LolEspCal\Calendar $calendar */ public function export(Calendar $calendar) { file_put_contents($calendar->getFilename(), (string) $calendar->getICalendar()); }
/** * @param \LolEspCal\Calendar $calendar */ public function export(Calendar $calendar) { if ($calendar->getName()) { $this->calendars[$calendar->getType()][] = ['url' => $this->getUrl($calendar->getFilename()), 'name' => str_replace('-', ' ', $calendar->getName()), 'image' => $calendar->getImageUrl()]; } }