Skip to content

Commit 78b910f

Browse files
committed
Fixed failing CI
Signed-off-by: Mua N. Laurent <[email protected]>
1 parent 12ca3ee commit 78b910f

File tree

2 files changed

+101
-100
lines changed

2 files changed

+101
-100
lines changed

src/DataTypes/Calendar.php

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class Calendar implements DataTypeInterface
1414
*
1515
* @var string
1616
*/
17-
protected $prefix = "BEGIN:VEVENT";
17+
protected $prefix = 'BEGIN:VEVENT';
1818

1919
/**
2020
* The suffix of the QrCode.
2121
*
2222
* @var string
2323
*/
24-
protected $suffix = "END:VEVENT";
24+
protected $suffix = 'END:VEVENT';
2525

2626
/**
2727
* The separator between the variables.
@@ -53,23 +53,23 @@ class Calendar implements DataTypeInterface
5353

5454
/**
5555
* The start time of the event.
56-
* e.g 2020-05-23 15:00
56+
* e.g 2020-05-23 15:00.
5757
*
5858
* @var string
5959
*/
6060
protected $startDateTime;
6161

6262
/**
6363
* The end time of the event.
64-
* e.g 2020-05-24 15:00
64+
* e.g 2020-05-24 15:00.
6565
*
6666
* @var string
6767
*/
6868
protected $endDateTime;
6969

7070
/**
7171
* Start/End date timezone.
72-
* e.g 'Africa/Douala'
72+
* e.g 'Africa/Douala'.
7373
*
7474
* @var string
7575
*/
@@ -81,7 +81,7 @@ class Calendar implements DataTypeInterface
8181
*
8282
* @var string
8383
*/
84-
protected $dateTimeFormat = "Y-m-d H:i";
84+
protected $dateTimeFormat = 'Y-m-d H:i';
8585

8686
/**
8787
* Event full descriptions/notes.
@@ -98,7 +98,7 @@ class Calendar implements DataTypeInterface
9898
protected $categories;
9999

100100
/**
101-
* Alarm/Reminder. Trigger's before/after event
101+
* Alarm/Reminder. Trigger's before/after event.
102102
*
103103
* @var array
104104
*/
@@ -134,33 +134,33 @@ protected function buildCalendarString()
134134
$calendar = $this->prefix.$this->separator;
135135

136136
if (isset($this->summary)) {
137-
$calendar .= "SUMMARY:".$this->summary.$this->separator;
137+
$calendar .= 'SUMMARY:'.$this->summary.$this->separator;
138138
}
139139
if (isset($this->startDateTime)) {
140-
$calendar .= "DTSTART";
140+
$calendar .= 'DTSTART';
141141
if (isset($this->timezone)) {
142142
$calendar .= $this->timezone;
143143
}
144-
$calendar .= ":".$this->startDateTime.$this->separator;
144+
$calendar .= ':'.$this->startDateTime.$this->separator;
145145
}
146146
if (isset($this->endDateTime)) {
147-
$calendar .= "DTEND";
147+
$calendar .= 'DTEND';
148148
if (isset($this->timezone)) {
149149
$calendar .= $this->timezone;
150150
}
151-
$calendar .= ":".$this->endDateTime.$this->separator;
151+
$calendar .= ':'.$this->endDateTime.$this->separator;
152152
}
153153
if (isset($this->location)) {
154-
$calendar .= "LOCATION:".$this->location.$this->separator;
154+
$calendar .= 'LOCATION:'.$this->location.$this->separator;
155155
}
156156
if (isset($this->url)) {
157-
$calendar .= "URL:".$this->url.$this->separator;
157+
$calendar .= 'URL:'.$this->url.$this->separator;
158158
}
159159
if (isset($this->description)) {
160-
$calendar .= "DESCRIPTION:".$this->description.$this->separator;
160+
$calendar .= 'DESCRIPTION:'.$this->description.$this->separator;
161161
}
162162
if (isset($this->categories)) {
163-
$calendar .= "CATEGORIES:".$this->categories.$this->separator;
163+
$calendar .= 'CATEGORIES:'.$this->categories.$this->separator;
164164
}
165165
if (isset($this->alarm)) {
166166
$calendar .= $this->alarm;
@@ -193,10 +193,10 @@ protected function setProperties(array $arguments)
193193
}
194194

