mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
CardDAV (pre-alpha/unstable)
This commit is contained in:
parent
0ec965bccb
commit
599e934b4a
76 changed files with 6984 additions and 1512 deletions
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Sabre\VObject\Property\ICalendar;
|
||||
|
||||
use
|
||||
Sabre\VObject\Property\Text;
|
||||
|
||||
/**
|
||||
* CalAddress property
|
||||
*
|
||||
* This object encodes CAL-ADDRESS values, as defined in rfc5545
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class CalAddress extends Text {
|
||||
|
||||
/**
|
||||
* In case this is a multi-value property. This string will be used as a
|
||||
* delimiter.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $delimiter = null;
|
||||
|
||||
/**
|
||||
* Returns the type of value.
|
||||
*
|
||||
* This corresponds to the VALUE= parameter. Every property also has a
|
||||
* 'default' valueType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueType() {
|
||||
|
||||
return 'CAL-ADDRESS';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Sabre\VObject\Property\ICalendar;
|
||||
|
||||
use
|
||||
Sabre\VObject\Property,
|
||||
Sabre\VObject\Parser\MimeDir,
|
||||
Sabre\VObject\DateTimeParser,
|
||||
Sabre\VObject\TimeZoneUtil;
|
||||
|
||||
/**
|
||||
* DateTime property
|
||||
*
|
||||
* This object represents DATE values, as defined here:
|
||||
*
|
||||
* http://tools.ietf.org/html/rfc5545#section-3.3.5
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Date extends DateTime {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,308 @@
|
|||
<?php
|
||||
|
||||
namespace Sabre\VObject\Property\ICalendar;
|
||||
|
||||
use
|
||||
Sabre\VObject\Property,
|
||||
Sabre\VObject\Parser\MimeDir,
|
||||
Sabre\VObject\DateTimeParser,
|
||||
Sabre\VObject\TimeZoneUtil;
|
||||
|
||||
/**
|
||||
* DateTime property
|
||||
*
|
||||
* This object represents DATE-TIME values, as defined here:
|
||||
*
|
||||
* http://tools.ietf.org/html/rfc5545#section-3.3.4
|
||||
*
|
||||
* This particular object has a bit of hackish magic that it may also in some
|
||||
* cases represent a DATE value. This is because it's a common usecase to be
|
||||
* able to change a DATE-TIME into a DATE.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class DateTime extends Property {
|
||||
|
||||
/**
|
||||
* In case this is a multi-value property. This string will be used as a
|
||||
* delimiter.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
|
||||
/**
|
||||
* Sets a multi-valued property.
|
||||
*
|
||||
* You may also specify DateTime objects here.
|
||||
*
|
||||
* @param array $parts
|
||||
* @return void
|
||||
*/
|
||||
public function setParts(array $parts) {
|
||||
|
||||
if (isset($parts[0]) && $parts[0] instanceof \DateTime) {
|
||||
$this->setDateTimes($parts);
|
||||
} else {
|
||||
parent::setParts($parts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the current value.
|
||||
*
|
||||
* This may be either a single, or multiple strings in an array.
|
||||
*
|
||||
* Instead of strings, you may also use DateTime here.
|
||||
*
|
||||
* @param string|array|\DateTime $value
|
||||
* @return void
|
||||
*/
|
||||
public function setValue($value) {
|
||||
|
||||
if (is_array($value) && isset($value[0]) && $value[0] instanceof \DateTime) {
|
||||
$this->setDateTimes($value);
|
||||
} elseif ($value instanceof \DateTime) {
|
||||
$this->setDateTimes(array($value));
|
||||
} else {
|
||||
parent::setValue($value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
|
||||
*
|
||||
* This has been 'unfolded', so only 1 line will be passed. Unescaping is
|
||||
* not yet done, but parameters are not included.
|
||||
*
|
||||
* @param string $val
|
||||
* @return void
|
||||
*/
|
||||
public function setRawMimeDirValue($val) {
|
||||
|
||||
$this->setValue(explode($this->delimiter, $val));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a raw mime-dir representation of the value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawMimeDirValue() {
|
||||
|
||||
return implode($this->delimiter, $this->getParts());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this is a DATE-TIME value, false if it's a DATE.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTime() {
|
||||
|
||||
return strtoupper((string)$this['VALUE']) !== 'DATE';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a date-time value.
|
||||
*
|
||||
* Note that if this property contained more than 1 date-time, only the
|
||||
* first will be returned. To get an array with multiple values, call
|
||||
* getDateTimes.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDateTime() {
|
||||
|
||||
$dt = $this->getDateTimes();
|
||||
if (!$dt) return null;
|
||||
|
||||
return $dt[0];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns multiple date-time values.
|
||||
*
|
||||
* @return \DateTime[]
|
||||
*/
|
||||
public function getDateTimes() {
|
||||
|
||||
// Finding the timezone.
|
||||
$tz = $this['TZID'];
|
||||
|
||||
if ($tz) {
|
||||
$tz = TimeZoneUtil::getTimeZone((string)$tz, $this->root);
|
||||
}
|
||||
|
||||
$dts = array();
|
||||
foreach($this->getParts() as $part) {
|
||||
$dts[] = DateTimeParser::parse($part, $tz);
|
||||
}
|
||||
return $dts;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property as a DateTime object.
|
||||
*
|
||||
* @param \DateTime $dt
|
||||
* @param bool isFloating If set to true, timezones will be ignored.
|
||||
* @return void
|
||||
*/
|
||||
public function setDateTime(\DateTime $dt, $isFloating = false) {
|
||||
|
||||
$this->setDateTimes(array($dt), $isFloating);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property as multiple date-time objects.
|
||||
*
|
||||
* The first value will be used as a reference for the timezones, and all
|
||||
* the otehr values will be adjusted for that timezone
|
||||
*
|
||||
* @param \DateTime[] $dt
|
||||
* @param bool isFloating If set to true, timezones will be ignored.
|
||||
* @return void
|
||||
*/
|
||||
public function setDateTimes(array $dt, $isFloating = false) {
|
||||
|
||||
$values = array();
|
||||
|
||||
if($this->hasTime()) {
|
||||
|
||||
$tz = null;
|
||||
$isUtc = false;
|
||||
|
||||
foreach($dt as $d) {
|
||||
|
||||
if ($isFloating) {
|
||||
$values[] = $d->format('Ymd\\THis');
|
||||
continue;
|
||||
}
|
||||
if (is_null($tz)) {
|
||||
$tz = $d->getTimeZone();
|
||||
$isUtc = in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
|
||||
if (!$isUtc) {
|
||||
$this->offsetSet('TZID', $tz->getName());
|
||||
}
|
||||
} else {
|
||||
$d->setTimeZone($tz);
|
||||
}
|
||||
|
||||
if ($isUtc) {
|
||||
$values[] = $d->format('Ymd\\THis\\Z');
|
||||
} 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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of value.
|
||||
*
|
||||
* This corresponds to the VALUE= parameter. Every property also has a
|
||||
* 'default' valueType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueType() {
|
||||
|
||||
return $this->hasTime()?'DATE-TIME':'DATE';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value, in the format it should be encoded for json.
|
||||
*
|
||||
* This method must always return an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJsonValue() {
|
||||
|
||||
$dts = $this->getDateTimes();
|
||||
$hasTime = $this->hasTime();
|
||||
|
||||
$tz = $dts[0]->getTimeZone();
|
||||
$isUtc = in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
|
||||
|
||||
return array_map(function($dt) use ($hasTime, $isUtc) {
|
||||
|
||||
if ($hasTime) {
|
||||
return $dt->format('Y-m-d\\TH:i:s') . ($isUtc?'Z':'');
|
||||
} else {
|
||||
return $dt->format('Y-m-d');
|
||||
}
|
||||
|
||||
}, $dts);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the json value, as it would appear in a jCard or jCal object.
|
||||
*
|
||||
* The value must always be an array.
|
||||
*
|
||||
* @param array $value
|
||||
* @return void
|
||||
*/
|
||||
public 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) {
|
||||
|
||||
return strtr($item, array(':'=>'', '-'=>''));
|
||||
|
||||
}, $value));
|
||||
|
||||
}
|
||||
/**
|
||||
* We need to intercept offsetSet, because it may be used to alter the
|
||||
* VALUE from DATE-TIME to DATE or vice-versa.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($name, $value) {
|
||||
|
||||
parent::offsetSet($name, $value);
|
||||
if (strtoupper($name)!=='VALUE') {
|
||||
return;
|
||||
}
|
||||
|
||||
// This will ensure that dates are correctly encoded.
|
||||
$this->setDateTimes($this->getDateTimes());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace Sabre\VObject\Property\ICalendar;
|
||||
|
||||
use
|
||||
Sabre\VObject\Property,
|
||||
Sabre\VObject\Parser\MimeDir,
|
||||
Sabre\VObject\DateTimeParser;
|
||||
|
||||
/**
|
||||
* Duration property
|
||||
*
|
||||
* This object represents DURATION values, as defined here:
|
||||
*
|
||||
* http://tools.ietf.org/html/rfc5545#section-3.3.6
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Duration extends Property {
|
||||
|
||||
/**
|
||||
* In case this is a multi-value property. This string will be used as a
|
||||
* delimiter.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
|
||||
/**
|
||||
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
|
||||
*
|
||||
* This has been 'unfolded', so only 1 line will be passed. Unescaping is
|
||||
* not yet done, but parameters are not included.
|
||||
*
|
||||
* @param string $val
|
||||
* @return void
|
||||
*/
|
||||
public function setRawMimeDirValue($val) {
|
||||
|
||||
$this->setValue(explode($this->delimiter, $val));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a raw mime-dir representation of the value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawMimeDirValue() {
|
||||
|
||||
return implode($this->delimiter, $this->getParts());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of value.
|
||||
*
|
||||
* This corresponds to the VALUE= parameter. Every property also has a
|
||||
* 'default' valueType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueType() {
|
||||
|
||||
return 'DURATION';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DateInterval representation of the Duration property.
|
||||
*
|
||||
* If the property has more than one value, only the first is returned.
|
||||
*
|
||||
* @return \DateInterval
|
||||
*/
|
||||
public function getDateInterval() {
|
||||
|
||||
$parts = $this->getParts();
|
||||
$value = $parts[0];
|
||||
return DateTimeParser::parseDuration($value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
namespace Sabre\VObject\Property\ICalendar;
|
||||
|
||||
use
|
||||
Sabre\VObject\Property,
|
||||
Sabre\VObject\Parser\MimeDir,
|
||||
Sabre\VObject\DateTimeParser;
|
||||
|
||||
/**
|
||||
* Period property
|
||||
*
|
||||
* This object represents PERIOD values, as defined here:
|
||||
*
|
||||
* http://tools.ietf.org/html/rfc5545#section-3.8.2.6
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Period extends Property {
|
||||
|
||||
/**
|
||||
* In case this is a multi-value property. This string will be used as a
|
||||
* delimiter.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
|
||||
/**
|
||||
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
|
||||
*
|
||||
* This has been 'unfolded', so only 1 line will be passed. Unescaping is
|
||||
* not yet done, but parameters are not included.
|
||||
*
|
||||
* @param string $val
|
||||
* @return void
|
||||
*/
|
||||
public function setRawMimeDirValue($val) {
|
||||
|
||||
$this->setValue(explode($this->delimiter, $val));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a raw mime-dir representation of the value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawMimeDirValue() {
|
||||
|
||||
return implode($this->delimiter, $this->getParts());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of value.
|
||||
*
|
||||
* This corresponds to the VALUE= parameter. Every property also has a
|
||||
* 'default' valueType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueType() {
|
||||
|
||||
return "PERIOD";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the json value, as it would appear in a jCard or jCal object.
|
||||
*
|
||||
* The value must always be an array.
|
||||
*
|
||||
* @param array $value
|
||||
* @return void
|
||||
*/
|
||||
public function setJsonValue(array $value) {
|
||||
|
||||
$value = array_map(function($item) {
|
||||
|
||||
return strtr(implode('/', $item), array(':' => '', '-' => ''));
|
||||
|
||||
}, $value);
|
||||
parent::setJsonValue($value);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value, in the format it should be encoded for json.
|
||||
*
|
||||
* This method must always return an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJsonValue() {
|
||||
|
||||
$return = array();
|
||||
foreach($this->getParts() as $item) {
|
||||
|
||||
list($start, $end) = explode('/', $item, 2);
|
||||
|
||||
$start = DateTimeParser::parseDateTime($start);
|
||||
|
||||
// This is a duration value.
|
||||
if ($end[0]==='P') {
|
||||
$return[] = array(
|
||||
$start->format('Y-m-d\\TH:i:s'),
|
||||
$end
|
||||
);
|
||||
} else {
|
||||
$end = DateTimeParser::parseDateTime($end);
|
||||
$return[] = array(
|
||||
$start->format('Y-m-d\\TH:i:s'),
|
||||
$end->format('Y-m-d\\TH:i:s'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
namespace Sabre\VObject\Property\ICalendar;
|
||||
|
||||
use
|
||||
Sabre\VObject\Property,
|
||||
Sabre\VObject\Parser\MimeDir;
|
||||
|
||||
/**
|
||||
* Recur property
|
||||
*
|
||||
* This object represents RECUR properties.
|
||||
* These values are just used for RRULE and the now deprecated EXRULE.
|
||||
*
|
||||
* The RRULE property may look something like this:
|
||||
*
|
||||
* RRULE:FREQ=MONTHLY;BYDAY=1,2,3;BYHOUR=5.
|
||||
*
|
||||
* This property exposes this as a key=>value array that is accessible using
|
||||
* getParts, and may be set using setParts.
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
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) {
|
||||
|
||||
// If we're getting the data from json, we'll be receiving an object
|
||||
if ($value instanceof \StdClass) {
|
||||
$value = (array)$value;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
$newVal = array();
|
||||
foreach($value as $k=>$v) {
|
||||
|
||||
if (is_string($v)) {
|
||||
$v = strtoupper($v);
|
||||
|
||||
// The value had multiple sub-values
|
||||
if (strpos($v,',')!==false) {
|
||||
$v = explode(',', $v);
|
||||
}
|
||||
} else {
|
||||
$v = array_map('strtoupper', $v);
|
||||
}
|
||||
|
||||
$newVal[strtoupper($k)] = $v;
|
||||
}
|
||||
$this->value = $newVal;
|
||||
} elseif (is_string($value)) {
|
||||
$value = strtoupper($value);
|
||||
$newValue = array();
|
||||
foreach(explode(';', $value) as $part) {
|
||||
|
||||
// Skipping empty parts.
|
||||
if (empty($part)) {
|
||||
continue;
|
||||
}
|
||||
list($partName, $partValue) = explode('=', $part);
|
||||
|
||||
// The value itself had multiple values..
|
||||
if (strpos($partValue,',')!==false) {
|
||||
$partValue=explode(',', $partValue);
|
||||
}
|
||||
$newValue[$partName] = $partValue;
|
||||
|
||||
}
|
||||
$this->value = $newValue;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('You must either pass a string, or a key=>value array');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value.
|
||||
*
|
||||
* This method will always return a singular value. If this was a
|
||||
* multi-value object, some decision will be made first on how to represent
|
||||
* it as a string.
|
||||
*
|
||||
* To get the correct multi-value version, use getParts.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue() {
|
||||
|
||||
$out = array();
|
||||
foreach($this->value as $key=>$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) {
|
||||
|
||||
$this->setValue($parts);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a multi-valued property.
|
||||
*
|
||||
* This method always returns an array, if there was only a single value,
|
||||
* it will still be wrapped in an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getParts() {
|
||||
|
||||
return $this->value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a raw value coming from a mimedir (iCalendar/vCard) file.
|
||||
*
|
||||
* This has been 'unfolded', so only 1 line will be passed. Unescaping is
|
||||
* not yet done, but parameters are not included.
|
||||
*
|
||||
* @param string $val
|
||||
* @return void
|
||||
*/
|
||||
public function setRawMimeDirValue($val) {
|
||||
|
||||
$this->setValue($val);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a raw mime-dir representation of the value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawMimeDirValue() {
|
||||
|
||||
return $this->getValue();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of value.
|
||||
*
|
||||
* This corresponds to the VALUE= parameter. Every property also has a
|
||||
* 'default' valueType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueType() {
|
||||
|
||||
return "RECUR";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value, in the format it should be encoded for json.
|
||||
*
|
||||
* This method must always return an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJsonValue() {
|
||||
|
||||
$values = array();
|
||||
foreach($this->getParts() as $k=>$v) {
|
||||
$values[strtolower($k)] = $v;
|
||||
}
|
||||
return array($values);
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue