aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Property/FloatValue.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject/lib/Property/FloatValue.php')
-rw-r--r--vendor/sabre/vobject/lib/Property/FloatValue.php54
1 files changed, 35 insertions, 19 deletions
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);
}
+
}
+
}