public function testName() { $withoutName = new Place(); $this->assertSame([], $withoutName->getName()); $withName = new Place(['fr' => 'test name']); $this->assertSame(['fr' => 'test name'], $withName->getName()); }
/** * Render an event as vevent * @param VCalendar $vcalendar * @param Event $event * @param Place $place */ private function renderEvent(VCalendar $vcalendar, Event $event, Place $place = null) { $vevent = $vcalendar->add('VEVENT', [], false); $this->addDate($event, $vevent, 'DTSTART', $event->getStart()); $this->addDate($event, $vevent, 'DTEND', $event->getEnd()); $properties = []; $properties['DTSTAMP'] = ['type' => 'DATE-TIME', 'value' => Utility::getNow()]; $properties['UID'] = ['type' => 'UNKNOWN', 'value' => $event->getUid()]; $properties['DESCRIPTION'] = ['type' => 'UNKNOWN', 'value' => $event->getDescription()]; $properties['SUMMARY'] = ['type' => 'UNKNOWN', 'value' => $event->getName()]; if ($place) { $properties['LOCATION'] = ['type' => 'UNKNOWN', 'value' => $place->getName()]; $properties['GEO'] = ['type' => 'UNKNOWN', 'value' => $place->getLocation()->getLatitude() . ';' . $place->getLocation()->getLongitude()]; } $allProperties = array_merge($properties, $event->getExtra()); foreach ($allProperties as $key => $val) { $prop = $vevent->add($key, $val['value']); if ($val['type'] === 'DATE') { $prop['VALUE'] = $val['type']; } } }