@@ -42,15 +42,15 @@ 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 | 51 | // Merge CDATA as text nodes |
52 | 52 | $this->xml = simplexml_load_string($this->stripped, null, LIBXML_NOCDATA); |
53 | - if($this->xml === FALSE) |
|
53 | + if ($this->xml === FALSE) |
|
54 | 54 | throw new XMLResponseParseException(); |
55 | 55 | $this->content = $this->toAssocArray($this->xml); |
56 | 56 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | } |
64 | 64 | |
65 | - protected function setContent($content){ |
|
65 | + protected function setContent($content) { |
|
66 | 66 | $this->content = $content; |
67 | 67 | } |
68 | 68 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | $nameSpaceDefRegEx = '(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']?'; |
96 | 96 | |
97 | 97 | // Cycle through each namespace and remove it from the XML string |
98 | - foreach( $toRemove as $remove ) { |
|
98 | + foreach ($toRemove as $remove) { |
|
99 | 99 | // First remove the namespace from the opening of the tag |
100 | - $xml = str_replace('<' . $remove . ':', '<', $xml); |
|
100 | + $xml = str_replace('<'.$remove.':', '<', $xml); |
|
101 | 101 | // Now remove the namespace from the closing of the tag |
102 | - $xml = str_replace('</' . $remove . ':', '</', $xml); |
|
102 | + $xml = str_replace('</'.$remove.':', '</', $xml); |
|
103 | 103 | // This XML uses the name space with CommentText, so remove that too |
104 | - $xml = str_replace($remove . ':commentText', 'commentText', $xml); |
|
104 | + $xml = str_replace($remove.':commentText', 'commentText', $xml); |
|
105 | 105 | // Complete the pattern for RegEx to remove this namespace declaration |
106 | 106 | $pattern = "/xmlns:{$remove}{$nameSpaceDefRegEx}/"; |
107 | 107 | // Remove the actual namespace declaration using the Pattern |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @return bool |
127 | 127 | */ |
128 | - protected function isValid(){ |
|
128 | + protected function isValid() { |
|
129 | 129 | return isset($this->content['response']); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | \ No newline at end of file |
@@ -50,8 +50,9 @@ |
||
50 | 50 | $this->stripped = $this->stripNamespacesFromTags($this->body); |
51 | 51 | // Merge CDATA as text nodes |
52 | 52 | $this->xml = simplexml_load_string($this->stripped, null, LIBXML_NOCDATA); |
53 | - if($this->xml === FALSE) |
|
54 | - throw new XMLResponseParseException(); |
|
53 | + if($this->xml === FALSE) { |
|
54 | + throw new XMLResponseParseException(); |
|
55 | + } |
|
55 | 56 | $this->content = $this->toAssocArray($this->xml); |
56 | 57 | |
57 | 58 | $this->parse(); |
@@ -21,10 +21,10 @@ |
||
21 | 21 | /** |
22 | 22 | * @return string |
23 | 23 | */ |
24 | - public function getVCard(){ |
|
25 | - if(!isset($this->found_props['calendar-data'])) return null; |
|
24 | + public function getVCard() { |
|
25 | + if (!isset($this->found_props['calendar-data'])) return null; |
|
26 | 26 | $calendar_data = $this->found_props['calendar-data']; |
27 | - if(!is_string($calendar_data)) return null; |
|
27 | + if (!is_string($calendar_data)) return null; |
|
28 | 28 | return $calendar_data; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -22,9 +22,13 @@ |
||
22 | 22 | * @return string |
23 | 23 | */ |
24 | 24 | public function getVCard(){ |
25 | - if(!isset($this->found_props['calendar-data'])) return null; |
|
25 | + if(!isset($this->found_props['calendar-data'])) { |
|
26 | + return null; |
|
27 | + } |
|
26 | 28 | $calendar_data = $this->found_props['calendar-data']; |
27 | - if(!is_string($calendar_data)) return null; |
|
29 | + if(!is_string($calendar_data)) { |
|
30 | + return null; |
|
31 | + } |
|
28 | 32 | return $calendar_data; |
29 | 33 | } |
30 | 34 | } |
31 | 35 | \ No newline at end of file |