@@ -22,7 +22,7 @@ |
||
22 | 22 | * @return string |
23 | 23 | */ |
24 | 24 | public function getPrincipalUrl() { |
25 | - return isset($this->found_props['current-user-principal']) && isset($this->found_props['current-user-principal']['href']) ? |
|
25 | + return isset($this->found_props['current-user-principal']) && isset($this->found_props['current-user-principal']['href']) ? |
|
26 | 26 | $this->server_url.$this->found_props['current-user-principal']['href'] : null; |
27 | 27 | } |
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | * @param string|null $body |
43 | 43 | * @param int $code |
44 | 44 | */ |
45 | - public function __construct($server_url = null, $body = null, $code = HttpResponse::HttpCodeOk ) |
|
45 | + public function __construct($server_url = null, $body = null, $code = HttpResponse::HttpCodeOk) |
|
46 | 46 | { |
47 | 47 | parent::__construct($body, $code); |
48 | 48 | $this->server_url = $server_url; |
49 | - if(!empty($this->body)) { |
|
49 | + if (!empty($this->body)) { |
|
50 | 50 | $this->stripped = $this->stripNamespacesFromTags($this->body); |
51 | - $this->xml = simplexml_load_string($this->stripped); |
|
52 | - if($this->xml === FALSE) |
|
51 | + $this->xml = simplexml_load_string($this->stripped); |
|
52 | + if ($this->xml === FALSE) |
|
53 | 53 | throw new XMLResponseParseException(); |
54 | 54 | $this->content = $this->toAssocArray($this->xml); |
55 | 55 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | } |
63 | 63 | |
64 | - protected function setContent($content){ |
|
64 | + protected function setContent($content) { |
|
65 | 65 | $this->content = $content; |
66 | 66 | } |
67 | 67 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $nameSpaceDefRegEx = '(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']?'; |
95 | 95 | |
96 | 96 | // Cycle through each namespace and remove it from the XML string |
97 | - foreach( $toRemove as $remove ) { |
|
97 | + foreach ($toRemove as $remove) { |
|
98 | 98 | // First remove the namespace from the opening of the tag |
99 | - $xml = str_replace('<' . $remove . ':', '<', $xml); |
|
99 | + $xml = str_replace('<'.$remove.':', '<', $xml); |
|
100 | 100 | // Now remove the namespace from the closing of the tag |
101 | - $xml = str_replace('</' . $remove . ':', '</', $xml); |
|
101 | + $xml = str_replace('</'.$remove.':', '</', $xml); |
|
102 | 102 | // This XML uses the name space with CommentText, so remove that too |
103 | - $xml = str_replace($remove . ':commentText', 'commentText', $xml); |
|
103 | + $xml = str_replace($remove.':commentText', 'commentText', $xml); |
|
104 | 104 | // Complete the pattern for RegEx to remove this namespace declaration |
105 | 105 | $pattern = "/xmlns:{$remove}{$nameSpaceDefRegEx}/"; |
106 | 106 | // Remove the actual namespace declaration using the Pattern |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @return bool |
126 | 126 | */ |
127 | - protected function isValid(){ |
|
127 | + protected function isValid() { |
|
128 | 128 | return isset($this->content['response']); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | \ No newline at end of file |
@@ -49,8 +49,9 @@ |
||
49 | 49 | if(!empty($this->body)) { |
50 | 50 | $this->stripped = $this->stripNamespacesFromTags($this->body); |
51 | 51 | $this->xml = simplexml_load_string($this->stripped); |
52 | - if($this->xml === FALSE) |
|
53 | - throw new XMLResponseParseException(); |
|
52 | + if($this->xml === FALSE) { |
|
53 | + throw new XMLResponseParseException(); |
|
54 | + } |
|
54 | 55 | $this->content = $this->toAssocArray($this->xml); |
55 | 56 | |
56 | 57 | $this->parse(); |
@@ -30,13 +30,13 @@ |
||
30 | 30 | * @param string $type |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - public function getResponseByType($type){ |
|
33 | + public function getResponseByType($type) { |
|
34 | 34 | $responses = []; |
35 | 35 | |
36 | - foreach ($this->getResponses() as $response){ |
|
37 | - if(!$response instanceof GetCalendarResponse) continue; |
|
36 | + foreach ($this->getResponses() as $response) { |
|
37 | + if (!$response instanceof GetCalendarResponse) continue; |
|
38 | 38 | $resource_types = $response->getResourceType(); |
39 | - if(in_array($type, array_keys($resource_types))) $responses[] = $response; |
|
39 | + if (in_array($type, array_keys($resource_types))) $responses[] = $response; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $responses; |
@@ -34,9 +34,13 @@ |
||
34 | 34 | $responses = []; |
35 | 35 | |
36 | 36 | foreach ($this->getResponses() as $response){ |
37 | - if(!$response instanceof GetCalendarResponse) continue; |
|
37 | + if(!$response instanceof GetCalendarResponse) { |
|
38 | + continue; |
|
39 | + } |
|
38 | 40 | $resource_types = $response->getResourceType(); |
39 | - if(in_array($type, array_keys($resource_types))) $responses[] = $response; |
|
41 | + if(in_array($type, array_keys($resource_types))) { |
|
42 | + $responses[] = $response; |
|
43 | + } |
|
40 | 44 | } |
41 | 45 | |
42 | 46 | return $responses; |