1
|
|
|
<?php namespace CalDAVClient\Facade\Responses; |
2
|
|
|
/** |
3
|
|
|
* Copyright 2017 OpenStack Foundation |
4
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
5
|
|
|
* you may not use this file except in compliance with the License. |
6
|
|
|
* You may obtain a copy of the License at |
7
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
* Unless required by applicable law or agreed to in writing, software |
9
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
10
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
11
|
|
|
* See the License for the specific language governing permissions and |
12
|
|
|
* limitations under the License. |
13
|
|
|
**/ |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class CalendarSyncInfoResponse |
18
|
|
|
* @package CalDAVClient\Facade\Responses |
19
|
|
|
*/ |
20
|
|
|
final class CalendarSyncInfoResponse extends ResourceCollectionResponse |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @return string|null |
24
|
|
|
*/ |
25
|
|
|
public function getSyncToken(){ |
26
|
|
|
return isset($this->content['sync-token'])? $this->content['sync-token'] : null; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @return bool |
31
|
|
|
*/ |
32
|
|
|
public function hasAvailableChanges(){ |
33
|
|
|
return count($this->responses) > 0; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return ETagEntityResponse[] |
38
|
|
|
*/ |
39
|
|
|
public function getUpdates(){ |
40
|
|
|
$res = []; |
41
|
|
|
foreach ($this->responses as $entity){ |
42
|
|
|
if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpOKStatus) continue; |
43
|
|
|
$res[] = $entity; |
44
|
|
|
} |
45
|
|
|
return $res; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return ETagEntityResponse[] |
50
|
|
|
*/ |
51
|
|
|
public function getDeletes(){ |
52
|
|
|
$res = []; |
53
|
|
|
foreach ($this->responses as $entity){ |
54
|
|
|
if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue; |
55
|
|
|
$res[] = $entity; |
56
|
|
|
} |
57
|
|
|
return $res; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
} |