@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | - public function getDisplayName(){ |
|
| 24 | + public function getDisplayName() { |
|
| 25 | 25 | return isset($this->found_props['displayname']) ? $this->found_props['displayname'] : null; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | * @see https://tools.ietf.org/html/rfc6578 |
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | - public function getSyncToken(){ |
|
| 32 | + public function getSyncToken() { |
|
| 33 | 33 | return isset($this->found_props['sync-token']) ? $this->found_props['sync-token'] : null; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | - public function getCTag(){ |
|
| 39 | + public function getCTag() { |
|
| 40 | 40 | return isset($this->found_props['getctag']) ? $this->found_props['getctag'] : null; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | protected function isValid() |
| 80 | 80 | { |
| 81 | - return parent::isValid() ; |
|
| 81 | + return parent::isValid(); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -41,8 +41,12 @@ discard block |
||
| 41 | 41 | protected function parse() |
| 42 | 42 | { |
| 43 | 43 | |
| 44 | - if (!$this->isValid()) throw new NotValidGenericSingleCalDAVResponseException(); |
|
| 45 | - if (!isset($this->content['response']['propstat'])) return $this; |
|
| 44 | + if (!$this->isValid()) { |
|
| 45 | + throw new NotValidGenericSingleCalDAVResponseException(); |
|
| 46 | + } |
|
| 47 | + if (!isset($this->content['response']['propstat'])) { |
|
| 48 | + return $this; |
|
| 49 | + } |
|
| 46 | 50 | if (isset($this->content['response']['propstat']['prop']) && isset($this->content['response']['propstat']['status'])) { |
| 47 | 51 | // all props found |
| 48 | 52 | $status = $this->content['response']['propstat']['status']; |
@@ -62,13 +66,17 @@ discard block |
||
| 62 | 66 | // multi props ( found or not found) |
| 63 | 67 | foreach ($this->content['response']['propstat'] as $propstat) { |
| 64 | 68 | |
| 65 | - if (!isset($propstat['status']) || !isset($propstat['prop'])) continue; |
|
| 69 | + if (!isset($propstat['status']) || !isset($propstat['prop'])) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 66 | 72 | |
| 67 | - if ($propstat['status'] == AbstractCalDAVResponse::HttpOKStatus) |
|
| 68 | - $this->found_props = $propstat['prop']; |
|
| 73 | + if ($propstat['status'] == AbstractCalDAVResponse::HttpOKStatus) { |
|
| 74 | + $this->found_props = $propstat['prop']; |
|
| 75 | + } |
|
| 69 | 76 | |
| 70 | - if ($propstat['status'] == AbstractCalDAVResponse::HttpNotFoundStatus) |
|
| 71 | - $this->not_found_props = $propstat['prop']; |
|
| 77 | + if ($propstat['status'] == AbstractCalDAVResponse::HttpNotFoundStatus) { |
|
| 78 | + $this->not_found_props = $propstat['prop']; |
|
| 79 | + } |
|
| 72 | 80 | } |
| 73 | 81 | return $this; |
| 74 | 82 | } |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | * @param string|null $body |
| 41 | 41 | * @param int $code |
| 42 | 42 | */ |
| 43 | - public function __construct($server_url = null, $body = null, $code = HttpResponse::HttpCodeOk ) |
|
| 43 | + public function __construct($server_url = null, $body = null, $code = HttpResponse::HttpCodeOk) |
|
| 44 | 44 | { |
| 45 | 45 | parent::__construct($body, $code); |
| 46 | 46 | $this->server_url = $server_url; |
| 47 | - if(!empty($this->body)) { |
|
| 47 | + if (!empty($this->body)) { |
|
| 48 | 48 | $this->xml = simplexml_load_string($this->body); |
| 49 | - if($this->xml === FALSE) |
|
| 49 | + if ($this->xml === FALSE) |
|
| 50 | 50 | throw new XMLResponseParseException(); |
| 51 | 51 | $this->content = $this->toAssocArray($this->xml); |
| 52 | 52 | $this->parse(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - protected function setContent($content){ |
|
| 60 | + protected function setContent($content) { |
|
| 61 | 61 | $this->content = $content; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * @return bool |
| 77 | 77 | */ |
| 78 | - protected function isValid(){ |
|
| 78 | + protected function isValid() { |
|
| 79 | 79 | return isset($this->content['response']); |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | \ No newline at end of file |
@@ -46,8 +46,9 @@ |
||
| 46 | 46 | $this->server_url = $server_url; |
| 47 | 47 | if(!empty($this->body)) { |
| 48 | 48 | $this->xml = simplexml_load_string($this->body); |
| 49 | - if($this->xml === FALSE) |
|
| 50 | - throw new XMLResponseParseException(); |
|
| 49 | + if($this->xml === FALSE) { |
|
| 50 | + throw new XMLResponseParseException(); |
|
| 51 | + } |
|
| 51 | 52 | $this->content = $this->toAssocArray($this->xml); |
| 52 | 53 | $this->parse(); |
| 53 | 54 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | - public function getCalendarHomeSetUrl(){ |
|
| 24 | + public function getCalendarHomeSetUrl() { |
|
| 25 | 25 | return isset($this->found_props['calendar-home-set']) && isset($this->found_props['calendar-home-set']['href']) ? |
| 26 | 26 | $this->found_props['calendar-home-set']['href'] : null; |
| 27 | 27 | } |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @return string|null |
| 31 | 31 | */ |
| 32 | - public function getRealCalDAVHost(){ |
|
| 32 | + public function getRealCalDAVHost() { |
|
| 33 | 33 | $url = $this->getCalendarHomeSetUrl(); |
| 34 | - return !empty($url) ? parse_url($url,PHP_URL_HOST) : null; |
|
| 34 | + return !empty($url) ? parse_url($url, PHP_URL_HOST) : null; |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * @return bool |
| 23 | 23 | */ |
| 24 | - public function isSuccessFull(){ |
|
| 24 | + public function isSuccessFull() { |
|
| 25 | 25 | return $this->code == HttpResponse::HttpCodeNoContent; |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |