@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @throws InvalidMessageDateException |
| 161 | 161 | */ |
| 162 | - protected function parse(){ |
|
| 162 | + protected function parse() { |
|
| 163 | 163 | if ($this->header === null) { |
| 164 | 164 | $body = $this->findHeaders(); |
| 165 | - }else{ |
|
| 165 | + }else { |
|
| 166 | 166 | $body = $this->raw; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | $this->name = $this->header->get("name"); |
| 175 | 175 | $this->filename = $this->header->get("filename"); |
| 176 | 176 | |
| 177 | - if(!empty($this->header->get("id"))) { |
|
| 177 | + if (!empty($this->header->get("id"))) { |
|
| 178 | 178 | $this->id = $this->header->get("id"); |
| 179 | - } else if(!empty($this->header->get("x_attachment_id"))){ |
|
| 179 | + }else if (!empty($this->header->get("x_attachment_id"))) { |
|
| 180 | 180 | $this->id = $this->header->get("x_attachment_id"); |
| 181 | - } else if(!empty($this->header->get("content_id"))){ |
|
| 181 | + }else if (!empty($this->header->get("content_id"))) { |
|
| 182 | 182 | $this->id = strtr($this->header->get("content_id"), [ |
| 183 | 183 | '<' => '', |
| 184 | 184 | '>' => '' |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $content_types = $this->header->get("content_type"); |
| 189 | - if(!empty($content_types)){ |
|
| 189 | + if (!empty($content_types)) { |
|
| 190 | 190 | $this->subtype = $this->parseSubtype($content_types); |
| 191 | 191 | $content_type = $content_types; |
| 192 | 192 | if (is_array($content_types)) { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return string |
| 208 | 208 | * @throws InvalidMessageDateException |
| 209 | 209 | */ |
| 210 | - private function findHeaders(){ |
|
| 210 | + private function findHeaders() { |
|
| 211 | 211 | $body = $this->raw; |
| 212 | 212 | while (($pos = strpos($body, "\r\n")) > 0) { |
| 213 | 213 | $body = substr($body, $pos + 2); |
@@ -226,16 +226,16 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return string |
| 228 | 228 | */ |
| 229 | - private function parseSubtype($content_type){ |
|
| 229 | + private function parseSubtype($content_type) { |
|
| 230 | 230 | if (is_array($content_type)) { |
| 231 | - foreach ($content_type as $part){ |
|
| 232 | - if ((strpos($part, "/")) !== false){ |
|
| 231 | + foreach ($content_type as $part) { |
|
| 232 | + if ((strpos($part, "/")) !== false) { |
|
| 233 | 233 | return $this->parseSubtype($part); |
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | return null; |
| 237 | 237 | } |
| 238 | - if (($pos = strpos($content_type, "/")) !== false){ |
|
| 238 | + if (($pos = strpos($content_type, "/")) !== false) { |
|
| 239 | 239 | return substr($content_type, $pos + 1); |
| 240 | 240 | } |
| 241 | 241 | return null; |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | /** |
| 245 | 245 | * Try to parse the disposition if any is present |
| 246 | 246 | */ |
| 247 | - private function parseDisposition(){ |
|
| 247 | + private function parseDisposition() { |
|
| 248 | 248 | $content_disposition = $this->header->get("content_disposition"); |
| 249 | - if($content_disposition !== null) { |
|
| 249 | + if ($content_disposition !== null) { |
|
| 250 | 250 | $this->ifdisposition = true; |
| 251 | 251 | $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition; |
| 252 | 252 | } |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | /** |
| 256 | 256 | * Try to parse the description if any is present |
| 257 | 257 | */ |
| 258 | - private function parseDescription(){ |
|
| 258 | + private function parseDescription() { |
|
| 259 | 259 | $content_description = $this->header->get("content_description"); |
| 260 | - if($content_description !== null) { |
|
| 260 | + if ($content_description !== null) { |
|
| 261 | 261 | $this->ifdescription = true; |
| 262 | 262 | $this->description = $content_description; |
| 263 | 263 | } |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | /** |
| 267 | 267 | * Try to parse the encoding if any is present |
| 268 | 268 | */ |
| 269 | - private function parseEncoding(){ |
|
| 269 | + private function parseEncoding() { |
|
| 270 | 270 | $encoding = $this->header->get("content_transfer_encoding"); |
| 271 | - if($encoding !== null) { |
|
| 271 | + if ($encoding !== null) { |
|
| 272 | 272 | switch (strtolower($encoding)) { |
| 273 | 273 | case "quoted-printable": |
| 274 | 274 | $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * |
| 299 | 299 | * @return bool |
| 300 | 300 | */ |
| 301 | - public function isAttachment(){ |
|
| 301 | + public function isAttachment() { |
|
| 302 | 302 | $valid_disposition = in_array(strtolower($this->disposition ?? ''), ClientManager::get('options.dispositions')); |
| 303 | 303 | |
| 304 | 304 | if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || empty($this->disposition) || !$valid_disposition)) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
| 60 | - public function toString(){ |
|
| 60 | + public function toString() { |
|
| 61 | 61 | return $this->__toString(); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return array |
| 68 | 68 | */ |
| 69 | - public function toArray(){ |
|
| 69 | + public function toArray() { |
|
| 70 | 70 | return $this->values; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return Carbon|null |
| 77 | 77 | */ |
| 78 | - public function toDate(){ |
|
| 78 | + public function toDate() { |
|
| 79 | 79 | $date = $this->first(); |
| 80 | 80 | if ($date instanceof Carbon) return $date; |
| 81 | 81 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function offsetSet($key, $value): void { |
| 114 | 114 | if (is_null($key)) { |
| 115 | 115 | $this->values[] = $value; |
| 116 | - } else { |
|
| 116 | + }else { |
|
| 117 | 117 | $this->values[$key] = $value; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if ($this->contains($value) === false) { |
| 188 | 188 | $this->values[] = $value; |
| 189 | 189 | } |
| 190 | - }else{ |
|
| 190 | + }else { |
|
| 191 | 191 | $this->values[] = $value; |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @return Attribute |
| 200 | 200 | */ |
| 201 | - public function setName($name){ |
|
| 201 | + public function setName($name) { |
|
| 202 | 202 | $this->name = $name; |
| 203 | 203 | |
| 204 | 204 | return $this; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @return string |
| 211 | 211 | */ |
| 212 | - public function getName(){ |
|
| 212 | + public function getName() { |
|
| 213 | 213 | return $this->name; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @return array |
| 220 | 220 | */ |
| 221 | - public function get(){ |
|
| 221 | + public function get() { |
|
| 222 | 222 | return $this->values; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return array |
| 229 | 229 | */ |
| 230 | - public function all(){ |
|
| 230 | + public function all() { |
|
| 231 | 231 | return $this->get(); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return mixed|null |
| 238 | 238 | */ |
| 239 | - public function first(){ |
|
| 239 | + public function first() { |
|
| 240 | 240 | if ($this->offsetExists(0)) { |
| 241 | 241 | return $this->values[0]; |
| 242 | 242 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @return mixed|null |
| 250 | 250 | */ |
| 251 | - public function last(){ |
|
| 251 | + public function last() { |
|
| 252 | 252 | if (($cnt = $this->count()) > 0) { |
| 253 | 253 | return $this->values[$cnt - 1]; |
| 254 | 254 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return int |
| 262 | 262 | */ |
| 263 | - public function count(){ |
|
| 263 | + public function count() { |
|
| 264 | 264 | return count($this->values); |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | \ No newline at end of file |