195195
$this->summary = $arguments['summary'];
196-
$this->setEventDateTime($arguments['startDateTime'], "start");
196+
$this->setEventDateTime($arguments['startDateTime'], 'start');
197197

198198
if (isset($arguments['endDateTime'])) {
199-
$this->setEventDateTime($arguments['endDateTime'], "end");
199+
$this->setEventDateTime($arguments['endDateTime'], 'end');
200200
}
201201
if (isset($arguments['location'])) {
202202
$this->location = $arguments['location'];
@@ -235,13 +235,13 @@ protected function setUrl($url)
235235
* @param string $type
236236
*
237237
*/
238-
protected function setEventDateTime($eventDateTime, $type = "")
238+
protected function setEventDateTime($eventDateTime, $type = '')
239239
{
240240
if ($this->isValidDateTime($eventDateTime, $type)) {
241-
if ($type == "start") {
241+
if ($type == 'start') {
242242
$this->startDateTime = $this->convertEventDateTimeToString($eventDateTime);
243243
}
244-
if ($type == "end") {
244+
if ($type == 'end') {
245245
$this->endDateTime = $this->convertEventDateTimeToString($eventDateTime);
246246
}
247247
}
@@ -271,15 +271,15 @@ protected function isValidUrl($url)
271271
*
272272
* @return bool
273273
*/
274-
protected function isValidDateTime($dateTime, $type = "")
274+
protected function isValidDateTime($dateTime, $type = '')
275275
{
276276
$newDate = DateTime::createFromFormat($this->dateTimeFormat, $dateTime);
277277
if (! ($newDate && $newDate->format($this->dateTimeFormat) == $dateTime)) {
278-
if ($type == "start") {
278+
if ($type == 'start') {
279279
throw new InvalidArgumentException('Invalid start date provided. Date must be of format '.
280280
$this->dateTimeFormat);
281281
}
282-
if ($type == "end") {
282+
if ($type == 'end') {
283283
throw new InvalidArgumentException('Invalid end date provided. Date must be of format '.
284284
$this->dateTimeFormat);
285285
}
@@ -292,7 +292,7 @@ protected function isValidDateTime($dateTime, $type = "")
292292

293293

294294
/**
295-
* Returns correct date time to string
295+
* Returns correct date time to string.
296296
*
297297
* @param string $dateTime
298298
*
@@ -309,7 +309,7 @@ protected function convertEventDateTimeToString($dateTime)
309309
}
310310

311311
/**
312-
* Ensures timezone string is valid. ('Africa/Douala')
312+
* Ensures timezone string is valid. ('Africa/Douala').
313313
*
314314
* @param string $timezone
315315
*
@@ -331,7 +331,7 @@ protected function isValidTimeZone($timezone)
331331
protected function setEventTimeZone($timezone)
332332
{
333333
if ($this->isValidTimeZone($timezone)) {
334-
$this->timezone = ";TZID=".$timezone;
334+
$this->timezone = ';TZID='.$timezone;
335335
}
336336
}
337337

@@ -343,17 +343,17 @@ protected function setEventTimeZone($timezone)
343343
protected function setAlarm($alarm)
344344
{
345345
if (is_array($alarm)) {
346-
$alarmString = "BEGIN:VALARM".$this->separator;
347-
$alarmString .= "ACTION:DISPLAY".$this->separator;
348-
$alarmString .= $this->keyExists("repeat", $alarm) ?
349-
"REPEAT:".$alarm["repeat"].$this->separator : "";
350-
$alarmString .= $this->keyExists("summary", $alarm) ?
351-
"SUMMARY:".$alarm["summary"].$this->separator : "";
352-
$alarmString .= $this->keyExists("description", $alarm) ?
353-
"DESCRIPTION:".$alarm["description"].$this->separator : "";
354-
if($this->keyExists("trigger", $alarm) && is_array($alarm["trigger"]))
355-
$alarmString .= $this->setAlarmTrigger($alarm["trigger"]).$this->separator;
356-
$alarmString .= "END:VALARM".$this->separator;
346+
$alarmString = 'BEGIN:VALARM'.$this->separator;
347+
$alarmString .= 'ACTION:DISPLAY'.$this->separator;
348+
$alarmString .= $this->keyExists('repeat', $alarm) ?
349+
'REPEAT:'.$alarm['repeat'].$this->separator : '';
350+
$alarmString .= $this->keyExists('summary', $alarm) ?
351+
'SUMMARY:'.$alarm['summary'].$this->separator : '';
352+
$alarmString .= $this->keyExists('description', $alarm) ?
353+
'DESCRIPTION:'.$alarm['description'].$this->separator : '';
354+
if($this->keyExists('trigger', $alarm) && is_array($alarm['trigger']))
355+
$alarmString .= $this->setAlarmTrigger($alarm['trigger']).$this->separator;
356+
$alarmString .= 'END:VALARM'.$this->separator;
357357
$this->alarm = $alarmString;
358358
} else {
359359
throw new InvalidArgumentException('Invalid alarm provided.');
@@ -369,15 +369,15 @@ protected function setAlarm($alarm)
369369
protected function setAlarmTrigger($alarm)
370370
{
371371
if (is_array($alarm)) {
372-
$alarmString = "TRIGGER:";
373-
$alarmString .= $this->keyExists("before", $alarm) ? $alarm["before"] ? "-" : "" : "-";
374-
$alarmString .= "P";
375-
$alarmString .= $this->keyExists("weeks", $alarm) ? $alarm["weeks"]."W" : "";
376-
$alarmString .= $this->keyExists("days", $alarm) ? $alarm["days"]."D" : "";
377-
$alarmString .= "T";
378-
$alarmString .= $this->keyExists("hours", $alarm) ? $alarm["hours"]."H" : "";
379-
$alarmString .= $this->keyExists("minutes", $alarm) ? $alarm["minutes"]."M" : "";
380-
$alarmString .= $this->keyExists("seconds", $alarm) ? $alarm["seconds"]."S" : "";
372+
$alarmString = 'TRIGGER:';
373+
$alarmString .= $this->keyExists('before', $alarm) ? $alarm['before'] ? '-' : '' : '';
374+
$alarmString .= 'P';
375+
$alarmString .= $this->keyExists('weeks', $alarm) ? $alarm['weeks'].'W' : '';
376+
$alarmString .= $this->keyExists('days', $alarm) ? $alarm['days'].'D' : '';
377+
$alarmString .= 'T';
378+
$alarmString .= $this->keyExists('hours', $alarm) ? $alarm['hours'].'H' : '';
379+
$alarmString .= $this->keyExists('minutes', $alarm) ? $alarm['minutes'].'M' : '';
380+
$alarmString .= $this->keyExists('seconds', $alarm) ? $alarm['seconds'].'S' : '';
381381
return $alarmString;
382382
} else {
383383
throw new InvalidArgumentException('Invalid alarm duration provided.');
@@ -392,7 +392,7 @@ protected function setAlarmTrigger($alarm)
392392
protected function setCategories($categories)
393393
{
394394
if (is_array($categories)) {
395-
$this->categories = implode(",", $categories);
395+
$this->categories = implode(',', $categories);
396396
} else {
397397
throw new InvalidArgumentException('Invalid categories provided.');
398398
}
@@ -401,12 +401,13 @@ protected function setCategories($categories)
401401
/**
402402
* Checks if key exists in array.
403403
*
404-
* @param string $key;
404+
* @param string $key
405405
* @param array $array
406406
*
407-
* @return boolean
407+
* @return bool
408408
*/
409-
protected function keyExists($key, $array) {
409+
protected function keyExists($key, $array)
410+
{
410411
return array_key_exists($key, $array);
411412
}
412413
}

0 commit comments

Comments
 (0)