@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @throws MessageContentFetchingException |
78 | 78 | * @throws InvalidMessageDateException |
79 | 79 | */ |
80 | - protected function parse(){ |
|
80 | + protected function parse() { |
|
81 | 81 | $this->findContentType(); |
82 | 82 | $this->parts = $this->find_parts(); |
83 | 83 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * Determine the message content type |
87 | 87 | */ |
88 | - public function findContentType(){ |
|
88 | + public function findContentType() { |
|
89 | 89 | $content_type = $this->header->get("content_type"); |
90 | 90 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
91 | - if(stripos($content_type, 'multipart') === 0) { |
|
91 | + if (stripos($content_type, 'multipart') === 0) { |
|
92 | 92 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
93 | - }else{ |
|
93 | + }else { |
|
94 | 94 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
95 | 95 | } |
96 | 96 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return Part[] |
104 | 104 | * @throws InvalidMessageDateException |
105 | 105 | */ |
106 | - private function parsePart($context, $part_number = 0){ |
|
106 | + private function parsePart($context, $part_number = 0) { |
|
107 | 107 | $body = $context; |
108 | 108 | while (($pos = strpos($body, "\r\n")) > 0) { |
109 | 109 | $body = substr($body, $pos + 2); |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * @return array |
127 | 127 | * @throws InvalidMessageDateException |
128 | 128 | */ |
129 | - private function detectParts($boundary, $context, $part_number = 0){ |
|
130 | - $base_parts = explode( $boundary, $context); |
|
129 | + private function detectParts($boundary, $context, $part_number = 0) { |
|
130 | + $base_parts = explode($boundary, $context); |
|
131 | 131 | $final_parts = []; |
132 | - foreach($base_parts as $ctx) { |
|
132 | + foreach ($base_parts as $ctx) { |
|
133 | 133 | $ctx = substr($ctx, 2); |
134 | 134 | if ($ctx !== "--" && $ctx != "") { |
135 | 135 | $parts = $this->parsePart($ctx, $part_number); |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * @throws MessageContentFetchingException |
151 | 151 | * @throws InvalidMessageDateException |
152 | 152 | */ |
153 | - public function find_parts(){ |
|
154 | - if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
155 | - if (($boundary = $this->header->getBoundary()) === null) { |
|
153 | + public function find_parts() { |
|
154 | + if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
155 | + if (($boundary = $this->header->getBoundary()) === null) { |
|
156 | 156 | throw new MessageContentFetchingException("no content found", 0); |
157 | 157 | } |
158 | 158 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @return string|null |
169 | 169 | * @Depricated since version 2.4.4 |
170 | 170 | */ |
171 | - public function getBoundary(){ |
|
171 | + public function getBoundary() { |
|
172 | 172 | return $this->header->getBoundary(); |
173 | 173 | } |
174 | 174 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
91 | 91 | if(stripos($content_type, 'multipart') === 0) { |
92 | 92 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
95 | 95 | } |
96 | 96 | } |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | if (strpos(strtolower($name), "where") === false) { |
88 | - $method = 'where' . ucfirst($name); |
|
89 | - } else { |
|
88 | + $method = 'where'.ucfirst($name); |
|
89 | + }else { |
|
90 | 90 | $method = lcfirst($name); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return call_user_func_array([$that, $method], $arguments); |
95 | 95 | } |
96 | 96 | |
97 | - throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported'); |
|
97 | + throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | } |
132 | 132 | return $this->where($key, $value); |
133 | 133 | } |
134 | - } else { |
|
134 | + }else { |
|
135 | 135 | $criteria = $this->validate_criteria($criteria); |
136 | 136 | $value = $this->parse_value($value); |
137 | 137 | |
138 | 138 | if ($value === null || $value === '') { |
139 | 139 | $this->query->push([$criteria]); |
140 | - } else { |
|
140 | + }else { |
|
141 | 141 | $this->query->push([$criteria, $value]); |
142 | 142 | } |
143 | 143 | } |
@@ -152,7 +152,9 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function orWhere(Closure $closure = null) { |
154 | 154 | $this->query->push(['OR']); |
155 | - if ($closure !== null) $closure($this); |
|
155 | + if ($closure !== null) { |
|
156 | + $closure($this); |
|
157 | + } |
|
156 | 158 | |
157 | 159 | return $this; |
158 | 160 | } |
@@ -164,7 +166,9 @@ discard block |
||
164 | 166 | */ |
165 | 167 | public function andWhere(Closure $closure = null) { |
166 | 168 | $this->query->push(['AND']); |
167 | - if ($closure !== null) $closure($this); |
|
169 | + if ($closure !== null) { |
|
170 | + $closure($this); |
|
171 | + } |
|
168 | 172 | |
169 | 173 | return $this; |
170 | 174 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | if (ClientManager::get('options.fetch_order') === 'desc') { |
97 | 97 | $this->fetch_order = 'desc'; |
98 | - } else { |
|
98 | + }else { |
|
99 | 99 | $this->fetch_order = 'asc'; |
100 | 100 | } |
101 | 101 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | break; |
127 | 127 | } |
128 | 128 | |
129 | - return (string)$value; |
|
129 | + return (string) $value; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | $this->query->each(function($statement) use (&$query) { |
159 | 159 | if (count($statement) == 1) { |
160 | 160 | $query .= $statement[0]; |
161 | - } else { |
|
161 | + }else { |
|
162 | 162 | if ($statement[1] === null) { |
163 | 163 | $query .= $statement[0]; |
164 | - } else { |
|
165 | - $query .= $statement[0] . ' "' . $statement[1] . '"'; |
|
164 | + }else { |
|
165 | + $query .= $statement[0].' "'.$statement[1].'"'; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | $query .= ' '; |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | } |
288 | 288 | $messages->put("$key", $message); |
289 | 289 | $msglist++; |
290 | - }catch (MessageNotFoundException $e) { |
|
290 | + } catch (MessageNotFoundException $e) { |
|
291 | 291 | $this->setError($uid, $e); |
292 | - }catch (RuntimeException $e) { |
|
292 | + } catch (RuntimeException $e) { |
|
293 | 293 | $this->setError($uid, $e); |
294 | - }catch (MessageFlagException $e) { |
|
294 | + } catch (MessageFlagException $e) { |
|
295 | 295 | $this->setError($uid, $e); |
296 | - }catch (InvalidMessageDateException $e) { |
|
296 | + } catch (InvalidMessageDateException $e) { |
|
297 | 297 | $this->setError($uid, $e); |
298 | - }catch (MessageContentFetchingException $e) { |
|
298 | + } catch (MessageContentFetchingException $e) { |
|
299 | 299 | $this->setError($uid, $e); |
300 | 300 | } |
301 | 301 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | * |
751 | 751 | * @return boolean |
752 | 752 | */ |
753 | - public function hasErrors($uid = null){ |
|
753 | + public function hasErrors($uid = null) { |
|
754 | 754 | if ($uid !== null) { |
755 | 755 | return $this->hasError($uid); |
756 | 756 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | * |
764 | 764 | * @return boolean |
765 | 765 | */ |
766 | - public function hasError($uid){ |
|
766 | + public function hasError($uid) { |
|
767 | 767 | return isset($this->errors[$uid]); |
768 | 768 | } |
769 | 769 | |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * |
773 | 773 | * @return array |
774 | 774 | */ |
775 | - public function errors(){ |
|
775 | + public function errors() { |
|
776 | 776 | return $this->getErrors(); |
777 | 777 | } |
778 | 778 | |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return array |
783 | 783 | */ |
784 | - public function getErrors(){ |
|
784 | + public function getErrors() { |
|
785 | 785 | return $this->errors; |
786 | 786 | } |
787 | 787 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * |
792 | 792 | * @return Exception|null |
793 | 793 | */ |
794 | - public function error($uid){ |
|
794 | + public function error($uid) { |
|
795 | 795 | return $this->getError($uid); |
796 | 796 | } |
797 | 797 | |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * |
802 | 802 | * @return Exception|null |
803 | 803 | */ |
804 | - public function getError($uid){ |
|
804 | + public function getError($uid) { |
|
805 | 805 | if ($this->hasError($uid)) { |
806 | 806 | return $this->errors[$uid]; |
807 | 807 | } |
@@ -91,7 +91,9 @@ discard block |
||
91 | 91 | $this->setClient($client); |
92 | 92 | |
93 | 93 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
94 | - if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
94 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
95 | + $this->leaveUnread(); |
|
96 | + } |
|
95 | 97 | |
96 | 98 | if (ClientManager::get('options.fetch_order') === 'desc') { |
97 | 99 | $this->fetch_order = 'desc'; |
@@ -137,7 +139,9 @@ discard block |
||
137 | 139 | * @throws MessageSearchValidationException |
138 | 140 | */ |
139 | 141 | protected function parse_date($date) { |
140 | - if ($date instanceof Carbon) return $date; |
|
142 | + if ($date instanceof Carbon) { |
|
143 | + return $date; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | try { |
143 | 147 | $date = Carbon::parse($date); |
@@ -287,15 +291,15 @@ discard block |
||
287 | 291 | } |
288 | 292 | $messages->put("$key", $message); |
289 | 293 | $msglist++; |
290 | - }catch (MessageNotFoundException $e) { |
|
294 | + } catch (MessageNotFoundException $e) { |
|
291 | 295 | $this->setError($uid, $e); |
292 | - }catch (RuntimeException $e) { |
|
296 | + } catch (RuntimeException $e) { |
|
293 | 297 | $this->setError($uid, $e); |
294 | - }catch (MessageFlagException $e) { |
|
298 | + } catch (MessageFlagException $e) { |
|
295 | 299 | $this->setError($uid, $e); |
296 | - }catch (InvalidMessageDateException $e) { |
|
300 | + } catch (InvalidMessageDateException $e) { |
|
297 | 301 | $this->setError($uid, $e); |
298 | - }catch (MessageContentFetchingException $e) { |
|
302 | + } catch (MessageContentFetchingException $e) { |
|
299 | 303 | $this->setError($uid, $e); |
300 | 304 | } |
301 | 305 | |
@@ -492,7 +496,9 @@ discard block |
||
492 | 496 | * @return $this |
493 | 497 | */ |
494 | 498 | public function limit($limit, $page = 1) { |
495 | - if ($page >= 1) $this->page = $page; |
|
499 | + if ($page >= 1) { |
|
500 | + $this->page = $page; |
|
501 | + } |
|
496 | 502 | $this->limit = $limit; |
497 | 503 | |
498 | 504 | return $this; |