@@ -50,10 +50,11 @@ |
||
| 50 | 50 | * @return string|bool The codec name or `false` if the attachment is not compressed. |
| 51 | 51 | */ |
| 52 | 52 | public function getContentEncoding() { |
| 53 | - if ($this->response->hasHeaderField(Response::CONTENT_ENCODING_HF)) |
|
| 54 | - return $this->response->getHeaderFieldValue(Response::CONTENT_ENCODING_HF); |
|
| 55 | - else |
|
| 56 | - return FALSE; |
|
| 53 | + if ($this->response->hasHeaderField(Response::CONTENT_ENCODING_HF)) { |
|
| 54 | + return $this->response->getHeaderFieldValue(Response::CONTENT_ENCODING_HF); |
|
| 55 | + } else { |
|
| 56 | + return FALSE; |
|
| 57 | + } |
|
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * arrays. |
| 55 | 55 | * @return array An array of rows. |
| 56 | 56 | */ |
| 57 | - public function asArray() { |
|
| 57 | + public function asArray() { |
|
| 58 | 58 | return $this->result['rows']; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param integer $offset The offset to retrieve. |
| 106 | 106 | * @return mixed Can return all value types. |
| 107 | 107 | */ |
| 108 | - public function offsetGet($offset) { |
|
| 108 | + public function offsetGet($offset) { |
|
| 109 | 109 | return $this->result['rows'][$offset]; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -143,10 +143,11 @@ |
||
| 143 | 143 | * @param string|array $revs The revision(s) identifier(s). |
| 144 | 144 | */ |
| 145 | 145 | public function includeOpenRevs($revs = 'all') { |
| 146 | - if (is_array($revs)) |
|
| 147 | - $this->options['open_revs'] = json_encode($revs); |
|
| 148 | - else |
|
| 149 | - $this->options['open_revs'] = 'all'; |
|
| 146 | + if (is_array($revs)) { |
|
| 147 | + $this->options['open_revs'] = json_encode($revs); |
|
| 148 | + } else { |
|
| 149 | + $this->options['open_revs'] = 'all'; |
|
| 150 | + } |
|
| 150 | 151 | |
| 151 | 152 | return $this; |
| 152 | 153 | } |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | public function getAttachments() { |
| 46 | 46 | $attachments = []; |
| 47 | 47 | |
| 48 | - foreach ($this->meta[self::ATTACHMENTS] as $attachment) |
|
| 49 | - $attachments[] = Attachment::fromArray($attachment); |
|
| 48 | + foreach ($this->meta[self::ATTACHMENTS] as $attachment) { |
|
| 49 | + $attachments[] = Attachment::fromArray($attachment); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | return $attachments; |
| 52 | 53 | } |
@@ -64,13 +65,15 @@ discard block |
||
| 64 | 65 | * @brief Removes an attachment. |
| 65 | 66 | */ |
| 66 | 67 | public function removeAttachment($name) { |
| 67 | - if ($this->isMetadataPresent(self::ATTACHMENTS)) |
|
| 68 | - if (array_key_exists($name, $this->meta[self::ATTACHMENTS])) |
|
| 68 | + if ($this->isMetadataPresent(self::ATTACHMENTS)) { |
|
| 69 | + if (array_key_exists($name, $this->meta[self::ATTACHMENTS])) |
|
| 69 | 70 | unset($this->meta[self::ATTACHMENTS][$name]); |
| 70 | - else |
|
| 71 | - throw new \Exception("Can't find `$name` attachment in the document."); |
|
| 72 | - else |
|
| 73 | - throw new \Exception("The document doesn't have any attachment."); |
|
| 71 | + } else { |
|
| 72 | + throw new \Exception("Can't find `$name` attachment in the document."); |
|
| 73 | + } |
|
| 74 | + else { |
|
| 75 | + throw new \Exception("The document doesn't have any attachment."); |
|
| 76 | + } |
|
| 74 | 77 | } |
| 75 | 78 | |
| 76 | 79 | |
@@ -81,10 +81,11 @@ discard block |
||
| 81 | 81 | * @param integer $since Sequence number to start results. Allowed values: positive integers | 'now'. |
| 82 | 82 | */ |
| 83 | 83 | public function setSince($since = 0) { |
| 84 | - if (($since == "now") || (is_int($since) and ($since >= 0))) |
|
| 85 | - $this->options["since"] = $since; |
|
| 86 | - else |
|
| 87 | - throw new \InvalidArgumentException("\$since must be a non-negative integer or can be 'now'."); |
|
| 84 | + if (($since == "now") || (is_int($since) and ($since >= 0))) { |
|
| 85 | + $this->options["since"] = $since; |
|
| 86 | + } else { |
|
| 87 | + throw new \InvalidArgumentException("\$since must be a non-negative integer or can be 'now'."); |
|
| 88 | + } |
|
| 88 | 89 | |
| 89 | 90 | return $this; |
| 90 | 91 | } |
@@ -95,10 +96,11 @@ discard block |
||
| 95 | 96 | * @param integer $limit Maximum number of rows to return. Must be a positive integer. |
| 96 | 97 | */ |
| 97 | 98 | public function setLimit($limit) { |
| 98 | - if (is_int($limit) && ($limit > 0)) |
|
| 99 | - $this->options["limit"] = $limit; |
|
| 100 | - else |
|
| 101 | - throw new \InvalidArgumentException("\$value must be a positive integer."); |
|
| 99 | + if (is_int($limit) && ($limit > 0)) { |
|
| 100 | + $this->options["limit"] = $limit; |
|
| 101 | + } else { |
|
| 102 | + throw new \InvalidArgumentException("\$value must be a positive integer."); |
|
| 103 | + } |
|
| 102 | 104 | |
| 103 | 105 | return $this; |
| 104 | 106 | } |
@@ -117,10 +119,11 @@ discard block |
||
| 117 | 119 | * @param string $type Type of feed. |
| 118 | 120 | */ |
| 119 | 121 | public function setFeedType($type) { |
| 120 | - if (array_key_exists($type, self::$supportedTypes)) |
|
| 121 | - $this->options["feed"] = $type; |
|
| 122 | - else |
|
| 123 | - throw new \InvalidArgumentException("Invalid feed type."); |
|
| 122 | + if (array_key_exists($type, self::$supportedTypes)) { |
|
| 123 | + $this->options["feed"] = $type; |
|
| 124 | + } else { |
|
| 125 | + throw new \InvalidArgumentException("Invalid feed type."); |
|
| 126 | + } |
|
| 124 | 127 | } |
| 125 | 128 | |
| 126 | 129 | |
@@ -130,10 +133,11 @@ discard block |
||
| 130 | 133 | * @param bool $style The feed style. |
| 131 | 134 | */ |
| 132 | 135 | public function setStyle($style) { |
| 133 | - if (array_key_exists($style, self::$supportedStyles)) |
|
| 134 | - $this->options["style"] = $style; |
|
| 135 | - else |
|
| 136 | - throw new \InvalidArgumentException("Invalid feed style."); |
|
| 136 | + if (array_key_exists($style, self::$supportedStyles)) { |
|
| 137 | + $this->options["style"] = $style; |
|
| 138 | + } else { |
|
| 139 | + throw new \InvalidArgumentException("Invalid feed style."); |
|
| 140 | + } |
|
| 137 | 141 | } |
| 138 | 142 | |
| 139 | 143 | |
@@ -146,11 +150,12 @@ discard block |
||
| 146 | 150 | public function setHeartbeat($heartbeat = self::DEFAULT_HEARTBEAT) { |
| 147 | 151 | $feed = $this->options['feed']; |
| 148 | 152 | |
| 149 | - if (($feed == self::CONTINUOUS_TYPE) || ($feed == self::LONGPOLL_TYPE)) |
|
| 150 | - if (is_int($heartbeat) && ($heartbeat >= 0)) |
|
| 153 | + if (($feed == self::CONTINUOUS_TYPE) || ($feed == self::LONGPOLL_TYPE)) { |
|
| 154 | + if (is_int($heartbeat) && ($heartbeat >= 0)) |
|
| 151 | 155 | $this->options["heartbeat"] = $heartbeat; |
| 152 | - else |
|
| 153 | - throw new \InvalidArgumentException("\$heartbeat must be a non-negative integer."); |
|
| 156 | + } else { |
|
| 157 | + throw new \InvalidArgumentException("\$heartbeat must be a non-negative integer."); |
|
| 158 | + } |
|
| 154 | 159 | } |
| 155 | 160 | |
| 156 | 161 | |
@@ -163,11 +168,12 @@ discard block |
||
| 163 | 168 | public function setTimeout($timeout = self::DEFAULT_TIMEOUT) { |
| 164 | 169 | $feed = $this->options['feed']; |
| 165 | 170 | |
| 166 | - if (($feed == self::CONTINUOUS_TYPE) || ($feed == self::LONGPOLL_TYPE)) |
|
| 167 | - if (is_int($timeout) && ($timeout > 0)) |
|
| 171 | + if (($feed == self::CONTINUOUS_TYPE) || ($feed == self::LONGPOLL_TYPE)) { |
|
| 172 | + if (is_int($timeout) && ($timeout > 0)) |
|
| 168 | 173 | $this->options["timeout"] = $timeout; |
| 169 | - else |
|
| 170 | - throw new \InvalidArgumentException("\$timeout must be a positive integer."); |
|
| 174 | + } else { |
|
| 175 | + throw new \InvalidArgumentException("\$timeout must be a positive integer."); |
|
| 176 | + } |
|
| 171 | 177 | } |
| 172 | 178 | |
| 173 | 179 | |
@@ -63,10 +63,11 @@ discard block |
||
| 63 | 63 | * @param string $type Type of feed. |
| 64 | 64 | */ |
| 65 | 65 | public function setFeedType($type) { |
| 66 | - if (array_key_exists($type, self::$supportedTypes)) |
|
| 67 | - $this->options["feed"] = $type; |
|
| 68 | - else |
|
| 69 | - throw new \InvalidArgumentException("Invalid feed type."); |
|
| 66 | + if (array_key_exists($type, self::$supportedTypes)) { |
|
| 67 | + $this->options["feed"] = $type; |
|
| 68 | + } else { |
|
| 69 | + throw new \InvalidArgumentException("Invalid feed type."); |
|
| 70 | + } |
|
| 70 | 71 | |
| 71 | 72 | return $this; |
| 72 | 73 | } |
@@ -81,11 +82,12 @@ discard block |
||
| 81 | 82 | public function setTimeout($timeout = self::DEFAULT_TIMEOUT) { |
| 82 | 83 | $feed = $this->options['feed']; |
| 83 | 84 | |
| 84 | - if ($feed == self::CONTINUOUS_TYPE) |
|
| 85 | - if (is_int($timeout) && ($timeout > 0)) |
|
| 85 | + if ($feed == self::CONTINUOUS_TYPE) { |
|
| 86 | + if (is_int($timeout) && ($timeout > 0)) |
|
| 86 | 87 | $this->options["timeout"] = $timeout; |
| 87 | - else |
|
| 88 | - throw new \InvalidArgumentException("\$timeout must be a positive integer."); |
|
| 88 | + } else { |
|
| 89 | + throw new \InvalidArgumentException("\$timeout must be a positive integer."); |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | return $this; |
| 91 | 93 | } |