Skip to content

Commit 9037de4

Browse files
fixup! feat: Calendar Import
Signed-off-by: SebastianKrupinski <[email protected]>
1 parent 43032bd commit 9037de4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

apps/dav/lib/CalDAV/Import/ImportService.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
*/
2424
class ImportService {
2525

26-
public const FORMATS = ['ical', 'jcal', 'xcal'];
27-
2826
private $source;
2927

3028
public function __construct(
@@ -68,7 +66,7 @@ public function import($source, CalendarImpl $calendar, CalendarImportOptions $o
6866
*
6967
* @return Generator<\Sabre\VObject\Component\VCalendar>
7068
*/
71-
private function importText(CalendarImportOptions $options): Generator {
69+
private function importText(): Generator {
7270
$importer = new TextImporter($this->source);
7371
$structure = $importer->structure();
7472
$sObjectPrefix = $importer::OBJECT_PREFIX;
@@ -117,7 +115,7 @@ private function importText(CalendarImportOptions $options): Generator {
117115
*
118116
* @return Generator<\Sabre\VObject\Component\VCalendar>
119117
*/
120-
private function importXml(CalendarImportOptions $options): Generator {
118+
private function importXml(): Generator {
121119
$importer = new XmlImporter($this->source);
122120
$structure = $importer->structure();
123121
$sObjectPrefix = $importer::OBJECT_PREFIX;
@@ -159,7 +157,7 @@ private function importXml(CalendarImportOptions $options): Generator {
159157
*
160158
* @return Generator<\Sabre\VObject\Component\VCalendar>
161159
*/
162-
private function importJson(CalendarImportOptions $options): Generator {
160+
private function importJson(): Generator {
163161
/** @var VCALENDAR $importer */
164162
$importer = Reader::readJson($this->source);
165163
// calendar time zones

apps/dav/lib/Command/ImportCalendar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8080
}
8181
$calendar = $calendars[0];
8282
if (!$calendar instanceof CalendarImpl) {
83-
throw new InvalidArgumentException("Calendar <$calendarId> dose support this function");
83+
throw new InvalidArgumentException("Calendar <$calendarId> doesn't support this function");
8484
}
8585
if (!$calendar->isWritable()) {
8686
throw new InvalidArgumentException("Calendar <$calendarId> is not writeable");

lib/public/Calendar/CalendarImportOptions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
final class CalendarImportOptions {
1919

20+
public const FORMATS = ['ical', 'jcal', 'xcal'];
21+
2022
public const VALIDATE_NONE = 0;
2123
public const VALIDATE_SKIP = 1;
2224
public const VALIDATE_FAIL = 2;
@@ -50,10 +52,10 @@ public function getFormat(): string {
5052
/**
5153
* Sets the import format
5254
*
53-
* @param 'ical'|'jcal'|'xcal' $format
55+
* @param 'ical'|'jcal'|'xcal' $value
5456
*/
5557
public function setFormat(string $value): void {
56-
if (!in_array($value, ImportService::FORMATS, true)) {
58+
if (!in_array($value, self::FORMATS, true)) {
5759
throw new InvalidArgumentException("Format <$value> is not valid.");
5860
}
5961
$this->format = $value;

0 commit comments

Comments
 (0)