diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-11 05:54:20 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-11 05:54:20 -0400 |
commit | d968fc51eab8b0fb259ecbeae517056b99554017 (patch) | |
tree | 10e551cff9fefbefbfd7e5031b57320116bb7fce /vendor/sabre/vobject/lib/Sabre/VObject/Property/MultiDateTime.php | |
parent | c7698e4dc388b7d9a9db368672cb057c1d4d3a01 (diff) | |
parent | 4dd3839c41e18d9724855e7955d8737b6f52dcd6 (diff) | |
download | volse-hubzilla-d968fc51eab8b0fb259ecbeae517056b99554017.tar.gz volse-hubzilla-d968fc51eab8b0fb259ecbeae517056b99554017.tar.bz2 volse-hubzilla-d968fc51eab8b0fb259ecbeae517056b99554017.zip |
Merge remote-tracking branch 'upstream/dev' into plugin-repo
Diffstat (limited to 'vendor/sabre/vobject/lib/Sabre/VObject/Property/MultiDateTime.php')
-rw-r--r-- | vendor/sabre/vobject/lib/Sabre/VObject/Property/MultiDateTime.php | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/vendor/sabre/vobject/lib/Sabre/VObject/Property/MultiDateTime.php b/vendor/sabre/vobject/lib/Sabre/VObject/Property/MultiDateTime.php deleted file mode 100644 index f01491b66..000000000 --- a/vendor/sabre/vobject/lib/Sabre/VObject/Property/MultiDateTime.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -namespace Sabre\VObject\Property; - -use Sabre\VObject; - -/** - * Multi-DateTime property - * - * This element is used for iCalendar properties such as the EXDATE property. - * It basically provides a few helper functions that make it easier to deal - * with these. It supports both DATE-TIME and DATE values. - * - * In order to use this correctly, you must call setDateTimes and getDateTimes - * to retrieve and modify dates respectively. - * - * If you use the 'value' or properties directly, this object does not keep - * reference and results might appear incorrectly. - * - * @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/). - * @author Evert Pot (http://evertpot.com/) - * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License - */ -class MultiDateTime extends VObject\Property { - - /** - * DateTime representation - * - * @var DateTime[] - */ - protected $dateTimes; - - /** - * dateType - * - * This is one of the Sabre\VObject\Property\DateTime constants. - * - * @var int - */ - protected $dateType; - - /** - * Updates the value - * - * @param array $dt Must be an array of DateTime objects. - * @param int $dateType - * @return void - */ - public function setDateTimes(array $dt, $dateType = VObject\Property\DateTime::LOCALTZ) { - - foreach($dt as $i) - if (!$i instanceof \DateTime) - throw new \InvalidArgumentException('You must pass an array of DateTime objects'); - - $this->offsetUnset('VALUE'); - $this->offsetUnset('TZID'); - switch($dateType) { - - case DateTime::LOCAL : - $val = array(); - foreach($dt as $i) { - $val[] = $i->format('Ymd\\THis'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); - break; - case DateTime::UTC : - $val = array(); - foreach($dt as $i) { - $i->setTimeZone(new \DateTimeZone('UTC')); - $val[] = $i->format('Ymd\\THis\\Z'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); - break; - case DateTime::LOCALTZ : - $val = array(); - foreach($dt as $i) { - $val[] = $i->format('Ymd\\THis'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); - $this->offsetSet('TZID', $dt[0]->getTimeZone()->getName()); - break; - case DateTime::DATE : - $val = array(); - foreach($dt as $i) { - $val[] = $i->format('Ymd'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE'); - break; - default : - throw new \InvalidArgumentException('You must pass a valid dateType constant'); - - } - $this->dateTimes = $dt; - $this->dateType = $dateType; - - } - - /** - * Returns the current DateTime value. - * - * If no value was set, this method returns null. - * - * @return array|null - */ - public function getDateTimes() { - - if ($this->dateTimes) - return $this->dateTimes; - - $dts = array(); - - if (!$this->value) { - $this->dateTimes = null; - $this->dateType = null; - return null; - } - - foreach(explode(',',$this->value) as $val) { - list( - $type, - $dt - ) = DateTime::parseData($val, $this); - $dts[] = $dt; - $this->dateType = $type; - } - $this->dateTimes = $dts; - return $this->dateTimes; - - } - - /** - * Returns the type of Date format. - * - * This method returns one of the format constants. If no date was set, - * this method will return null. - * - * @return int|null - */ - public function getDateType() { - - if ($this->dateType) - return $this->dateType; - - if (!$this->value) { - $this->dateTimes = null; - $this->dateType = null; - return null; - } - - $dts = array(); - foreach(explode(',',$this->value) as $val) { - list( - $type, - $dt - ) = DateTime::parseData($val, $this); - $dts[] = $dt; - $this->dateType = $type; - } - $this->dateTimes = $dts; - return $this->dateType; - - } - - /** - * This method will return true, if the property had a date and a time, as - * opposed to only a date. - * - * @return bool - */ - public function hasTime() { - - return $this->getDateType()!==DateTime::DATE; - - } - -} |