aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Property
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-04-25 11:24:09 +0200
committerMario <mario@mariovavti.com>2019-04-25 11:24:09 +0200
commitf1c07977809ce3221286d53e99f0d91145b1166f (patch)
tree4c067a3b701ea56f10070c386b26a30f93666eb0 /vendor/sabre/vobject/lib/Property
parent701167bc125700efb3e6ce759b85bcb4d36ee42e (diff)
downloadvolse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.tar.gz
volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.tar.bz2
volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.zip
Revert "update composer libs"
This reverts commit e779335d060b3a51d6a144d23af4097ae6801473
Diffstat (limited to 'vendor/sabre/vobject/lib/Property')
-rw-r--r--vendor/sabre/vobject/lib/Property/Binary.php47
-rw-r--r--vendor/sabre/vobject/lib/Property/Boolean.php33
-rw-r--r--vendor/sabre/vobject/lib/Property/FlatText.php12
-rw-r--r--vendor/sabre/vobject/lib/Property/FloatValue.php54
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php15
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Date.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php145
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Duration.php28
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Period.php58
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Recur.php133
-rw-r--r--vendor/sabre/vobject/lib/Property/IntegerValue.php37
-rw-r--r--vendor/sabre/vobject/lib/Property/Text.php131
-rw-r--r--vendor/sabre/vobject/lib/Property/Time.php35
-rw-r--r--vendor/sabre/vobject/lib/Property/Unknown.php15
-rw-r--r--vendor/sabre/vobject/lib/Property/Uri.php34
-rw-r--r--vendor/sabre/vobject/lib/Property/UtcOffset.php27
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/Date.php17
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php122
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/DateTime.php10
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php22
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php33
21 files changed, 624 insertions, 388 deletions
diff --git a/vendor/sabre/vobject/lib/Property/Binary.php b/vendor/sabre/vobject/lib/Property/Binary.php
index 830dd9028..d54cae25d 100644
--- a/vendor/sabre/vobject/lib/Property/Binary.php
+++ b/vendor/sabre/vobject/lib/Property/Binary.php
@@ -18,8 +18,8 @@ use Sabre\VObject\Property;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Binary extends Property
-{
+class Binary extends Property {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -34,18 +34,25 @@ class Binary extends Property
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
+ *
+ * @return void
*/
- public function setValue($value)
- {
+ function setValue($value) {
+
if (is_array($value)) {
- if (1 === count($value)) {
+
+ if (count($value) === 1) {
$this->value = $value[0];
} else {
throw new \InvalidArgumentException('The argument must either be a string or an array with only one child');
}
+
} else {
+
$this->value = $value;
+
}
+
}
/**
@@ -55,10 +62,13 @@ class Binary extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->value = base64_decode($val);
+
}
/**
@@ -66,9 +76,10 @@ class Binary extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return base64_encode($this->value);
+
}
/**
@@ -79,9 +90,10 @@ class Binary extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'BINARY';
+
}
/**
@@ -91,9 +103,10 @@ class Binary extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
return [base64_encode($this->getValue())];
+
}
/**
@@ -102,10 +115,14 @@ class Binary extends Property
* The value must always be an array.
*
* @param array $value
+ *
+ * @return void
*/
- public function setJsonValue(array $value)
- {
+ function setJsonValue(array $value) {
+
$value = array_map('base64_decode', $value);
parent::setJsonValue($value);
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/Boolean.php b/vendor/sabre/vobject/lib/Property/Boolean.php
index 1b219bb8c..6f5887e25 100644
--- a/vendor/sabre/vobject/lib/Property/Boolean.php
+++ b/vendor/sabre/vobject/lib/Property/Boolean.php
@@ -17,8 +17,8 @@ use
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Boolean extends Property
-{
+class Boolean extends Property {
+
/**
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
*
@@ -26,11 +26,14 @@ class Boolean extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
- $val = 'TRUE' === strtoupper($val) ? true : false;
+ function setRawMimeDirValue($val) {
+
+ $val = strtoupper($val) === 'TRUE' ? true : false;
$this->setValue($val);
+
}
/**
@@ -38,9 +41,10 @@ class Boolean extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return $this->value ? 'TRUE' : 'FALSE';
+
}
/**
@@ -51,9 +55,10 @@ class Boolean extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'BOOLEAN';
+
}
/**
@@ -61,15 +66,19 @@ class Boolean extends Property
* object.
*
* @param array $value
+ *
+ * @return void
*/
- public function setXmlValue(array $value)
- {
+ function setXmlValue(array $value) {
+
$value = array_map(
- function ($value) {
+ function($value) {
return 'true' === $value;
},
$value
);
parent::setXmlValue($value);
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/FlatText.php b/vendor/sabre/vobject/lib/Property/FlatText.php
index d15cfe051..2c7b43c29 100644
--- a/vendor/sabre/vobject/lib/Property/FlatText.php
+++ b/vendor/sabre/vobject/lib/Property/FlatText.php
@@ -22,8 +22,8 @@ namespace Sabre\VObject\Property;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class FlatText extends Text
-{
+class FlatText extends Text {
+
/**
* Field separator.
*
@@ -37,10 +37,14 @@ class FlatText extends Text
* Overriding this so we're not splitting on a ; delimiter.
*
* @param string $val
+ *
+ * @return void
*/
- public function setQuotedPrintableValue($val)
- {
+ function setQuotedPrintableValue($val) {
+
$val = quoted_printable_decode($val);
$this->setValue($val);
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/FloatValue.php b/vendor/sabre/vobject/lib/Property/FloatValue.php
index 208d74516..15b119549 100644
--- a/vendor/sabre/vobject/lib/Property/FloatValue.php
+++ b/vendor/sabre/vobject/lib/Property/FloatValue.php
@@ -15,8 +15,8 @@ use Sabre\Xml;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class FloatValue extends Property
-{
+class FloatValue extends Property {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -32,14 +32,17 @@ class FloatValue extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$val = explode($this->delimiter, $val);
foreach ($val as &$item) {
- $item = (float) $item;
+ $item = (float)$item;
}
$this->setParts($val);
+
}
/**
@@ -47,12 +50,13 @@ class FloatValue extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return implode(
$this->delimiter,
$this->getParts()
);
+
}
/**
@@ -63,9 +67,10 @@ class FloatValue extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'FLOAT';
+
}
/**
@@ -75,19 +80,20 @@ class FloatValue extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$val = array_map('floatval', $this->getParts());
// Special-casing the GEO property.
//
// See:
// http://tools.ietf.org/html/draft-ietf-jcardcal-jcal-04#section-3.4.1.2
- if ('GEO' === $this->name) {
+ if ($this->name === 'GEO') {
return [$val];
}
return $val;
+
}
/**
@@ -95,32 +101,42 @@ class FloatValue extends Property
* object.
*
* @param array $value
+ *
+ * @return void
*/
- public function setXmlValue(array $value)
- {
+ function setXmlValue(array $value) {
+
$value = array_map('floatval', $value);
parent::setXmlValue($value);
+
}
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
- * @param Xml\Writer $writer XML writer
+ * @param Xml\Writer $writer XML writer.
+ *
+ * @return void
*/
- protected function xmlSerializeValue(Xml\Writer $writer)
- {
+ protected function xmlSerializeValue(Xml\Writer $writer) {
+
// Special-casing the GEO property.
//
// See:
// http://tools.ietf.org/html/rfc6321#section-3.4.1.2
- if ('GEO' === $this->name) {
+ if ($this->name === 'GEO') {
+
$value = array_map('floatval', $this->getParts());
$writer->writeElement('latitude', $value[0]);
$writer->writeElement('longitude', $value[1]);
- } else {
+
+ }
+ else {
parent::xmlSerializeValue($writer);
}
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
index e89bb31f9..a0c4a9b9a 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
@@ -14,8 +14,8 @@ use
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalAddress extends Text
-{
+class CalAddress extends Text {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -32,9 +32,10 @@ class CalAddress extends Text
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'CAL-ADDRESS';
+
}
/**
@@ -47,14 +48,14 @@ class CalAddress extends Text
*
* @return string
*/
- public function getNormalizedValue()
- {
+ function getNormalizedValue() {
+
$input = $this->getValue();
if (!strpos($input, ':')) {
return $input;
}
list($schema, $everythingElse) = explode(':', $input, 2);
+ return strtolower($schema) . ':' . $everythingElse;
- return strtolower($schema).':'.$everythingElse;
}
}
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Date.php b/vendor/sabre/vobject/lib/Property/ICalendar/Date.php
index d8e86d13e..378a0d60a 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Date.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Date.php
@@ -13,6 +13,6 @@ namespace Sabre\VObject\Property\ICalendar;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Date extends DateTime
-{
+class Date extends DateTime {
+
}
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php b/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php
index 7eb3e0bb7..d580d4f68 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php
@@ -24,8 +24,8 @@ use Sabre\VObject\TimeZoneUtil;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class DateTime extends Property
-{
+class DateTime extends Property {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -40,14 +40,17 @@ class DateTime extends Property
* You may also specify DateTime objects here.
*
* @param array $parts
+ *
+ * @return void
*/
- public function setParts(array $parts)
- {
+ function setParts(array $parts) {
+
if (isset($parts[0]) && $parts[0] instanceof DateTimeInterface) {
$this->setDateTimes($parts);
} else {
parent::setParts($parts);
}
+
}
/**
@@ -58,9 +61,11 @@ class DateTime extends Property
* Instead of strings, you may also use DateTime here.
*
* @param string|array|DateTimeInterface $value
+ *
+ * @return void
*/
- public function setValue($value)
- {
+ function setValue($value) {
+
if (is_array($value) && isset($value[0]) && $value[0] instanceof DateTimeInterface) {
$this->setDateTimes($value);
} elseif ($value instanceof DateTimeInterface) {
@@ -68,6 +73,7 @@ class DateTime extends Property
} else {
parent::setValue($value);
}
+
}
/**
@@ -77,10 +83,13 @@ class DateTime extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue(explode($this->delimiter, $val));
+
}
/**
@@ -88,9 +97,10 @@ class DateTime extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return implode($this->delimiter, $this->getParts());
+
}
/**
@@ -98,9 +108,10 @@ class DateTime extends Property
*
* @return bool
*/
- public function hasTime()
- {
- return 'DATE' !== strtoupper((string) $this['VALUE']);
+ function hasTime() {
+
+ return strtoupper((string)$this['VALUE']) !== 'DATE';
+
}
/**
@@ -108,14 +119,15 @@ class DateTime extends Property
*
* Note that DATE is always floating.
*/
- public function isFloating()
- {
+ function isFloating() {
+
return
!$this->hasTime() ||
(
!isset($this['TZID']) &&
- false === strpos($this->getValue(), 'Z')
+ strpos($this->getValue(), 'Z') === false
);
+
}
/**
@@ -131,16 +143,15 @@ class DateTime extends Property
*
* @param DateTimeZone $timeZone
*
- * @return \DateTimeImmutable
+ * @return DateTimeImmutable
*/
- public function getDateTime(DateTimeZone $timeZone = null)
- {
+ function getDateTime(DateTimeZone $timeZone = null) {
+
$dt = $this->getDateTimes($timeZone);
- if (!$dt) {
- return;
- }
+ if (!$dt) return;
return $dt[0];
+
}
/**
@@ -152,35 +163,38 @@ class DateTime extends Property
*
* @param DateTimeZone $timeZone
*
- * @return \DateTimeImmutable[]
+ * @return DateTimeImmutable[]
* @return \DateTime[]
*/
- public function getDateTimes(DateTimeZone $timeZone = null)
- {
+ function getDateTimes(DateTimeZone $timeZone = null) {
+
// Does the property have a TZID?
$tzid = $this['TZID'];
if ($tzid) {
- $timeZone = TimeZoneUtil::getTimeZone((string) $tzid, $this->root);
+ $timeZone = TimeZoneUtil::getTimeZone((string)$tzid, $this->root);
}
$dts = [];
foreach ($this->getParts() as $part) {
$dts[] = DateTimeParser::parse($part, $timeZone);
}
-
return $dts;
+
}
/**
* Sets the property as a DateTime object.
*
* @param DateTimeInterface $dt
- * @param bool isFloating If set to true, timezones will be ignored
+ * @param bool isFloating If set to true, timezones will be ignored.
+ *
+ * @return void
*/
- public function setDateTime(DateTimeInterface $dt, $isFloating = false)
- {
+ function setDateTime(DateTimeInterface $dt, $isFloating = false) {
+
$this->setDateTimes([$dt], $isFloating);
+
}
/**
@@ -190,17 +204,21 @@ class DateTime extends Property
* the otehr values will be adjusted for that timezone
*
* @param DateTimeInterface[] $dt
- * @param bool isFloating If set to true, timezones will be ignored
+ * @param bool isFloating If set to true, timezones will be ignored.
+ *
+ * @return void
*/
- public function setDateTimes(array $dt, $isFloating = false)
- {
+ function setDateTimes(array $dt, $isFloating = false) {
+
$values = [];
if ($this->hasTime()) {
+
$tz = null;
$isUtc = false;
foreach ($dt as $d) {
+
if ($isFloating) {
$values[] = $d->format('Ymd\\THis');
continue;
@@ -220,18 +238,25 @@ class DateTime extends Property
} else {
$values[] = $d->format('Ymd\\THis');
}
+
}
if ($isUtc || $isFloating) {
$this->offsetUnset('TZID');
}
+
} else {
+
foreach ($dt as $d) {
+
$values[] = $d->format('Ymd');
+
}
$this->offsetUnset('TZID');
+
}
$this->value = $values;
+
}
/**
@@ -242,9 +267,10 @@ class DateTime extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return $this->hasTime() ? 'DATE-TIME' : 'DATE';
+
}
/**
@@ -254,8 +280,8 @@ class DateTime extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$dts = $this->getDateTimes();
$hasTime = $this->hasTime();
$isFloating = $this->isFloating();
@@ -264,15 +290,18 @@ class DateTime extends Property
$isUtc = $isFloating ? false : in_array($tz->getName(), ['UTC', 'GMT', 'Z']);
return array_map(
- function (DateTimeInterface $dt) use ($hasTime, $isUtc) {
+ function(DateTimeInterface $dt) use ($hasTime, $isUtc) {
+
if ($hasTime) {
- return $dt->format('Y-m-d\\TH:i:s').($isUtc ? 'Z' : '');
+ return $dt->format('Y-m-d\\TH:i:s') . ($isUtc ? 'Z' : '');
} else {
return $dt->format('Y-m-d');
}
+
},
$dts
);
+
}
/**
@@ -281,21 +310,26 @@ class DateTime extends Property
* The value must always be an array.
*
* @param array $value
+ *
+ * @return void
*/
- public function setJsonValue(array $value)
- {
+ function setJsonValue(array $value) {
+
// dates and times in jCal have one difference to dates and times in
// iCalendar. In jCal date-parts are separated by dashes, and
// time-parts are separated by colons. It makes sense to just remove
// those.
$this->setValue(
array_map(
- function ($item) {
+ function($item) {
+
return strtr($item, [':' => '', '-' => '']);
+
},
$value
)
);
+
}
/**
@@ -303,17 +337,20 @@ class DateTime extends Property
* VALUE from DATE-TIME to DATE or vice-versa.
*
* @param string $name
- * @param mixed $value
+ * @param mixed $value
+ *
+ * @return void
*/
- public function offsetSet($name, $value)
- {
+ function offsetSet($name, $value) {
+
parent::offsetSet($name, $value);
- if ('VALUE' !== strtoupper($name)) {
+ if (strtoupper($name) !== 'VALUE') {
return;
}
// This will ensure that dates are correctly encoded.
$this->setDateTimes($this->getDateTimes());
+
}
/**
@@ -338,30 +375,30 @@ class DateTime extends Property
*
* @return array
*/
- public function validate($options = 0)
- {
+ function validate($options = 0) {
+
$messages = parent::validate($options);
$valueType = $this->getValueType();
$values = $this->getParts();
try {
foreach ($values as $value) {
switch ($valueType) {
- case 'DATE':
+ case 'DATE' :
DateTimeParser::parseDate($value);
break;
- case 'DATE-TIME':
+ case 'DATE-TIME' :
DateTimeParser::parseDateTime($value);
break;
}
}
} catch (InvalidDataException $e) {
$messages[] = [
- 'level' => 3,
- 'message' => 'The supplied value ('.$value.') is not a correct '.$valueType,
- 'node' => $this,
+ 'level' => 3,
+ 'message' => 'The supplied value (' . $value . ') is not a correct ' . $valueType,
+ 'node' => $this,
];
}
-
return $messages;
+
}
}
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php b/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php
index 87f008160..7b7e1ce8e 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php
@@ -16,8 +16,8 @@ use Sabre\VObject\Property;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Duration extends Property
-{
+class Duration extends Property {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -33,10 +33,13 @@ class Duration extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue(explode($this->delimiter, $val));
+
}
/**
@@ -44,9 +47,10 @@ class Duration extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return implode($this->delimiter, $this->getParts());
+
}
/**
@@ -57,9 +61,10 @@ class Duration extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'DURATION';
+
}
/**
@@ -69,11 +74,12 @@ class Duration extends Property
*
* @return \DateInterval
*/
- public function getDateInterval()
- {
+ function getDateInterval() {
+
$parts = $this->getParts();
$value = $parts[0];
-
return DateTimeParser::parseDuration($value);
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Period.php b/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
index 17bfa5c5c..d35b425aa 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,10 +34,13 @@ class Period extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue(explode($this->delimiter, $val));
+
}
/**
@@ -45,9 +48,10 @@ class Period extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return implode($this->delimiter, $this->getParts());
+
}
/**
@@ -58,9 +62,10 @@ class Period extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'PERIOD';
+
}
/**
@@ -69,16 +74,21 @@ class Period extends Property
* The value must always be an array.
*
* @param array $value
+ *
+ * @return void
*/
- public function setJsonValue(array $value)
- {
+ function setJsonValue(array $value) {
+
$value = array_map(
- function ($item) {
+ function($item) {
+
return strtr(implode('/', $item), [':' => '', '-' => '']);
+
},
$value
);
parent::setJsonValue($value);
+
}
/**
@@ -88,19 +98,20 @@ class Period extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$return = [];
foreach ($this->getParts() as $item) {
+
list($start, $end) = explode('/', $item, 2);
$start = DateTimeParser::parseDateTime($start);
// This is a duration value.
- if ('P' === $end[0]) {
+ if ($end[0] === 'P') {
$return[] = [
$start->format('Y-m-d\\TH:i:s'),
- $end,
+ $end
];
} else {
$end = DateTimeParser::parseDateTime($end);
@@ -109,29 +120,36 @@ 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
+ * @param Xml\Writer $writer XML writer.
+ *
+ * @return void
*/
- 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 ('P' === $value[0][1][0]) {
+ if ($value[0][1][0] === 'P') {
$writer->writeElement('duration', $value[0][1]);
- } else {
+ }
+ else {
$writer->writeElement('end', $value[0][1]);
}
$writer->endElement();
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php b/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php
index baeda781e..434b77088 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Recur.php
@@ -22,33 +22,36 @@ use Sabre\Xml;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Recur extends Property
-{
+class Recur extends Property {
+
/**
* Updates the current value.
*
* This may be either a single, or multiple strings in an array.
*
* @param string|array $value
+ *
+ * @return void
*/
- public function setValue($value)
- {
+ function setValue($value) {
+
// If we're getting the data from json, we'll be receiving an object
if ($value instanceof \StdClass) {
- $value = (array) $value;
+ $value = (array)$value;
}
if (is_array($value)) {
$newVal = [];
foreach ($value as $k => $v) {
+
if (is_string($v)) {
$v = strtoupper($v);
// The value had multiple sub-values
- if (false !== strpos($v, ',')) {
+ if (strpos($v, ',') !== false) {
$v = explode(',', $v);
}
- if (0 === strcmp($k, 'until')) {
+ if (strcmp($k, 'until') === 0) {
$v = strtr($v, [':' => '', '-' => '']);
}
} elseif (is_array($v)) {
@@ -63,6 +66,7 @@ class Recur extends Property
} else {
throw new \InvalidArgumentException('You must either pass a string, or a key=>value array');
}
+
}
/**
@@ -76,24 +80,26 @@ class Recur extends Property
*
* @return string
*/
- public function getValue()
- {
+ function getValue() {
+
$out = [];
foreach ($this->value as $key => $value) {
- $out[] = $key.'='.(is_array($value) ? implode(',', $value) : $value);
+ $out[] = $key . '=' . (is_array($value) ? implode(',', $value) : $value);
}
-
return strtoupper(implode(';', $out));
+
}
/**
* Sets a multi-valued property.
*
* @param array $parts
+ * @return void
*/
- public function setParts(array $parts)
- {
+ function setParts(array $parts) {
+
$this->setValue($parts);
+
}
/**
@@ -104,9 +110,10 @@ class Recur extends Property
*
* @return array
*/
- public function getParts()
- {
+ function getParts() {
+
return $this->value;
+
}
/**
@@ -116,10 +123,13 @@ class Recur extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue($val);
+
}
/**
@@ -127,9 +137,10 @@ class Recur extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return $this->getValue();
+
}
/**
@@ -140,9 +151,10 @@ class Recur extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'RECUR';
+
}
/**
@@ -152,36 +164,39 @@ class Recur extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$values = [];
foreach ($this->getParts() as $k => $v) {
- if (0 === strcmp($k, 'UNTIL')) {
+ if (strcmp($k, 'UNTIL') === 0) {
$date = new DateTime($this->root, null, $v);
$values[strtolower($k)] = $date->getJsonValue()[0];
- } elseif (0 === strcmp($k, 'COUNT')) {
+ } elseif (strcmp($k, 'COUNT') === 0) {
$values[strtolower($k)] = intval($v);
} else {
$values[strtolower($k)] = $v;
}
}
-
return [$values];
+
}
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
- * @param Xml\Writer $writer XML writer
+ * @param Xml\Writer $writer XML writer.
+ *
+ * @return void
*/
- protected function xmlSerializeValue(Xml\Writer $writer)
- {
+ protected function xmlSerializeValue(Xml\Writer $writer) {
+
$valueType = strtolower($this->getValueType());
foreach ($this->getJsonValue() as $value) {
$writer->writeElement($valueType, $value);
}
+
}
/**
@@ -191,11 +206,12 @@ class Recur extends Property
*
* @return array
*/
- public static function stringToArray($value)
- {
+ static function stringToArray($value) {
+
$value = strtoupper($value);
$newValue = [];
foreach (explode(';', $value) as $part) {
+
// Skipping empty parts.
if (empty($part)) {
continue;
@@ -203,10 +219,11 @@ class Recur extends Property
list($partName, $partValue) = explode('=', $part);
// The value itself had multiple values..
- if (false !== strpos($partValue, ',')) {
+ if (strpos($partValue, ',') !== false) {
$partValue = explode(',', $partValue);
}
$newValue[$partName] = $partValue;
+
}
return $newValue;
@@ -234,31 +251,32 @@ class Recur extends Property
*
* @return array
*/
- public function validate($options = 0)
- {
+ function validate($options = 0) {
+
$repair = ($options & self::REPAIR);
$warnings = parent::validate($options);
$values = $this->getParts();
foreach ($values as $key => $value) {
- if ('' === $value) {
+
+ if ($value === '') {
$warnings[] = [
- 'level' => $repair ? 1 : 3,
- 'message' => 'Invalid value for '.$key.' in '.$this->name,
- 'node' => $this,
+ 'level' => $repair ? 1 : 3,
+ 'message' => 'Invalid value for ' . $key . ' in ' . $this->name,
+ 'node' => $this
];
if ($repair) {
unset($values[$key]);
}
- } elseif ('BYMONTH' == $key) {
- $byMonth = (array) $value;
+ } elseif ($key == 'BYMONTH') {
+ $byMonth = (array)$value;
foreach ($byMonth as $i => $v) {
- if (!is_numeric($v) || (int) $v < 1 || (int) $v > 12) {
+ if (!is_numeric($v) || (int)$v < 1 || (int)$v > 12) {
$warnings[] = [
- 'level' => $repair ? 1 : 3,
+ 'level' => $repair ? 1 : 3,
'message' => 'BYMONTH in RRULE must have value(s) between 1 and 12!',
- 'node' => $this,
+ 'node' => $this
];
if ($repair) {
if (is_array($value)) {
@@ -273,14 +291,14 @@ class Recur extends Property
if (is_array($value) && empty($values[$key])) {
unset($values[$key]);
}
- } elseif ('BYWEEKNO' == $key) {
- $byWeekNo = (array) $value;
+ } elseif ($key == 'BYWEEKNO') {
+ $byWeekNo = (array)$value;
foreach ($byWeekNo as $i => $v) {
- if (!is_numeric($v) || (int) $v < -53 || 0 == (int) $v || (int) $v > 53) {
+ if (!is_numeric($v) || (int)$v < -53 || (int)$v == 0 || (int)$v > 53) {
$warnings[] = [
- 'level' => $repair ? 1 : 3,
+ 'level' => $repair ? 1 : 3,
'message' => 'BYWEEKNO in RRULE must have value(s) from -53 to -1, or 1 to 53!',
- 'node' => $this,
+ 'node' => $this
];
if ($repair) {
if (is_array($value)) {
@@ -295,14 +313,14 @@ class Recur extends Property
if (is_array($value) && empty($values[$key])) {
unset($values[$key]);
}
- } elseif ('BYYEARDAY' == $key) {
- $byYearDay = (array) $value;
+ } elseif ($key == 'BYYEARDAY') {
+ $byYearDay = (array)$value;
foreach ($byYearDay as $i => $v) {
- if (!is_numeric($v) || (int) $v < -366 || 0 == (int) $v || (int) $v > 366) {
+ if (!is_numeric($v) || (int)$v < -366 || (int)$v == 0 || (int)$v > 366) {
$warnings[] = [
- 'level' => $repair ? 1 : 3,
+ 'level' => $repair ? 1 : 3,
'message' => 'BYYEARDAY in RRULE must have value(s) from -366 to -1, or 1 to 366!',
- 'node' => $this,
+ 'node' => $this
];
if ($repair) {
if (is_array($value)) {
@@ -318,12 +336,13 @@ class Recur extends Property
unset($values[$key]);
}
}
+
}
if (!isset($values['FREQ'])) {
$warnings[] = [
- 'level' => $repair ? 1 : 3,
- 'message' => 'FREQ is required in '.$this->name,
- 'node' => $this,
+ 'level' => $repair ? 1 : 3,
+ 'message' => 'FREQ is required in ' . $this->name,
+ 'node' => $this
];
if ($repair) {
$this->parent->remove($this);
@@ -334,5 +353,7 @@ class Recur extends Property
}
return $warnings;
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/IntegerValue.php b/vendor/sabre/vobject/lib/Property/IntegerValue.php
index ddd71d731..5bd1887fa 100644
--- a/vendor/sabre/vobject/lib/Property/IntegerValue.php
+++ b/vendor/sabre/vobject/lib/Property/IntegerValue.php
@@ -15,8 +15,8 @@ use
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class IntegerValue extends Property
-{
+class IntegerValue extends Property {
+
/**
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
*
@@ -24,10 +24,13 @@ class IntegerValue extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
- $this->setValue((int) $val);
+ function setRawMimeDirValue($val) {
+
+ $this->setValue((int)$val);
+
}
/**
@@ -35,9 +38,10 @@ class IntegerValue extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return $this->value;
+
}
/**
@@ -48,9 +52,10 @@ class IntegerValue extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'INTEGER';
+
}
/**
@@ -60,9 +65,10 @@ class IntegerValue extends Property
*
* @return array
*/
- public function getJsonValue()
- {
- return [(int) $this->getValue()];
+ function getJsonValue() {
+
+ return [(int)$this->getValue()];
+
}
/**
@@ -70,10 +76,13 @@ class IntegerValue extends Property
* object.
*
* @param array $value
+ *
+ * @return void
*/
- public function setXmlValue(array $value)
- {
+ function setXmlValue(array $value) {
+
$value = array_map('intval', $value);
parent::setXmlValue($value);
+
}
}
diff --git a/vendor/sabre/vobject/lib/Property/Text.php b/vendor/sabre/vobject/lib/Property/Text.php
index 23c945551..47a86ccc9 100644
--- a/vendor/sabre/vobject/lib/Property/Text.php
+++ b/vendor/sabre/vobject/lib/Property/Text.php
@@ -17,8 +17,8 @@ use Sabre\Xml;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Text extends Property
-{
+class Text extends Property {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -53,7 +53,7 @@ class Text extends Property
* @var array
*/
protected $minimumPropertyValues = [
- 'N' => 5,
+ 'N' => 5,
'ADR' => 7,
];
@@ -64,14 +64,16 @@ class Text extends Property
* parameters will automatically be created, or you can just pass a list of
* Parameter objects.
*
- * @param Component $root The root document
- * @param string $name
+ * @param Component $root The root document
+ * @param string $name
* @param string|array|null $value
- * @param array $parameters List of parameters
- * @param string $group The vcard property group
+ * @param array $parameters List of parameters
+ * @param string $group The vcard property group
+ *
+ * @return void
*/
- public function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null)
- {
+ function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null) {
+
// There's two types of multi-valued text properties:
// 1. multivalue properties.
// 2. structured value properties
@@ -82,6 +84,7 @@ class Text extends Property
}
parent::__construct($root, $name, $value, $parameters, $group);
+
}
/**
@@ -91,19 +94,24 @@ class Text extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue(MimeDir::unescapeValue($val, $this->delimiter));
+
}
/**
* Sets the value as a quoted-printable encoded string.
*
* @param string $val
+ *
+ * @return void
*/
- public function setQuotedPrintableValue($val)
- {
+ function setQuotedPrintableValue($val) {
+
$val = quoted_printable_decode($val);
// Quoted printable only appears in vCard 2.1, and the only character
@@ -115,6 +123,7 @@ class Text extends Property
$regex = '# (?<!\\\\) ; #x';
$matches = preg_split($regex, $val);
$this->setValue($matches);
+
}
/**
@@ -122,8 +131,8 @@ class Text extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
$val = $this->getParts();
if (isset($this->minimumPropertyValues[$this->name])) {
@@ -131,6 +140,7 @@ class Text extends Property
}
foreach ($val as &$item) {
+
if (!is_array($item)) {
$item = [$item];
}
@@ -140,17 +150,19 @@ class Text extends Property
$subItem,
[
'\\' => '\\\\',
- ';' => '\;',
- ',' => '\,',
+ ';' => '\;',
+ ',' => '\,',
"\n" => '\n',
- "\r" => '',
+ "\r" => "",
]
);
}
$item = implode(',', $item);
+
}
return implode($this->delimiter, $val);
+
}
/**
@@ -160,16 +172,16 @@ class Text extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
// Structured text values should always be returned as a single
// array-item. Multi-value text should be returned as multiple items in
// the top-array.
if (in_array($this->name, $this->structuredValues)) {
return [$this->getParts()];
}
-
return $this->getParts();
+
}
/**
@@ -180,9 +192,10 @@ class Text extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'TEXT';
+
}
/**
@@ -190,10 +203,10 @@ class Text extends Property
*
* @return string
*/
- public function serialize()
- {
+ function serialize() {
+
// We need to kick in a special type of encoding, if it's a 2.1 vcard.
- if (Document::VCARD21 !== $this->root->getDocumentType()) {
+ if ($this->root->getDocumentType() !== Document::VCARD21) {
return parent::serialize();
}
@@ -215,19 +228,22 @@ class Text extends Property
}
$str = $this->name;
- if ($this->group) {
- $str = $this->group.'.'.$this->name;
- }
+ if ($this->group) $str = $this->group . '.' . $this->name;
foreach ($this->parameters as $param) {
- if ('QUOTED-PRINTABLE' === $param->getValue()) {
+
+ if ($param->getValue() === 'QUOTED-PRINTABLE') {
continue;
}
- $str .= ';'.$param->serialize();
+ $str .= ';' . $param->serialize();
+
}
+
+
// If the resulting value contains a \n, we must encode it as
// quoted-printable.
- if (false !== \strpos($val, "\n")) {
+ if (\strpos($val, "\n") !== false) {
+
$str .= ';ENCODING=QUOTED-PRINTABLE:';
$lastLine = $str;
$out = null;
@@ -236,27 +252,26 @@ class Text extends Property
// encode newlines for us. Specifically, the \r\n sequence must in
// vcards be encoded as =0D=OA and we must insert soft-newlines
// every 75 bytes.
- for ($ii = 0; $ii < \strlen($val); ++$ii) {
+ for ($ii = 0;$ii < \strlen($val);$ii++) {
$ord = \ord($val[$ii]);
// These characters are encoded as themselves.
if ($ord >= 32 && $ord <= 126) {
$lastLine .= $val[$ii];
} else {
- $lastLine .= '='.\strtoupper(\bin2hex($val[$ii]));
+ $lastLine .= '=' . \strtoupper(\bin2hex($val[$ii]));
}
if (\strlen($lastLine) >= 75) {
// Soft line break
- $out .= $lastLine."=\r\n ";
+ $out .= $lastLine . "=\r\n ";
$lastLine = null;
}
- }
- if (!\is_null($lastLine)) {
- $out .= $lastLine."\r\n";
- }
+ }
+ if (!\is_null($lastLine)) $out .= $lastLine . "\r\n";
return $out;
+
} else {
- $str .= ':'.$val;
+ $str .= ':' . $val;
$str = \preg_replace(
'/(
@@ -270,20 +285,24 @@ class Text extends Property
// remove single space after last CRLF
return \substr($str, 0, -1);
+
}
+
}
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
- * @param Xml\Writer $writer XML writer
+ * @param Xml\Writer $writer XML writer.
+ *
+ * @return void
*/
- protected function xmlSerializeValue(Xml\Writer $writer)
- {
+ protected function xmlSerializeValue(Xml\Writer $writer) {
+
$values = $this->getParts();
- $map = function ($items) use ($values, $writer) {
+ $map = function($items) use ($values, $writer) {
foreach ($items as $i => $item) {
$writer->writeElement(
$item,
@@ -293,6 +312,7 @@ class Text extends Property
};
switch ($this->name) {
+
// Special-casing the REQUEST-STATUS property.
//
// See:
@@ -312,14 +332,14 @@ class Text extends Property
'given',
'additional',
'prefix',
- 'suffix',
+ 'suffix'
]);
break;
case 'GENDER':
$map([
'sex',
- 'text',
+ 'text'
]);
break;
@@ -331,20 +351,21 @@ class Text extends Property
'locality',
'region',
'code',
- 'country',
+ 'country'
]);
break;
case 'CLIENTPIDMAP':
$map([
'sourceid',
- 'uri',
+ 'uri'
]);
break;
default:
parent::xmlSerializeValue($writer);
}
+
}
/**
@@ -365,26 +386,28 @@ class Text extends Property
*
* @return array
*/
- public function validate($options = 0)
- {
+ function validate($options = 0) {
+
$warnings = parent::validate($options);
if (isset($this->minimumPropertyValues[$this->name])) {
+
$minimum = $this->minimumPropertyValues[$this->name];
$parts = $this->getParts();
if (count($parts) < $minimum) {
$warnings[] = [
- 'level' => $options & self::REPAIR ? 1 : 3,
- 'message' => 'The '.$this->name.' property must have at least '.$minimum.' values. It only has '.count($parts),
- 'node' => $this,
+ 'level' => $options & self::REPAIR ? 1 : 3,
+ 'message' => 'The ' . $this->name . ' property must have at least ' . $minimum . ' values. It only has ' . count($parts),
+ 'node' => $this,
];
if ($options & self::REPAIR) {
$parts = array_pad($parts, $minimum, '');
$this->setParts($parts);
}
}
- }
+ }
return $warnings;
+
}
}
diff --git a/vendor/sabre/vobject/lib/Property/Time.php b/vendor/sabre/vobject/lib/Property/Time.php
index 7aeafc8d0..dbafc3b85 100644
--- a/vendor/sabre/vobject/lib/Property/Time.php
+++ b/vendor/sabre/vobject/lib/Property/Time.php
@@ -13,8 +13,8 @@ use Sabre\VObject\DateTimeParser;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Time extends Text
-{
+class Time extends Text {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -31,9 +31,10 @@ class Time extends Text
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'TIME';
+
}
/**
@@ -42,9 +43,11 @@ class Time extends Text
* The value must always be an array.
*
* @param array $value
+ *
+ * @return void
*/
- public function setJsonValue(array $value)
- {
+ function setJsonValue(array $value) {
+
// Removing colons from value.
$value = str_replace(
':',
@@ -52,11 +55,12 @@ class Time extends Text
$value
);
- if (1 === count($value)) {
+ if (count($value) === 1) {
$this->setValue(reset($value));
} else {
$this->setValue($value);
}
+
}
/**
@@ -66,8 +70,8 @@ class Time extends Text
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$parts = DateTimeParser::parseVCardTime($this->getValue());
$timeStr = '';
@@ -105,7 +109,7 @@ class Time extends Text
// Timezone
if (!is_null($parts['timezone'])) {
- if ('Z' === $parts['timezone']) {
+ if ($parts['timezone'] === 'Z') {
$timeStr .= 'Z';
} else {
$timeStr .=
@@ -114,6 +118,7 @@ class Time extends Text
}
return [$timeStr];
+
}
/**
@@ -121,15 +126,19 @@ class Time extends Text
* object.
*
* @param array $value
+ *
+ * @return void
*/
- public function setXmlValue(array $value)
- {
+ function setXmlValue(array $value) {
+
$value = array_map(
- function ($value) {
+ function($value) {
return str_replace(':', '', $value);
},
$value
);
parent::setXmlValue($value);
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/Unknown.php b/vendor/sabre/vobject/lib/Property/Unknown.php
index 6f404c286..7a3373868 100644
--- a/vendor/sabre/vobject/lib/Property/Unknown.php
+++ b/vendor/sabre/vobject/lib/Property/Unknown.php
@@ -12,8 +12,8 @@ namespace Sabre\VObject\Property;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Unknown extends Text
-{
+class Unknown extends Text {
+
/**
* Returns the value, in the format it should be encoded for json.
*
@@ -21,9 +21,10 @@ class Unknown extends Text
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
return [$this->getRawMimeDirValue()];
+
}
/**
@@ -34,8 +35,10 @@ class Unknown extends Text
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'UNKNOWN';
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/Uri.php b/vendor/sabre/vobject/lib/Property/Uri.php
index 3449ba1f2..88fcfaab8 100644
--- a/vendor/sabre/vobject/lib/Property/Uri.php
+++ b/vendor/sabre/vobject/lib/Property/Uri.php
@@ -14,8 +14,8 @@ use Sabre\VObject\Property;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Uri extends Text
-{
+class Uri extends Text {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -32,9 +32,10 @@ class Uri extends Text
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'URI';
+
}
/**
@@ -42,8 +43,8 @@ class Uri extends Text
*
* @return array
*/
- public function parameters()
- {
+ function parameters() {
+
$parameters = parent::parameters();
if (!isset($parameters['VALUE']) && in_array($this->name, ['URL', 'PHOTO'])) {
// If we are encoding a URI value, and this URI value has no
@@ -56,8 +57,8 @@ class Uri extends Text
// See Issue #227 and #235
$parameters['VALUE'] = new Parameter($this->root, 'VALUE', 'URI');
}
-
return $parameters;
+
}
/**
@@ -67,9 +68,11 @@ class Uri extends Text
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
// Normally we don't need to do any type of unescaping for these
// properties, however.. we've noticed that Google Contacts
// specifically escapes the colon (:) with a blackslash. While I have
@@ -78,16 +81,16 @@ class Uri extends Text
//
// Good thing backslashes are not allowed in urls. Makes it easy to
// assume that a backslash is always intended as an escape character.
- if ('URL' === $this->name) {
+ if ($this->name === 'URL') {
$regex = '# (?: (\\\\ (?: \\\\ | : ) ) ) #x';
$matches = preg_split($regex, $val, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$newVal = '';
foreach ($matches as $match) {
switch ($match) {
- case '\:':
+ case '\:' :
$newVal .= ':';
break;
- default:
+ default :
$newVal .= $match;
break;
}
@@ -96,6 +99,7 @@ class Uri extends Text
} else {
$this->value = strtr($val, ['\,' => ',']);
}
+
}
/**
@@ -103,8 +107,8 @@ class Uri extends Text
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
if (is_array($this->value)) {
$value = $this->value[0];
} else {
@@ -112,5 +116,7 @@ class Uri extends Text
}
return strtr($value, [',' => '\,']);
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/UtcOffset.php b/vendor/sabre/vobject/lib/Property/UtcOffset.php
index 732239e23..61895c48e 100644
--- a/vendor/sabre/vobject/lib/Property/UtcOffset.php
+++ b/vendor/sabre/vobject/lib/Property/UtcOffset.php
@@ -11,8 +11,8 @@ namespace Sabre\VObject\Property;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class UtcOffset extends Text
-{
+class UtcOffset extends Text {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -29,9 +29,10 @@ class UtcOffset extends Text
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'UTC-OFFSET';
+
}
/**
@@ -40,16 +41,19 @@ class UtcOffset extends Text
* The value must always be an array.
*
* @param array $value
+ *
+ * @return void
*/
- public function setJsonValue(array $value)
- {
+ function setJsonValue(array $value) {
+
$value = array_map(
- function ($value) {
+ function($value) {
return str_replace(':', '', $value);
},
$value
);
parent::setJsonValue($value);
+
}
/**
@@ -59,14 +63,15 @@ class UtcOffset extends Text
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
return array_map(
- function ($value) {
- return substr($value, 0, -2).':'.
+ function($value) {
+ return substr($value, 0, -2) . ':' .
substr($value, -2);
},
parent::getJsonValue()
);
+
}
}
diff --git a/vendor/sabre/vobject/lib/Property/VCard/Date.php b/vendor/sabre/vobject/lib/Property/VCard/Date.php
index a018ccbb8..1ef6dff34 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/Date.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/Date.php
@@ -11,8 +11,8 @@ namespace Sabre\VObject\Property\VCard;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Date extends DateAndOrTime
-{
+class Date extends DateAndOrTime {
+
/**
* Returns the type of value.
*
@@ -21,18 +21,23 @@ class Date extends DateAndOrTime
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'DATE';
+
}
/**
* Sets the property as a DateTime object.
*
* @param \DateTimeInterface $dt
+ *
+ * @return void
*/
- public function setDateTime(\DateTimeInterface $dt)
- {
+ function setDateTime(\DateTimeInterface $dt) {
+
$this->value = $dt->format('Ymd');
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php b/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php
index b7e17492a..3b4ae3bb5 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php
@@ -19,12 +19,12 @@ use Sabre\Xml;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class DateAndOrTime extends Property
-{
+class DateAndOrTime extends Property {
+
/**
* Field separator.
*
- * @var string|null
+ * @var null|string
*/
public $delimiter = null;
@@ -36,9 +36,10 @@ class DateAndOrTime extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'DATE-AND-OR-TIME';
+
}
/**
@@ -47,9 +48,11 @@ class DateAndOrTime extends Property
* You may also specify DateTimeInterface objects here.
*
* @param array $parts
+ *
+ * @return void
*/
- public function setParts(array $parts)
- {
+ function setParts(array $parts) {
+
if (count($parts) > 1) {
throw new \InvalidArgumentException('Only one value allowed');
}
@@ -58,6 +61,7 @@ class DateAndOrTime extends Property
} else {
parent::setParts($parts);
}
+
}
/**
@@ -68,23 +72,28 @@ class DateAndOrTime extends Property
* Instead of strings, you may also use DateTimeInterface here.
*
* @param string|array|DateTimeInterface $value
+ *
+ * @return void
*/
- public function setValue($value)
- {
+ function setValue($value) {
+
if ($value instanceof DateTimeInterface) {
$this->setDateTime($value);
} else {
parent::setValue($value);
}
+
}
/**
* Sets the property as a DateTime object.
*
* @param DateTimeInterface $dt
+ *
+ * @return void
*/
- public function setDateTime(DateTimeInterface $dt)
- {
+ function setDateTime(DateTimeInterface $dt) {
+
$tz = $dt->getTimeZone();
$isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z']);
@@ -96,6 +105,7 @@ class DateAndOrTime extends Property
}
$this->value = $value;
+
}
/**
@@ -114,12 +124,12 @@ class DateAndOrTime extends Property
*
* @return DateTimeImmutable
*/
- public function getDateTime()
- {
+ function getDateTime() {
+
$now = new DateTime();
- $tzFormat = 0 === $now->getTimezone()->getOffset($now) ? '\\Z' : 'O';
- $nowParts = DateTimeParser::parseVCardDateTime($now->format('Ymd\\This'.$tzFormat));
+ $tzFormat = $now->getTimezone()->getOffset($now) === 0 ? '\\Z' : 'O';
+ $nowParts = DateTimeParser::parseVCardDateTime($now->format('Ymd\\This' . $tzFormat));
$dateParts = DateTimeParser::parseVCardDateTime($this->getValue());
@@ -131,8 +141,8 @@ class DateAndOrTime extends Property
$dateParts[$k] = $nowParts[$k];
}
}
-
return new DateTimeImmutable("$dateParts[year]-$dateParts[month]-$dateParts[date] $dateParts[hour]:$dateParts[minute]:$dateParts[second] $dateParts[timezone]");
+
}
/**
@@ -142,14 +152,15 @@ class DateAndOrTime extends Property
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$parts = DateTimeParser::parseVCardDateTime($this->getValue());
$dateStr = '';
// Year
if (!is_null($parts['year'])) {
+
$dateStr .= $parts['year'];
if (!is_null($parts['month'])) {
@@ -157,21 +168,26 @@ class DateAndOrTime extends Property
// dash.
$dateStr .= '-';
}
+
} else {
+
if (!is_null($parts['month']) || !is_null($parts['date'])) {
// Inserting two dashes
$dateStr .= '--';
}
+
}
// Month
if (!is_null($parts['month'])) {
+
$dateStr .= $parts['month'];
if (isset($parts['date'])) {
// If month and date are set, we need the separator dash.
$dateStr .= '-';
}
+
} elseif (isset($parts['date'])) {
// If the month is empty, and a date is set, we need a 'empty
// dash'
@@ -183,6 +199,7 @@ class DateAndOrTime extends Property
$dateStr .= $parts['date'];
}
+
// Early exit if we don't have a time string.
if (is_null($parts['hour']) && is_null($parts['minute']) && is_null($parts['second'])) {
return [$dateStr];
@@ -192,11 +209,13 @@ class DateAndOrTime extends Property
// Hour
if (!is_null($parts['hour'])) {
+
$dateStr .= $parts['hour'];
if (!is_null($parts['minute'])) {
$dateStr .= ':';
}
+
} else {
// We know either minute or second _must_ be set, so we insert a
// dash for an empty value.
@@ -205,11 +224,13 @@ class DateAndOrTime extends Property
// Minute
if (!is_null($parts['minute'])) {
+
$dateStr .= $parts['minute'];
if (!is_null($parts['second'])) {
$dateStr .= ':';
}
+
} elseif (isset($parts['second'])) {
// Dash for empty minute
$dateStr .= '-';
@@ -226,27 +247,30 @@ class DateAndOrTime extends Property
}
return [$dateStr];
+
}
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
- * @param Xml\Writer $writer XML writer
+ * @param Xml\Writer $writer XML writer.
+ *
+ * @return void
*/
- protected function xmlSerializeValue(Xml\Writer $writer)
- {
+ protected function xmlSerializeValue(Xml\Writer $writer) {
+
$valueType = strtolower($this->getValueType());
$parts = DateTimeParser::parseVCardDateAndOrTime($this->getValue());
$value = '';
// $d = defined
- $d = function ($part) use ($parts) {
+ $d = function($part) use ($parts) {
return !is_null($parts[$part]);
};
// $r = read
- $r = function ($part) use ($parts) {
+ $r = function($part) use ($parts) {
return $parts[$part];
};
@@ -258,29 +282,31 @@ class DateAndOrTime extends Property
// }
if (($d('year') || $d('month') || $d('date'))
&& (!$d('hour') && !$d('minute') && !$d('second') && !$d('timezone'))) {
+
if ($d('year') && $d('month') && $d('date')) {
- $value .= $r('year').$r('month').$r('date');
+ $value .= $r('year') . $r('month') . $r('date');
} elseif ($d('year') && $d('month') && !$d('date')) {
- $value .= $r('year').'-'.$r('month');
+ $value .= $r('year') . '-' . $r('month');
} elseif (!$d('year') && $d('month')) {
- $value .= '--'.$r('month').$r('date');
+ $value .= '--' . $r('month') . $r('date');
} elseif (!$d('year') && !$d('month') && $d('date')) {
- $value .= '---'.$r('date');
+ $value .= '---' . $r('date');
}
- // # 4.3.2
+ // # 4.3.2
// value-time = element time {
// xsd:string { pattern = "(\d\d(\d\d(\d\d)?)?|-\d\d(\d\d?)|--\d\d)"
// ~ "(Z|[+\-]\d\d(\d\d)?)?" }
// }
} elseif ((!$d('year') && !$d('month') && !$d('date'))
&& ($d('hour') || $d('minute') || $d('second'))) {
+
if ($d('hour')) {
- $value .= $r('hour').$r('minute').$r('second');
+ $value .= $r('hour') . $r('minute') . $r('second');
} elseif ($d('minute')) {
- $value .= '-'.$r('minute').$r('second');
+ $value .= '-' . $r('minute') . $r('second');
} elseif ($d('second')) {
- $value .= '--'.$r('second');
+ $value .= '--' . $r('second');
}
$value .= $r('timezone');
@@ -291,19 +317,22 @@ class DateAndOrTime extends Property
// ~ "(Z|[+\-]\d\d(\d\d)?)?" }
// }
} elseif ($d('date') && $d('hour')) {
+
if ($d('year') && $d('month') && $d('date')) {
- $value .= $r('year').$r('month').$r('date');
+ $value .= $r('year') . $r('month') . $r('date');
} elseif (!$d('year') && $d('month') && $d('date')) {
- $value .= '--'.$r('month').$r('date');
+ $value .= '--' . $r('month') . $r('date');
} elseif (!$d('year') && !$d('month') && $d('date')) {
- $value .= '---'.$r('date');
+ $value .= '---' . $r('date');
}
- $value .= 'T'.$r('hour').$r('minute').$r('second').
+ $value .= 'T' . $r('hour') . $r('minute') . $r('second') .
$r('timezone');
+
}
$writer->writeElement($valueType, $value);
+
}
/**
@@ -313,10 +342,13 @@ class DateAndOrTime extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue($val);
+
}
/**
@@ -324,9 +356,10 @@ class DateAndOrTime extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return implode($this->delimiter, $this->getParts());
+
}
/**
@@ -351,8 +384,8 @@ class DateAndOrTime extends Property
*
* @return array
*/
- public function validate($options = 0)
- {
+ function validate($options = 0) {
+
$messages = parent::validate($options);
$value = $this->getValue();
@@ -360,12 +393,13 @@ class DateAndOrTime extends Property
DateTimeParser::parseVCardDateTime($value);
} catch (InvalidDataException $e) {
$messages[] = [
- 'level' => 3,
- 'message' => 'The supplied value ('.$value.') is not a correct DATE-AND-OR-TIME property',
- 'node' => $this,
+ 'level' => 3,
+ 'message' => 'The supplied value (' . $value . ') is not a correct DATE-AND-OR-TIME property',
+ 'node' => $this,
];
}
return $messages;
+
}
}
diff --git a/vendor/sabre/vobject/lib/Property/VCard/DateTime.php b/vendor/sabre/vobject/lib/Property/VCard/DateTime.php
index 49c1f3555..e7c804ca7 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/DateTime.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/DateTime.php
@@ -11,8 +11,8 @@ namespace Sabre\VObject\Property\VCard;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class DateTime extends DateAndOrTime
-{
+class DateTime extends DateAndOrTime {
+
/**
* Returns the type of value.
*
@@ -21,8 +21,10 @@ class DateTime extends DateAndOrTime
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'DATE-TIME';
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php b/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php
index 697273989..aa7e9178d 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php
@@ -14,8 +14,8 @@ use
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class LanguageTag extends Property
-{
+class LanguageTag extends Property {
+
/**
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
*
@@ -23,10 +23,13 @@ class LanguageTag extends Property
* not yet done, but parameters are not included.
*
* @param string $val
+ *
+ * @return void
*/
- public function setRawMimeDirValue($val)
- {
+ function setRawMimeDirValue($val) {
+
$this->setValue($val);
+
}
/**
@@ -34,9 +37,10 @@ class LanguageTag extends Property
*
* @return string
*/
- public function getRawMimeDirValue()
- {
+ function getRawMimeDirValue() {
+
return $this->getValue();
+
}
/**
@@ -47,8 +51,10 @@ class LanguageTag extends Property
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'LANGUAGE-TAG';
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php b/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php
index fccf2d600..9d311f99d 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php
@@ -15,8 +15,8 @@ use Sabre\Xml;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class TimeStamp extends Text
-{
+class TimeStamp extends Text {
+
/**
* In case this is a multi-value property. This string will be used as a
* delimiter.
@@ -33,9 +33,10 @@ class TimeStamp extends Text
*
* @return string
*/
- public function getValueType()
- {
+ function getValueType() {
+
return 'TIMESTAMP';
+
}
/**
@@ -45,16 +46,16 @@ class TimeStamp extends Text
*
* @return array
*/
- public function getJsonValue()
- {
+ function getJsonValue() {
+
$parts = DateTimeParser::parseVCardDateTime($this->getValue());
$dateStr =
- $parts['year'].'-'.
- $parts['month'].'-'.
- $parts['date'].'T'.
- $parts['hour'].':'.
- $parts['minute'].':'.
+ $parts['year'] . '-' .
+ $parts['month'] . '-' .
+ $parts['date'] . 'T' .
+ $parts['hour'] . ':' .
+ $parts['minute'] . ':' .
$parts['second'];
// Timezone
@@ -63,19 +64,23 @@ class TimeStamp extends Text
}
return [$dateStr];
+
}
/**
* This method serializes only the value of a property. This is used to
* create xCard or xCal documents.
*
- * @param Xml\Writer $writer XML writer
+ * @param Xml\Writer $writer XML writer.
+ *
+ * @return void
*/
- protected function xmlSerializeValue(Xml\Writer $writer)
- {
+ protected function xmlSerializeValue(Xml\Writer $writer) {
+
// xCard is the only XML and JSON format that has the same date and time
// format than vCard.
$valueType = strtolower($this->getValueType());
$writer->writeElement($valueType, $this->getValue());
+
}
}