@@ -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 .= ' '; |
@@ -247,18 +247,18 @@ discard block |
||
247 | 247 | * @throws GetMessagesFailedException |
248 | 248 | * @throws ReflectionException |
249 | 249 | */ |
250 | - protected function make($uid, $msglist, $header, $content, $flags){ |
|
250 | + protected function make($uid, $msglist, $header, $content, $flags) { |
|
251 | 251 | try { |
252 | 252 | return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence); |
253 | - }catch (MessageNotFoundException $e) { |
|
253 | + } catch (MessageNotFoundException $e) { |
|
254 | 254 | $this->setError($uid, $e); |
255 | - }catch (RuntimeException $e) { |
|
255 | + } catch (RuntimeException $e) { |
|
256 | 256 | $this->setError($uid, $e); |
257 | - }catch (MessageFlagException $e) { |
|
257 | + } catch (MessageFlagException $e) { |
|
258 | 258 | $this->setError($uid, $e); |
259 | - }catch (InvalidMessageDateException $e) { |
|
259 | + } catch (InvalidMessageDateException $e) { |
|
260 | 260 | $this->setError($uid, $e); |
261 | - }catch (MessageContentFetchingException $e) { |
|
261 | + } catch (MessageContentFetchingException $e) { |
|
262 | 262 | $this->setError($uid, $e); |
263 | 263 | } |
264 | 264 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return string |
277 | 277 | */ |
278 | - protected function getMessageKey($message_key, $msglist, $message){ |
|
278 | + protected function getMessageKey($message_key, $msglist, $message) { |
|
279 | 279 | switch ($message_key) { |
280 | 280 | case 'number': |
281 | 281 | $key = $message->getMessageNo(); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $key = $message->getMessageId(); |
291 | 291 | break; |
292 | 292 | } |
293 | - return (string)$key; |
|
293 | + return (string) $key; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * |
783 | 783 | * @return boolean |
784 | 784 | */ |
785 | - public function hasErrors($uid = null){ |
|
785 | + public function hasErrors($uid = null) { |
|
786 | 786 | if ($uid !== null) { |
787 | 787 | return $this->hasError($uid); |
788 | 788 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * |
796 | 796 | * @return boolean |
797 | 797 | */ |
798 | - public function hasError($uid){ |
|
798 | + public function hasError($uid) { |
|
799 | 799 | return isset($this->errors[$uid]); |
800 | 800 | } |
801 | 801 | |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | * |
805 | 805 | * @return array |
806 | 806 | */ |
807 | - public function errors(){ |
|
807 | + public function errors() { |
|
808 | 808 | return $this->getErrors(); |
809 | 809 | } |
810 | 810 | |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * |
814 | 814 | * @return array |
815 | 815 | */ |
816 | - public function getErrors(){ |
|
816 | + public function getErrors() { |
|
817 | 817 | return $this->errors; |
818 | 818 | } |
819 | 819 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | * |
824 | 824 | * @return Exception|null |
825 | 825 | */ |
826 | - public function error($uid){ |
|
826 | + public function error($uid) { |
|
827 | 827 | return $this->getError($uid); |
828 | 828 | } |
829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return Exception|null |
835 | 835 | */ |
836 | - public function getError($uid){ |
|
836 | + public function getError($uid) { |
|
837 | 837 | if ($this->hasError($uid)) { |
838 | 838 | return $this->errors[$uid]; |
839 | 839 | } |
@@ -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); |
@@ -250,15 +254,15 @@ discard block |
||
250 | 254 | protected function make($uid, $msglist, $header, $content, $flags){ |
251 | 255 | try { |
252 | 256 | return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence); |
253 | - }catch (MessageNotFoundException $e) { |
|
257 | + } catch (MessageNotFoundException $e) { |
|
254 | 258 | $this->setError($uid, $e); |
255 | - }catch (RuntimeException $e) { |
|
259 | + } catch (RuntimeException $e) { |
|
256 | 260 | $this->setError($uid, $e); |
257 | - }catch (MessageFlagException $e) { |
|
261 | + } catch (MessageFlagException $e) { |
|
258 | 262 | $this->setError($uid, $e); |
259 | - }catch (InvalidMessageDateException $e) { |
|
263 | + } catch (InvalidMessageDateException $e) { |
|
260 | 264 | $this->setError($uid, $e); |
261 | - }catch (MessageContentFetchingException $e) { |
|
265 | + } catch (MessageContentFetchingException $e) { |
|
262 | 266 | $this->setError($uid, $e); |
263 | 267 | } |
264 | 268 | |
@@ -511,7 +515,9 @@ discard block |
||
511 | 515 | * @return $this |
512 | 516 | */ |
513 | 517 | public function limit($limit, $page = 1) { |
514 | - if ($page >= 1) $this->page = $page; |
|
518 | + if ($page >= 1) { |
|
519 | + $this->page = $page; |
|
520 | + } |
|
515 | 521 | $this->limit = $limit; |
516 | 522 | |
517 | 523 | return $this; |
@@ -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 __serialize(){ |
|
69 | + public function __serialize() { |
|
70 | 70 | return $this->values; |
71 | 71 | } |
72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return array |
77 | 77 | */ |
78 | - public function toArray(){ |
|
78 | + public function toArray() { |
|
79 | 79 | return $this->__serialize(); |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return Carbon|null |
86 | 86 | */ |
87 | - public function toDate(){ |
|
87 | + public function toDate() { |
|
88 | 88 | $date = $this->first(); |
89 | 89 | if ($date instanceof Carbon) return $date; |
90 | 90 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function offsetSet($key, $value) { |
122 | 122 | if (is_null($key)) { |
123 | 123 | $this->values[] = $value; |
124 | - } else { |
|
124 | + }else { |
|
125 | 125 | $this->values[$key] = $value; |
126 | 126 | } |
127 | 127 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if ($this->contains($value) === false) { |
196 | 196 | $this->values[] = $value; |
197 | 197 | } |
198 | - }else{ |
|
198 | + }else { |
|
199 | 199 | $this->values[] = $value; |
200 | 200 | } |
201 | 201 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return Attribute |
208 | 208 | */ |
209 | - public function setName($name){ |
|
209 | + public function setName($name) { |
|
210 | 210 | $this->name = $name; |
211 | 211 | |
212 | 212 | return $this; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string |
219 | 219 | */ |
220 | - public function getName(){ |
|
220 | + public function getName() { |
|
221 | 221 | return $this->name; |
222 | 222 | } |
223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return array |
228 | 228 | */ |
229 | - public function get(){ |
|
229 | + public function get() { |
|
230 | 230 | return $this->values; |
231 | 231 | } |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return array |
237 | 237 | */ |
238 | - public function all(){ |
|
238 | + public function all() { |
|
239 | 239 | return $this->get(); |
240 | 240 | } |
241 | 241 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return mixed|null |
246 | 246 | */ |
247 | - public function first(){ |
|
247 | + public function first() { |
|
248 | 248 | if ($this->offsetExists(0)) { |
249 | 249 | return $this->values[0]; |
250 | 250 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return mixed|null |
258 | 258 | */ |
259 | - public function last(){ |
|
259 | + public function last() { |
|
260 | 260 | if (($cnt = $this->count()) > 0) { |
261 | 261 | return $this->values[$cnt - 1]; |
262 | 262 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return int |
270 | 270 | */ |
271 | - public function count(){ |
|
271 | + public function count() { |
|
272 | 272 | return count($this->values); |
273 | 273 | } |
274 | 274 | } |
275 | 275 | \ No newline at end of file |
@@ -86,7 +86,9 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function toDate(){ |
88 | 88 | $date = $this->first(); |
89 | - if ($date instanceof Carbon) return $date; |
|
89 | + if ($date instanceof Carbon) { |
|
90 | + return $date; |
|
91 | + } |
|
90 | 92 | |
91 | 93 | return Carbon::parse($date); |
92 | 94 | } |
@@ -146,7 +148,7 @@ discard block |
||
146 | 148 | public function add($value, $strict = false) { |
147 | 149 | if (is_array($value)) { |
148 | 150 | return $this->merge($value, $strict); |
149 | - }elseif ($value !== null) { |
|
151 | + } elseif ($value !== null) { |
|
150 | 152 | $this->attach($value, $strict); |
151 | 153 | } |
152 | 154 | |
@@ -195,7 +197,7 @@ discard block |
||
195 | 197 | if ($this->contains($value) === false) { |
196 | 198 | $this->values[] = $value; |
197 | 199 | } |
198 | - }else{ |
|
200 | + } else{ |
|
199 | 201 | $this->values[] = $value; |
200 | 202 | } |
201 | 203 | } |