aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject/lib/Property/ICalendar/Period.php')
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Period.php58
1 files changed, 20 insertions, 38 deletions
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Period.php b/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
index d35b425aa..17bfa5c5c 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
@@ -17,8 +17,8 @@ use Sabre\Xml;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Period extends Property {
-
+class Period extends Property
+{
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -34,13 +34,10 @@ class Period extends Property {
* not yet done, but parameters are not included.
*
* @param string $val
- *
- * @return void
*/
- function setRawMimeDirValue($val) {
-
+ public function setRawMimeDirValue($val)
+ {
$this->setValue(explode($this->delimiter, $val));
-
}
/**
@@ -48,10 +45,9 @@ class Period extends Property {
*
* @return string
*/
- function getRawMimeDirValue() {
-
+ public function getRawMimeDirValue()
+ {
return implode($this->delimiter, $this->getParts());
-
}
/**
@@ -62,10 +58,9 @@ class Period extends Property {
*
* @return string
*/
- function getValueType() {
-
+ public function getValueType()
+ {
return 'PERIOD';
-
}
/**
@@ -74,21 +69,16 @@ class Period extends Property {
* The value must always be an array.
*
* @param array $value
- *
- * @return void
*/
- function setJsonValue(array $value) {
-
+ public function setJsonValue(array $value)
+ {
$value = array_map(
- function($item) {
-
+ function ($item) {
return strtr(implode('/', $item), [':' => '', '-' => '']);
-
},
$value
);
parent::setJsonValue($value);
-
}
/**
@@ -98,20 +88,19 @@ class Period extends Property {
*
* @return array
*/
- function getJsonValue() {
-
+ public function getJsonValue()
+ {
$return = [];
foreach ($this->getParts() as $item) {
-
list($start, $end) = explode('/', $item, 2);
$start = DateTimeParser::parseDateTime($start);
// This is a duration value.
- if ($end[0] === 'P') {
+ if ('P' === $end[0]) {
$return[] = [
$start->format('Y-m-d\\TH:i:s'),
- $end
+ $end,
];
} else {
$end = DateTimeParser::parseDateTime($end);
@@ -120,36 +109,29 @@ class Period extends Property {
$end->format('Y-m-d\\TH:i:s'),
];
}
-
}
return $return;
-
}
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
- * @param Xml\Writer $writer XML writer.
- *
- * @return void
+ * @param Xml\Writer $writer XML writer
*/
- protected function xmlSerializeValue(Xml\Writer $writer) {
-
+ protected function xmlSerializeValue(Xml\Writer $writer)
+ {
$writer->startElement(strtolower($this->getValueType()));
$value = $this->getJsonValue();
$writer->writeElement('start', $value[0][0]);
- if ($value[0][1][0] === 'P') {
+ if ('P' === $value[0][1][0]) {
$writer->writeElement('duration', $value[0][1]);
- }
- else {
+ } else {
$writer->writeElement('end', $value[0][1]);
}
$writer->endElement();
-
}
-
}