@@ -23,68 +23,68 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class FreeBusyQueryReport implements XmlDeserializable |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * Starttime of report. |
|
| 28 | - * |
|
| 29 | - * @var \DateTime|null |
|
| 30 | - */ |
|
| 31 | - public $start; |
|
| 26 | + /** |
|
| 27 | + * Starttime of report. |
|
| 28 | + * |
|
| 29 | + * @var \DateTime|null |
|
| 30 | + */ |
|
| 31 | + public $start; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * End time of report. |
|
| 35 | - * |
|
| 36 | - * @var \DateTime|null |
|
| 37 | - */ |
|
| 38 | - public $end; |
|
| 33 | + /** |
|
| 34 | + * End time of report. |
|
| 35 | + * |
|
| 36 | + * @var \DateTime|null |
|
| 37 | + */ |
|
| 38 | + public $end; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * The deserialize method is called during xml parsing. |
|
| 42 | - * |
|
| 43 | - * This method is called statically, this is because in theory this method |
|
| 44 | - * may be used as a type of constructor, or factory method. |
|
| 45 | - * |
|
| 46 | - * Often you want to return an instance of the current class, but you are |
|
| 47 | - * free to return other data as well. |
|
| 48 | - * |
|
| 49 | - * You are responsible for advancing the reader to the next element. Not |
|
| 50 | - * doing anything will result in a never-ending loop. |
|
| 51 | - * |
|
| 52 | - * If you just want to skip parsing for this element altogether, you can |
|
| 53 | - * just call $reader->next(); |
|
| 54 | - * |
|
| 55 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 56 | - * the next element. |
|
| 57 | - * |
|
| 58 | - * @return mixed |
|
| 59 | - */ |
|
| 60 | - public static function xmlDeserialize(Reader $reader) |
|
| 61 | - { |
|
| 62 | - $timeRange = '{'.Plugin::NS_CALDAV.'}time-range'; |
|
| 40 | + /** |
|
| 41 | + * The deserialize method is called during xml parsing. |
|
| 42 | + * |
|
| 43 | + * This method is called statically, this is because in theory this method |
|
| 44 | + * may be used as a type of constructor, or factory method. |
|
| 45 | + * |
|
| 46 | + * Often you want to return an instance of the current class, but you are |
|
| 47 | + * free to return other data as well. |
|
| 48 | + * |
|
| 49 | + * You are responsible for advancing the reader to the next element. Not |
|
| 50 | + * doing anything will result in a never-ending loop. |
|
| 51 | + * |
|
| 52 | + * If you just want to skip parsing for this element altogether, you can |
|
| 53 | + * just call $reader->next(); |
|
| 54 | + * |
|
| 55 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 56 | + * the next element. |
|
| 57 | + * |
|
| 58 | + * @return mixed |
|
| 59 | + */ |
|
| 60 | + public static function xmlDeserialize(Reader $reader) |
|
| 61 | + { |
|
| 62 | + $timeRange = '{'.Plugin::NS_CALDAV.'}time-range'; |
|
| 63 | 63 | |
| 64 | - $start = null; |
|
| 65 | - $end = null; |
|
| 64 | + $start = null; |
|
| 65 | + $end = null; |
|
| 66 | 66 | |
| 67 | - foreach ((array) $reader->parseInnerTree([]) as $elem) { |
|
| 68 | - if ($elem['name'] !== $timeRange) { |
|
| 69 | - continue; |
|
| 70 | - } |
|
| 67 | + foreach ((array) $reader->parseInnerTree([]) as $elem) { |
|
| 68 | + if ($elem['name'] !== $timeRange) { |
|
| 69 | + continue; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start']; |
|
| 73 | - $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end']; |
|
| 74 | - } |
|
| 75 | - if (!$start && !$end) { |
|
| 76 | - throw new BadRequest('The freebusy report must have a time-range element'); |
|
| 77 | - } |
|
| 78 | - if ($start) { |
|
| 79 | - $start = DateTimeParser::parseDateTime($start); |
|
| 80 | - } |
|
| 81 | - if ($end) { |
|
| 82 | - $end = DateTimeParser::parseDateTime($end); |
|
| 83 | - } |
|
| 84 | - $result = new self(); |
|
| 85 | - $result->start = $start; |
|
| 86 | - $result->end = $end; |
|
| 72 | + $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start']; |
|
| 73 | + $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end']; |
|
| 74 | + } |
|
| 75 | + if (!$start && !$end) { |
|
| 76 | + throw new BadRequest('The freebusy report must have a time-range element'); |
|
| 77 | + } |
|
| 78 | + if ($start) { |
|
| 79 | + $start = DateTimeParser::parseDateTime($start); |
|
| 80 | + } |
|
| 81 | + if ($end) { |
|
| 82 | + $end = DateTimeParser::parseDateTime($end); |
|
| 83 | + } |
|
| 84 | + $result = new self(); |
|
| 85 | + $result->start = $start; |
|
| 86 | + $result->end = $end; |
|
| 87 | 87 | |
| 88 | - return $result; |
|
| 89 | - } |
|
| 88 | + return $result; |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -22,86 +22,86 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Share implements XmlDeserializable |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * The list of new people added or updated or removed from the share. |
|
| 27 | - * |
|
| 28 | - * @var Sharee[] |
|
| 29 | - */ |
|
| 30 | - public $sharees = []; |
|
| 25 | + /** |
|
| 26 | + * The list of new people added or updated or removed from the share. |
|
| 27 | + * |
|
| 28 | + * @var Sharee[] |
|
| 29 | + */ |
|
| 30 | + public $sharees = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Constructor. |
|
| 34 | - * |
|
| 35 | - * @param Sharee[] $sharees |
|
| 36 | - */ |
|
| 37 | - public function __construct(array $sharees) |
|
| 38 | - { |
|
| 39 | - $this->sharees = $sharees; |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * Constructor. |
|
| 34 | + * |
|
| 35 | + * @param Sharee[] $sharees |
|
| 36 | + */ |
|
| 37 | + public function __construct(array $sharees) |
|
| 38 | + { |
|
| 39 | + $this->sharees = $sharees; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * The deserialize method is called during xml parsing. |
|
| 44 | - * |
|
| 45 | - * This method is called statically, this is because in theory this method |
|
| 46 | - * may be used as a type of constructor, or factory method. |
|
| 47 | - * |
|
| 48 | - * Often you want to return an instance of the current class, but you are |
|
| 49 | - * free to return other data as well. |
|
| 50 | - * |
|
| 51 | - * You are responsible for advancing the reader to the next element. Not |
|
| 52 | - * doing anything will result in a never-ending loop. |
|
| 53 | - * |
|
| 54 | - * If you just want to skip parsing for this element altogether, you can |
|
| 55 | - * just call $reader->next(); |
|
| 56 | - * |
|
| 57 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 58 | - * the next element. |
|
| 59 | - * |
|
| 60 | - * @return mixed |
|
| 61 | - */ |
|
| 62 | - public static function xmlDeserialize(Reader $reader) |
|
| 63 | - { |
|
| 64 | - $elems = $reader->parseGetElements([ |
|
| 65 | - '{'.Plugin::NS_CALENDARSERVER.'}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 66 | - '{'.Plugin::NS_CALENDARSERVER.'}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 67 | - ]); |
|
| 42 | + /** |
|
| 43 | + * The deserialize method is called during xml parsing. |
|
| 44 | + * |
|
| 45 | + * This method is called statically, this is because in theory this method |
|
| 46 | + * may be used as a type of constructor, or factory method. |
|
| 47 | + * |
|
| 48 | + * Often you want to return an instance of the current class, but you are |
|
| 49 | + * free to return other data as well. |
|
| 50 | + * |
|
| 51 | + * You are responsible for advancing the reader to the next element. Not |
|
| 52 | + * doing anything will result in a never-ending loop. |
|
| 53 | + * |
|
| 54 | + * If you just want to skip parsing for this element altogether, you can |
|
| 55 | + * just call $reader->next(); |
|
| 56 | + * |
|
| 57 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 58 | + * the next element. |
|
| 59 | + * |
|
| 60 | + * @return mixed |
|
| 61 | + */ |
|
| 62 | + public static function xmlDeserialize(Reader $reader) |
|
| 63 | + { |
|
| 64 | + $elems = $reader->parseGetElements([ |
|
| 65 | + '{'.Plugin::NS_CALENDARSERVER.'}set' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 66 | + '{'.Plugin::NS_CALENDARSERVER.'}remove' => 'Sabre\\Xml\\Element\\KeyValue', |
|
| 67 | + ]); |
|
| 68 | 68 | |
| 69 | - $sharees = []; |
|
| 69 | + $sharees = []; |
|
| 70 | 70 | |
| 71 | - foreach ($elems as $elem) { |
|
| 72 | - switch ($elem['name']) { |
|
| 73 | - case '{'.Plugin::NS_CALENDARSERVER.'}set': |
|
| 74 | - $sharee = $elem['value']; |
|
| 71 | + foreach ($elems as $elem) { |
|
| 72 | + switch ($elem['name']) { |
|
| 73 | + case '{'.Plugin::NS_CALENDARSERVER.'}set': |
|
| 74 | + $sharee = $elem['value']; |
|
| 75 | 75 | |
| 76 | - $sumElem = '{'.Plugin::NS_CALENDARSERVER.'}summary'; |
|
| 77 | - $commonName = '{'.Plugin::NS_CALENDARSERVER.'}common-name'; |
|
| 76 | + $sumElem = '{'.Plugin::NS_CALENDARSERVER.'}summary'; |
|
| 77 | + $commonName = '{'.Plugin::NS_CALENDARSERVER.'}common-name'; |
|
| 78 | 78 | |
| 79 | - $properties = []; |
|
| 80 | - if (isset($sharee[$commonName])) { |
|
| 81 | - $properties['{DAV:}displayname'] = $sharee[$commonName]; |
|
| 82 | - } |
|
| 79 | + $properties = []; |
|
| 80 | + if (isset($sharee[$commonName])) { |
|
| 81 | + $properties['{DAV:}displayname'] = $sharee[$commonName]; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - $access = array_key_exists('{'.Plugin::NS_CALENDARSERVER.'}read-write', $sharee) |
|
| 85 | - ? \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE |
|
| 86 | - : \Sabre\DAV\Sharing\Plugin::ACCESS_READ; |
|
| 84 | + $access = array_key_exists('{'.Plugin::NS_CALENDARSERVER.'}read-write', $sharee) |
|
| 85 | + ? \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE |
|
| 86 | + : \Sabre\DAV\Sharing\Plugin::ACCESS_READ; |
|
| 87 | 87 | |
| 88 | - $sharees[] = new Sharee([ |
|
| 89 | - 'href' => $sharee['{DAV:}href'], |
|
| 90 | - 'properties' => $properties, |
|
| 91 | - 'access' => $access, |
|
| 92 | - 'comment' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, |
|
| 93 | - ]); |
|
| 94 | - break; |
|
| 88 | + $sharees[] = new Sharee([ |
|
| 89 | + 'href' => $sharee['{DAV:}href'], |
|
| 90 | + 'properties' => $properties, |
|
| 91 | + 'access' => $access, |
|
| 92 | + 'comment' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, |
|
| 93 | + ]); |
|
| 94 | + break; |
|
| 95 | 95 | |
| 96 | - case '{'.Plugin::NS_CALENDARSERVER.'}remove': |
|
| 97 | - $sharees[] = new Sharee([ |
|
| 98 | - 'href' => $elem['value']['{DAV:}href'], |
|
| 99 | - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, |
|
| 100 | - ]); |
|
| 101 | - break; |
|
| 102 | - } |
|
| 103 | - } |
|
| 96 | + case '{'.Plugin::NS_CALENDARSERVER.'}remove': |
|
| 97 | + $sharees[] = new Sharee([ |
|
| 98 | + 'href' => $elem['value']['{DAV:}href'], |
|
| 99 | + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, |
|
| 100 | + ]); |
|
| 101 | + break; |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - return new self($sharees); |
|
| 106 | - } |
|
| 105 | + return new self($sharees); |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -20,58 +20,58 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class MkCalendar implements XmlDeserializable |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * The list of properties that will be set. |
|
| 25 | - * |
|
| 26 | - * @var array |
|
| 27 | - */ |
|
| 28 | - public $properties = []; |
|
| 23 | + /** |
|
| 24 | + * The list of properties that will be set. |
|
| 25 | + * |
|
| 26 | + * @var array |
|
| 27 | + */ |
|
| 28 | + public $properties = []; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Returns the list of properties the calendar will be initialized with. |
|
| 32 | - * |
|
| 33 | - * @return array |
|
| 34 | - */ |
|
| 35 | - public function getProperties() |
|
| 36 | - { |
|
| 37 | - return $this->properties; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Returns the list of properties the calendar will be initialized with. |
|
| 32 | + * |
|
| 33 | + * @return array |
|
| 34 | + */ |
|
| 35 | + public function getProperties() |
|
| 36 | + { |
|
| 37 | + return $this->properties; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * The deserialize method is called during xml parsing. |
|
| 42 | - * |
|
| 43 | - * This method is called statically, this is because in theory this method |
|
| 44 | - * may be used as a type of constructor, or factory method. |
|
| 45 | - * |
|
| 46 | - * Often you want to return an instance of the current class, but you are |
|
| 47 | - * free to return other data as well. |
|
| 48 | - * |
|
| 49 | - * You are responsible for advancing the reader to the next element. Not |
|
| 50 | - * doing anything will result in a never-ending loop. |
|
| 51 | - * |
|
| 52 | - * If you just want to skip parsing for this element altogether, you can |
|
| 53 | - * just call $reader->next(); |
|
| 54 | - * |
|
| 55 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 56 | - * the next element. |
|
| 57 | - * |
|
| 58 | - * @return mixed |
|
| 59 | - */ |
|
| 60 | - public static function xmlDeserialize(Reader $reader) |
|
| 61 | - { |
|
| 62 | - $self = new self(); |
|
| 40 | + /** |
|
| 41 | + * The deserialize method is called during xml parsing. |
|
| 42 | + * |
|
| 43 | + * This method is called statically, this is because in theory this method |
|
| 44 | + * may be used as a type of constructor, or factory method. |
|
| 45 | + * |
|
| 46 | + * Often you want to return an instance of the current class, but you are |
|
| 47 | + * free to return other data as well. |
|
| 48 | + * |
|
| 49 | + * You are responsible for advancing the reader to the next element. Not |
|
| 50 | + * doing anything will result in a never-ending loop. |
|
| 51 | + * |
|
| 52 | + * If you just want to skip parsing for this element altogether, you can |
|
| 53 | + * just call $reader->next(); |
|
| 54 | + * |
|
| 55 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 56 | + * the next element. |
|
| 57 | + * |
|
| 58 | + * @return mixed |
|
| 59 | + */ |
|
| 60 | + public static function xmlDeserialize(Reader $reader) |
|
| 61 | + { |
|
| 62 | + $self = new self(); |
|
| 63 | 63 | |
| 64 | - $elementMap = $reader->elementMap; |
|
| 65 | - $elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop'; |
|
| 66 | - $elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue'; |
|
| 67 | - $elems = $reader->parseInnerTree($elementMap); |
|
| 64 | + $elementMap = $reader->elementMap; |
|
| 65 | + $elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop'; |
|
| 66 | + $elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue'; |
|
| 67 | + $elems = $reader->parseInnerTree($elementMap); |
|
| 68 | 68 | |
| 69 | - foreach ($elems as $elem) { |
|
| 70 | - if ('{DAV:}set' === $elem['name']) { |
|
| 71 | - $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); |
|
| 72 | - } |
|
| 73 | - } |
|
| 69 | + foreach ($elems as $elem) { |
|
| 70 | + if ('{DAV:}set' === $elem['name']) { |
|
| 71 | + $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $self; |
|
| 76 | - } |
|
| 75 | + return $self; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -24,56 +24,56 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class ParamFilter implements XmlDeserializable |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * The deserialize method is called during xml parsing. |
|
| 29 | - * |
|
| 30 | - * This method is called statically, this is because in theory this method |
|
| 31 | - * may be used as a type of constructor, or factory method. |
|
| 32 | - * |
|
| 33 | - * Often you want to return an instance of the current class, but you are |
|
| 34 | - * free to return other data as well. |
|
| 35 | - * |
|
| 36 | - * Important note 2: You are responsible for advancing the reader to the |
|
| 37 | - * next element. Not doing anything will result in a never-ending loop. |
|
| 38 | - * |
|
| 39 | - * If you just want to skip parsing for this element altogether, you can |
|
| 40 | - * just call $reader->next(); |
|
| 41 | - * |
|
| 42 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 43 | - * the next element. |
|
| 44 | - * |
|
| 45 | - * @return mixed |
|
| 46 | - */ |
|
| 47 | - public static function xmlDeserialize(Reader $reader) |
|
| 48 | - { |
|
| 49 | - $result = [ |
|
| 50 | - 'name' => null, |
|
| 51 | - 'is-not-defined' => false, |
|
| 52 | - 'text-match' => null, |
|
| 53 | - ]; |
|
| 27 | + /** |
|
| 28 | + * The deserialize method is called during xml parsing. |
|
| 29 | + * |
|
| 30 | + * This method is called statically, this is because in theory this method |
|
| 31 | + * may be used as a type of constructor, or factory method. |
|
| 32 | + * |
|
| 33 | + * Often you want to return an instance of the current class, but you are |
|
| 34 | + * free to return other data as well. |
|
| 35 | + * |
|
| 36 | + * Important note 2: You are responsible for advancing the reader to the |
|
| 37 | + * next element. Not doing anything will result in a never-ending loop. |
|
| 38 | + * |
|
| 39 | + * If you just want to skip parsing for this element altogether, you can |
|
| 40 | + * just call $reader->next(); |
|
| 41 | + * |
|
| 42 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 43 | + * the next element. |
|
| 44 | + * |
|
| 45 | + * @return mixed |
|
| 46 | + */ |
|
| 47 | + public static function xmlDeserialize(Reader $reader) |
|
| 48 | + { |
|
| 49 | + $result = [ |
|
| 50 | + 'name' => null, |
|
| 51 | + 'is-not-defined' => false, |
|
| 52 | + 'text-match' => null, |
|
| 53 | + ]; |
|
| 54 | 54 | |
| 55 | - $att = $reader->parseAttributes(); |
|
| 56 | - $result['name'] = $att['name']; |
|
| 55 | + $att = $reader->parseAttributes(); |
|
| 56 | + $result['name'] = $att['name']; |
|
| 57 | 57 | |
| 58 | - $elems = $reader->parseInnerTree(); |
|
| 58 | + $elems = $reader->parseInnerTree(); |
|
| 59 | 59 | |
| 60 | - if (is_array($elems)) { |
|
| 61 | - foreach ($elems as $elem) { |
|
| 62 | - switch ($elem['name']) { |
|
| 63 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 64 | - $result['is-not-defined'] = true; |
|
| 65 | - break; |
|
| 66 | - case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 67 | - $result['text-match'] = [ |
|
| 68 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 69 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 70 | - 'value' => $elem['value'], |
|
| 71 | - ]; |
|
| 72 | - break; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - } |
|
| 60 | + if (is_array($elems)) { |
|
| 61 | + foreach ($elems as $elem) { |
|
| 62 | + switch ($elem['name']) { |
|
| 63 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 64 | + $result['is-not-defined'] = true; |
|
| 65 | + break; |
|
| 66 | + case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 67 | + $result['text-match'] = [ |
|
| 68 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 69 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 70 | + 'value' => $elem['value'], |
|
| 71 | + ]; |
|
| 72 | + break; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - return $result; |
|
| 78 | - } |
|
| 77 | + return $result; |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -60,16 +60,16 @@ |
||
| 60 | 60 | if (is_array($elems)) { |
| 61 | 61 | foreach ($elems as $elem) { |
| 62 | 62 | switch ($elem['name']) { |
| 63 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 64 | - $result['is-not-defined'] = true; |
|
| 65 | - break; |
|
| 66 | - case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 67 | - $result['text-match'] = [ |
|
| 68 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 69 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 70 | - 'value' => $elem['value'], |
|
| 71 | - ]; |
|
| 72 | - break; |
|
| 63 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 64 | + $result['is-not-defined'] = true; |
|
| 65 | + break; |
|
| 66 | + case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 67 | + $result['text-match'] = [ |
|
| 68 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 69 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 70 | + 'value' => $elem['value'], |
|
| 71 | + ]; |
|
| 72 | + break; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -26,69 +26,69 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class CompFilter implements XmlDeserializable |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * The deserialize method is called during xml parsing. |
|
| 31 | - * |
|
| 32 | - * This method is called statically, this is because in theory this method |
|
| 33 | - * may be used as a type of constructor, or factory method. |
|
| 34 | - * |
|
| 35 | - * Often you want to return an instance of the current class, but you are |
|
| 36 | - * free to return other data as well. |
|
| 37 | - * |
|
| 38 | - * You are responsible for advancing the reader to the next element. Not |
|
| 39 | - * doing anything will result in a never-ending loop. |
|
| 40 | - * |
|
| 41 | - * If you just want to skip parsing for this element altogether, you can |
|
| 42 | - * just call $reader->next(); |
|
| 43 | - * |
|
| 44 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 45 | - * the next element. |
|
| 46 | - * |
|
| 47 | - * @return mixed |
|
| 48 | - */ |
|
| 49 | - public static function xmlDeserialize(Reader $reader) |
|
| 50 | - { |
|
| 51 | - $result = [ |
|
| 52 | - 'name' => null, |
|
| 53 | - 'is-not-defined' => false, |
|
| 54 | - 'comp-filters' => [], |
|
| 55 | - 'prop-filters' => [], |
|
| 56 | - 'time-range' => false, |
|
| 57 | - ]; |
|
| 29 | + /** |
|
| 30 | + * The deserialize method is called during xml parsing. |
|
| 31 | + * |
|
| 32 | + * This method is called statically, this is because in theory this method |
|
| 33 | + * may be used as a type of constructor, or factory method. |
|
| 34 | + * |
|
| 35 | + * Often you want to return an instance of the current class, but you are |
|
| 36 | + * free to return other data as well. |
|
| 37 | + * |
|
| 38 | + * You are responsible for advancing the reader to the next element. Not |
|
| 39 | + * doing anything will result in a never-ending loop. |
|
| 40 | + * |
|
| 41 | + * If you just want to skip parsing for this element altogether, you can |
|
| 42 | + * just call $reader->next(); |
|
| 43 | + * |
|
| 44 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 45 | + * the next element. |
|
| 46 | + * |
|
| 47 | + * @return mixed |
|
| 48 | + */ |
|
| 49 | + public static function xmlDeserialize(Reader $reader) |
|
| 50 | + { |
|
| 51 | + $result = [ |
|
| 52 | + 'name' => null, |
|
| 53 | + 'is-not-defined' => false, |
|
| 54 | + 'comp-filters' => [], |
|
| 55 | + 'prop-filters' => [], |
|
| 56 | + 'time-range' => false, |
|
| 57 | + ]; |
|
| 58 | 58 | |
| 59 | - $att = $reader->parseAttributes(); |
|
| 60 | - $result['name'] = $att['name']; |
|
| 59 | + $att = $reader->parseAttributes(); |
|
| 60 | + $result['name'] = $att['name']; |
|
| 61 | 61 | |
| 62 | - $elems = $reader->parseInnerTree(); |
|
| 62 | + $elems = $reader->parseInnerTree(); |
|
| 63 | 63 | |
| 64 | - if (is_array($elems)) { |
|
| 65 | - foreach ($elems as $elem) { |
|
| 66 | - switch ($elem['name']) { |
|
| 67 | - case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
| 68 | - $result['comp-filters'][] = $elem['value']; |
|
| 69 | - break; |
|
| 70 | - case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
| 71 | - $result['prop-filters'][] = $elem['value']; |
|
| 72 | - break; |
|
| 73 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 74 | - $result['is-not-defined'] = true; |
|
| 75 | - break; |
|
| 76 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 77 | - if ('VCALENDAR' === $result['name']) { |
|
| 78 | - throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
| 79 | - } |
|
| 80 | - $result['time-range'] = [ |
|
| 81 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 82 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 83 | - ]; |
|
| 84 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 85 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 86 | - } |
|
| 87 | - break; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 64 | + if (is_array($elems)) { |
|
| 65 | + foreach ($elems as $elem) { |
|
| 66 | + switch ($elem['name']) { |
|
| 67 | + case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
| 68 | + $result['comp-filters'][] = $elem['value']; |
|
| 69 | + break; |
|
| 70 | + case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
| 71 | + $result['prop-filters'][] = $elem['value']; |
|
| 72 | + break; |
|
| 73 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 74 | + $result['is-not-defined'] = true; |
|
| 75 | + break; |
|
| 76 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 77 | + if ('VCALENDAR' === $result['name']) { |
|
| 78 | + throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
| 79 | + } |
|
| 80 | + $result['time-range'] = [ |
|
| 81 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 82 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 83 | + ]; |
|
| 84 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 85 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 86 | + } |
|
| 87 | + break; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return $result; |
|
| 93 | - } |
|
| 92 | + return $result; |
|
| 93 | + } |
|
| 94 | 94 | } |
@@ -64,27 +64,27 @@ |
||
| 64 | 64 | if (is_array($elems)) { |
| 65 | 65 | foreach ($elems as $elem) { |
| 66 | 66 | switch ($elem['name']) { |
| 67 | - case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
| 68 | - $result['comp-filters'][] = $elem['value']; |
|
| 69 | - break; |
|
| 70 | - case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
| 71 | - $result['prop-filters'][] = $elem['value']; |
|
| 72 | - break; |
|
| 73 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 74 | - $result['is-not-defined'] = true; |
|
| 75 | - break; |
|
| 76 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 77 | - if ('VCALENDAR' === $result['name']) { |
|
| 78 | - throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
| 79 | - } |
|
| 80 | - $result['time-range'] = [ |
|
| 81 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 82 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 83 | - ]; |
|
| 84 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 85 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 86 | - } |
|
| 87 | - break; |
|
| 67 | + case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
| 68 | + $result['comp-filters'][] = $elem['value']; |
|
| 69 | + break; |
|
| 70 | + case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
| 71 | + $result['prop-filters'][] = $elem['value']; |
|
| 72 | + break; |
|
| 73 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 74 | + $result['is-not-defined'] = true; |
|
| 75 | + break; |
|
| 76 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 77 | + if ('VCALENDAR' === $result['name']) { |
|
| 78 | + throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
| 79 | + } |
|
| 80 | + $result['time-range'] = [ |
|
| 81 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 82 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 83 | + ]; |
|
| 84 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 85 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 86 | + } |
|
| 87 | + break; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -64,28 +64,28 @@ |
||
| 64 | 64 | if (is_array($elems)) { |
| 65 | 65 | foreach ($elems as $elem) { |
| 66 | 66 | switch ($elem['name']) { |
| 67 | - case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
| 68 | - $result['param-filters'][] = $elem['value']; |
|
| 69 | - break; |
|
| 70 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 71 | - $result['is-not-defined'] = true; |
|
| 72 | - break; |
|
| 73 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 74 | - $result['time-range'] = [ |
|
| 75 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 76 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 77 | - ]; |
|
| 78 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 79 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 80 | - } |
|
| 81 | - break; |
|
| 82 | - case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 83 | - $result['text-match'] = [ |
|
| 84 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 85 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 86 | - 'value' => $elem['value'], |
|
| 87 | - ]; |
|
| 88 | - break; |
|
| 67 | + case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
| 68 | + $result['param-filters'][] = $elem['value']; |
|
| 69 | + break; |
|
| 70 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 71 | + $result['is-not-defined'] = true; |
|
| 72 | + break; |
|
| 73 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 74 | + $result['time-range'] = [ |
|
| 75 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 76 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 77 | + ]; |
|
| 78 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 79 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 80 | + } |
|
| 81 | + break; |
|
| 82 | + case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 83 | + $result['text-match'] = [ |
|
| 84 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 85 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 86 | + 'value' => $elem['value'], |
|
| 87 | + ]; |
|
| 88 | + break; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -26,70 +26,70 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class PropFilter implements XmlDeserializable |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * The deserialize method is called during xml parsing. |
|
| 31 | - * |
|
| 32 | - * This method is called statically, this is because in theory this method |
|
| 33 | - * may be used as a type of constructor, or factory method. |
|
| 34 | - * |
|
| 35 | - * Often you want to return an instance of the current class, but you are |
|
| 36 | - * free to return other data as well. |
|
| 37 | - * |
|
| 38 | - * You are responsible for advancing the reader to the next element. Not |
|
| 39 | - * doing anything will result in a never-ending loop. |
|
| 40 | - * |
|
| 41 | - * If you just want to skip parsing for this element altogether, you can |
|
| 42 | - * just call $reader->next(); |
|
| 43 | - * |
|
| 44 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 45 | - * the next element. |
|
| 46 | - * |
|
| 47 | - * @return mixed |
|
| 48 | - */ |
|
| 49 | - public static function xmlDeserialize(Reader $reader) |
|
| 50 | - { |
|
| 51 | - $result = [ |
|
| 52 | - 'name' => null, |
|
| 53 | - 'is-not-defined' => false, |
|
| 54 | - 'param-filters' => [], |
|
| 55 | - 'text-match' => null, |
|
| 56 | - 'time-range' => [], |
|
| 57 | - ]; |
|
| 29 | + /** |
|
| 30 | + * The deserialize method is called during xml parsing. |
|
| 31 | + * |
|
| 32 | + * This method is called statically, this is because in theory this method |
|
| 33 | + * may be used as a type of constructor, or factory method. |
|
| 34 | + * |
|
| 35 | + * Often you want to return an instance of the current class, but you are |
|
| 36 | + * free to return other data as well. |
|
| 37 | + * |
|
| 38 | + * You are responsible for advancing the reader to the next element. Not |
|
| 39 | + * doing anything will result in a never-ending loop. |
|
| 40 | + * |
|
| 41 | + * If you just want to skip parsing for this element altogether, you can |
|
| 42 | + * just call $reader->next(); |
|
| 43 | + * |
|
| 44 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 45 | + * the next element. |
|
| 46 | + * |
|
| 47 | + * @return mixed |
|
| 48 | + */ |
|
| 49 | + public static function xmlDeserialize(Reader $reader) |
|
| 50 | + { |
|
| 51 | + $result = [ |
|
| 52 | + 'name' => null, |
|
| 53 | + 'is-not-defined' => false, |
|
| 54 | + 'param-filters' => [], |
|
| 55 | + 'text-match' => null, |
|
| 56 | + 'time-range' => [], |
|
| 57 | + ]; |
|
| 58 | 58 | |
| 59 | - $att = $reader->parseAttributes(); |
|
| 60 | - $result['name'] = $att['name']; |
|
| 59 | + $att = $reader->parseAttributes(); |
|
| 60 | + $result['name'] = $att['name']; |
|
| 61 | 61 | |
| 62 | - $elems = $reader->parseInnerTree(); |
|
| 62 | + $elems = $reader->parseInnerTree(); |
|
| 63 | 63 | |
| 64 | - if (is_array($elems)) { |
|
| 65 | - foreach ($elems as $elem) { |
|
| 66 | - switch ($elem['name']) { |
|
| 67 | - case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
| 68 | - $result['param-filters'][] = $elem['value']; |
|
| 69 | - break; |
|
| 70 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 71 | - $result['is-not-defined'] = true; |
|
| 72 | - break; |
|
| 73 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 74 | - $result['time-range'] = [ |
|
| 75 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 76 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 77 | - ]; |
|
| 78 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 79 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 80 | - } |
|
| 81 | - break; |
|
| 82 | - case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 83 | - $result['text-match'] = [ |
|
| 84 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 85 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 86 | - 'value' => $elem['value'], |
|
| 87 | - ]; |
|
| 88 | - break; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } |
|
| 64 | + if (is_array($elems)) { |
|
| 65 | + foreach ($elems as $elem) { |
|
| 66 | + switch ($elem['name']) { |
|
| 67 | + case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
| 68 | + $result['param-filters'][] = $elem['value']; |
|
| 69 | + break; |
|
| 70 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
| 71 | + $result['is-not-defined'] = true; |
|
| 72 | + break; |
|
| 73 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
| 74 | + $result['time-range'] = [ |
|
| 75 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 76 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 77 | + ]; |
|
| 78 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
| 79 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
| 80 | + } |
|
| 81 | + break; |
|
| 82 | + case '{'.Plugin::NS_CALDAV.'}text-match': |
|
| 83 | + $result['text-match'] = [ |
|
| 84 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
| 85 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
| 86 | + 'value' => $elem['value'], |
|
| 87 | + ]; |
|
| 88 | + break; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - return $result; |
|
| 94 | - } |
|
| 93 | + return $result; |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -29,52 +29,52 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class CalendarData implements XmlDeserializable |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * The deserialize method is called during xml parsing. |
|
| 34 | - * |
|
| 35 | - * This method is called statically, this is because in theory this method |
|
| 36 | - * may be used as a type of constructor, or factory method. |
|
| 37 | - * |
|
| 38 | - * Often you want to return an instance of the current class, but you are |
|
| 39 | - * free to return other data as well. |
|
| 40 | - * |
|
| 41 | - * You are responsible for advancing the reader to the next element. Not |
|
| 42 | - * doing anything will result in a never-ending loop. |
|
| 43 | - * |
|
| 44 | - * If you just want to skip parsing for this element altogether, you can |
|
| 45 | - * just call $reader->next(); |
|
| 46 | - * |
|
| 47 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 48 | - * the next element. |
|
| 49 | - * |
|
| 50 | - * @return mixed |
|
| 51 | - */ |
|
| 52 | - public static function xmlDeserialize(Reader $reader) |
|
| 53 | - { |
|
| 54 | - $result = [ |
|
| 55 | - 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar', |
|
| 56 | - 'version' => $reader->getAttribute('version') ?: '2.0', |
|
| 57 | - ]; |
|
| 32 | + /** |
|
| 33 | + * The deserialize method is called during xml parsing. |
|
| 34 | + * |
|
| 35 | + * This method is called statically, this is because in theory this method |
|
| 36 | + * may be used as a type of constructor, or factory method. |
|
| 37 | + * |
|
| 38 | + * Often you want to return an instance of the current class, but you are |
|
| 39 | + * free to return other data as well. |
|
| 40 | + * |
|
| 41 | + * You are responsible for advancing the reader to the next element. Not |
|
| 42 | + * doing anything will result in a never-ending loop. |
|
| 43 | + * |
|
| 44 | + * If you just want to skip parsing for this element altogether, you can |
|
| 45 | + * just call $reader->next(); |
|
| 46 | + * |
|
| 47 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 48 | + * the next element. |
|
| 49 | + * |
|
| 50 | + * @return mixed |
|
| 51 | + */ |
|
| 52 | + public static function xmlDeserialize(Reader $reader) |
|
| 53 | + { |
|
| 54 | + $result = [ |
|
| 55 | + 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar', |
|
| 56 | + 'version' => $reader->getAttribute('version') ?: '2.0', |
|
| 57 | + ]; |
|
| 58 | 58 | |
| 59 | - $elems = (array) $reader->parseInnerTree(); |
|
| 60 | - foreach ($elems as $elem) { |
|
| 61 | - switch ($elem['name']) { |
|
| 62 | - case '{'.Plugin::NS_CALDAV.'}expand': |
|
| 63 | - $result['expand'] = [ |
|
| 64 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 65 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 66 | - ]; |
|
| 59 | + $elems = (array) $reader->parseInnerTree(); |
|
| 60 | + foreach ($elems as $elem) { |
|
| 61 | + switch ($elem['name']) { |
|
| 62 | + case '{'.Plugin::NS_CALDAV.'}expand': |
|
| 63 | + $result['expand'] = [ |
|
| 64 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 65 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 66 | + ]; |
|
| 67 | 67 | |
| 68 | - if (!$result['expand']['start'] || !$result['expand']['end']) { |
|
| 69 | - throw new BadRequest('The "start" and "end" attributes are required when expanding calendar-data'); |
|
| 70 | - } |
|
| 71 | - if ($result['expand']['end'] <= $result['expand']['start']) { |
|
| 72 | - throw new BadRequest('The end-date must be larger than the start-date when expanding calendar-data'); |
|
| 73 | - } |
|
| 74 | - break; |
|
| 75 | - } |
|
| 76 | - } |
|
| 68 | + if (!$result['expand']['start'] || !$result['expand']['end']) { |
|
| 69 | + throw new BadRequest('The "start" and "end" attributes are required when expanding calendar-data'); |
|
| 70 | + } |
|
| 71 | + if ($result['expand']['end'] <= $result['expand']['start']) { |
|
| 72 | + throw new BadRequest('The end-date must be larger than the start-date when expanding calendar-data'); |
|
| 73 | + } |
|
| 74 | + break; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - return $result; |
|
| 79 | - } |
|
| 78 | + return $result; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -25,96 +25,96 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Invite implements XmlSerializable |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * The list of users a calendar has been shared to. |
|
| 30 | - * |
|
| 31 | - * @var Sharee[] |
|
| 32 | - */ |
|
| 33 | - protected $sharees; |
|
| 28 | + /** |
|
| 29 | + * The list of users a calendar has been shared to. |
|
| 30 | + * |
|
| 31 | + * @var Sharee[] |
|
| 32 | + */ |
|
| 33 | + protected $sharees; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Creates the property. |
|
| 37 | - * |
|
| 38 | - * @param Sharee[] $sharees |
|
| 39 | - */ |
|
| 40 | - public function __construct(array $sharees) |
|
| 41 | - { |
|
| 42 | - $this->sharees = $sharees; |
|
| 43 | - } |
|
| 35 | + /** |
|
| 36 | + * Creates the property. |
|
| 37 | + * |
|
| 38 | + * @param Sharee[] $sharees |
|
| 39 | + */ |
|
| 40 | + public function __construct(array $sharees) |
|
| 41 | + { |
|
| 42 | + $this->sharees = $sharees; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns the list of users, as it was passed to the constructor. |
|
| 47 | - * |
|
| 48 | - * @return array |
|
| 49 | - */ |
|
| 50 | - public function getValue() |
|
| 51 | - { |
|
| 52 | - return $this->sharees; |
|
| 53 | - } |
|
| 45 | + /** |
|
| 46 | + * Returns the list of users, as it was passed to the constructor. |
|
| 47 | + * |
|
| 48 | + * @return array |
|
| 49 | + */ |
|
| 50 | + public function getValue() |
|
| 51 | + { |
|
| 52 | + return $this->sharees; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * The xmlSerialize method is called during xml writing. |
|
| 57 | - * |
|
| 58 | - * Use the $writer argument to write its own xml serialization. |
|
| 59 | - * |
|
| 60 | - * An important note: do _not_ create a parent element. Any element |
|
| 61 | - * implementing XmlSerializable should only ever write what's considered |
|
| 62 | - * its 'inner xml'. |
|
| 63 | - * |
|
| 64 | - * The parent of the current element is responsible for writing a |
|
| 65 | - * containing element. |
|
| 66 | - * |
|
| 67 | - * This allows serializers to be re-used for different element names. |
|
| 68 | - * |
|
| 69 | - * If you are opening new elements, you must also close them again. |
|
| 70 | - */ |
|
| 71 | - public function xmlSerialize(Writer $writer) |
|
| 72 | - { |
|
| 73 | - $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; |
|
| 55 | + /** |
|
| 56 | + * The xmlSerialize method is called during xml writing. |
|
| 57 | + * |
|
| 58 | + * Use the $writer argument to write its own xml serialization. |
|
| 59 | + * |
|
| 60 | + * An important note: do _not_ create a parent element. Any element |
|
| 61 | + * implementing XmlSerializable should only ever write what's considered |
|
| 62 | + * its 'inner xml'. |
|
| 63 | + * |
|
| 64 | + * The parent of the current element is responsible for writing a |
|
| 65 | + * containing element. |
|
| 66 | + * |
|
| 67 | + * This allows serializers to be re-used for different element names. |
|
| 68 | + * |
|
| 69 | + * If you are opening new elements, you must also close them again. |
|
| 70 | + */ |
|
| 71 | + public function xmlSerialize(Writer $writer) |
|
| 72 | + { |
|
| 73 | + $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; |
|
| 74 | 74 | |
| 75 | - foreach ($this->sharees as $sharee) { |
|
| 76 | - if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) { |
|
| 77 | - $writer->startElement($cs.'organizer'); |
|
| 78 | - } else { |
|
| 79 | - $writer->startElement($cs.'user'); |
|
| 75 | + foreach ($this->sharees as $sharee) { |
|
| 76 | + if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) { |
|
| 77 | + $writer->startElement($cs.'organizer'); |
|
| 78 | + } else { |
|
| 79 | + $writer->startElement($cs.'user'); |
|
| 80 | 80 | |
| 81 | - switch ($sharee->inviteStatus) { |
|
| 82 | - case DAV\Sharing\Plugin::INVITE_ACCEPTED: |
|
| 83 | - $writer->writeElement($cs.'invite-accepted'); |
|
| 84 | - break; |
|
| 85 | - case DAV\Sharing\Plugin::INVITE_DECLINED: |
|
| 86 | - $writer->writeElement($cs.'invite-declined'); |
|
| 87 | - break; |
|
| 88 | - case DAV\Sharing\Plugin::INVITE_NORESPONSE: |
|
| 89 | - $writer->writeElement($cs.'invite-noresponse'); |
|
| 90 | - break; |
|
| 91 | - case DAV\Sharing\Plugin::INVITE_INVALID: |
|
| 92 | - $writer->writeElement($cs.'invite-invalid'); |
|
| 93 | - break; |
|
| 94 | - } |
|
| 81 | + switch ($sharee->inviteStatus) { |
|
| 82 | + case DAV\Sharing\Plugin::INVITE_ACCEPTED: |
|
| 83 | + $writer->writeElement($cs.'invite-accepted'); |
|
| 84 | + break; |
|
| 85 | + case DAV\Sharing\Plugin::INVITE_DECLINED: |
|
| 86 | + $writer->writeElement($cs.'invite-declined'); |
|
| 87 | + break; |
|
| 88 | + case DAV\Sharing\Plugin::INVITE_NORESPONSE: |
|
| 89 | + $writer->writeElement($cs.'invite-noresponse'); |
|
| 90 | + break; |
|
| 91 | + case DAV\Sharing\Plugin::INVITE_INVALID: |
|
| 92 | + $writer->writeElement($cs.'invite-invalid'); |
|
| 93 | + break; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - $writer->startElement($cs.'access'); |
|
| 97 | - switch ($sharee->access) { |
|
| 98 | - case DAV\Sharing\Plugin::ACCESS_READWRITE: |
|
| 99 | - $writer->writeElement($cs.'read-write'); |
|
| 100 | - break; |
|
| 101 | - case DAV\Sharing\Plugin::ACCESS_READ: |
|
| 102 | - $writer->writeElement($cs.'read'); |
|
| 103 | - break; |
|
| 104 | - } |
|
| 105 | - $writer->endElement(); // access |
|
| 106 | - } |
|
| 96 | + $writer->startElement($cs.'access'); |
|
| 97 | + switch ($sharee->access) { |
|
| 98 | + case DAV\Sharing\Plugin::ACCESS_READWRITE: |
|
| 99 | + $writer->writeElement($cs.'read-write'); |
|
| 100 | + break; |
|
| 101 | + case DAV\Sharing\Plugin::ACCESS_READ: |
|
| 102 | + $writer->writeElement($cs.'read'); |
|
| 103 | + break; |
|
| 104 | + } |
|
| 105 | + $writer->endElement(); // access |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - $href = new DAV\Xml\Property\Href($sharee->href); |
|
| 109 | - $href->xmlSerialize($writer); |
|
| 108 | + $href = new DAV\Xml\Property\Href($sharee->href); |
|
| 109 | + $href->xmlSerialize($writer); |
|
| 110 | 110 | |
| 111 | - if (isset($sharee->properties['{DAV:}displayname'])) { |
|
| 112 | - $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']); |
|
| 113 | - } |
|
| 114 | - if ($sharee->comment) { |
|
| 115 | - $writer->writeElement($cs.'summary', $sharee->comment); |
|
| 116 | - } |
|
| 117 | - $writer->endElement(); // organizer or user |
|
| 118 | - } |
|
| 119 | - } |
|
| 111 | + if (isset($sharee->properties['{DAV:}displayname'])) { |
|
| 112 | + $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']); |
|
| 113 | + } |
|
| 114 | + if ($sharee->comment) { |
|
| 115 | + $writer->writeElement($cs.'summary', $sharee->comment); |
|
| 116 | + } |
|
| 117 | + $writer->endElement(); // organizer or user |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | 120 | } |
@@ -21,51 +21,51 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class EmailAddressSet implements XmlSerializable |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * emails. |
|
| 26 | - * |
|
| 27 | - * @var array |
|
| 28 | - */ |
|
| 29 | - private $emails; |
|
| 24 | + /** |
|
| 25 | + * emails. |
|
| 26 | + * |
|
| 27 | + * @var array |
|
| 28 | + */ |
|
| 29 | + private $emails; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * __construct. |
|
| 33 | - */ |
|
| 34 | - public function __construct(array $emails) |
|
| 35 | - { |
|
| 36 | - $this->emails = $emails; |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * __construct. |
|
| 33 | + */ |
|
| 34 | + public function __construct(array $emails) |
|
| 35 | + { |
|
| 36 | + $this->emails = $emails; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Returns the email addresses. |
|
| 41 | - * |
|
| 42 | - * @return array |
|
| 43 | - */ |
|
| 44 | - public function getValue() |
|
| 45 | - { |
|
| 46 | - return $this->emails; |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * Returns the email addresses. |
|
| 41 | + * |
|
| 42 | + * @return array |
|
| 43 | + */ |
|
| 44 | + public function getValue() |
|
| 45 | + { |
|
| 46 | + return $this->emails; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * The xmlSerialize method is called during xml writing. |
|
| 51 | - * |
|
| 52 | - * Use the $writer argument to write its own xml serialization. |
|
| 53 | - * |
|
| 54 | - * An important note: do _not_ create a parent element. Any element |
|
| 55 | - * implementing XmlSerializable should only ever write what's considered |
|
| 56 | - * its 'inner xml'. |
|
| 57 | - * |
|
| 58 | - * The parent of the current element is responsible for writing a |
|
| 59 | - * containing element. |
|
| 60 | - * |
|
| 61 | - * This allows serializers to be re-used for different element names. |
|
| 62 | - * |
|
| 63 | - * If you are opening new elements, you must also close them again. |
|
| 64 | - */ |
|
| 65 | - public function xmlSerialize(Writer $writer) |
|
| 66 | - { |
|
| 67 | - foreach ($this->emails as $email) { |
|
| 68 | - $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); |
|
| 69 | - } |
|
| 70 | - } |
|
| 49 | + /** |
|
| 50 | + * The xmlSerialize method is called during xml writing. |
|
| 51 | + * |
|
| 52 | + * Use the $writer argument to write its own xml serialization. |
|
| 53 | + * |
|
| 54 | + * An important note: do _not_ create a parent element. Any element |
|
| 55 | + * implementing XmlSerializable should only ever write what's considered |
|
| 56 | + * its 'inner xml'. |
|
| 57 | + * |
|
| 58 | + * The parent of the current element is responsible for writing a |
|
| 59 | + * containing element. |
|
| 60 | + * |
|
| 61 | + * This allows serializers to be re-used for different element names. |
|
| 62 | + * |
|
| 63 | + * If you are opening new elements, you must also close them again. |
|
| 64 | + */ |
|
| 65 | + public function xmlSerialize(Writer $writer) |
|
| 66 | + { |
|
| 67 | + foreach ($this->emails as $email) { |
|
| 68 | + $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | } |