@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
21 | 21 | } |
22 | 22 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); |
21 | 21 | } |
22 | 22 |
@@ -237,7 +237,9 @@ discard block |
||
237 | 237 | public function move($new_name, $expunge = true) { |
238 | 238 | $this->client->checkConnection(); |
239 | 239 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
240 | - if($expunge) $this->client->expunge(); |
|
240 | + if($expunge) { |
|
241 | + $this->client->expunge(); |
|
242 | + } |
|
241 | 243 | |
242 | 244 | $folder = $this->client->getFolder($new_name); |
243 | 245 | $event = $this->getEvent("folder", "moved"); |
@@ -300,7 +302,9 @@ discard block |
||
300 | 302 | */ |
301 | 303 | public function delete($expunge = true) { |
302 | 304 | $status = $this->client->getConnection()->deleteFolder($this->path); |
303 | - if($expunge) $this->client->expunge(); |
|
305 | + if($expunge) { |
|
306 | + $this->client->expunge(); |
|
307 | + } |
|
304 | 308 | |
305 | 309 | $event = $this->getEvent("folder", "deleted"); |
306 | 310 | $event::dispatch($this); |
@@ -368,10 +372,10 @@ discard block |
||
368 | 372 | |
369 | 373 | $connection->idle(); |
370 | 374 | } |
371 | - }catch (Exceptions\RuntimeException $e) { |
|
375 | + } catch (Exceptions\RuntimeException $e) { |
|
372 | 376 | if(strpos($e->getMessage(), "connection closed") === false) { |
373 | 377 | throw $e; |
374 | - }else{ |
|
378 | + } else{ |
|
375 | 379 | $this->client->connect(); |
376 | 380 | $this->client->openFolder($this->path); |
377 | 381 | $connection = $this->client->getConnection(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $this->setDelimiter($delimiter); |
127 | 127 | $this->path = $folder_name; |
128 | - $this->full_name = $this->decodeName($folder_name); |
|
128 | + $this->full_name = $this->decodeName($folder_name); |
|
129 | 129 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
130 | 130 | |
131 | 131 | $this->parseAttributes($attributes); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return WhereQuery |
139 | 139 | * @throws Exceptions\ConnectionFailedException |
140 | 140 | */ |
141 | - public function query($charset = 'UTF-8'){ |
|
141 | + public function query($charset = 'UTF-8') { |
|
142 | 142 | $this->getClient()->checkConnection(); |
143 | 143 | $this->getClient()->openFolder($this->path); |
144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @inheritdoc self::query($charset = 'UTF-8') |
150 | 150 | * @throws Exceptions\ConnectionFailedException |
151 | 151 | */ |
152 | - public function search($charset = 'UTF-8'){ |
|
152 | + public function search($charset = 'UTF-8') { |
|
153 | 153 | return $this->query($charset); |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @inheritdoc self::query($charset = 'UTF-8') |
158 | 158 | * @throws Exceptions\ConnectionFailedException |
159 | 159 | */ |
160 | - public function messages($charset = 'UTF-8'){ |
|
160 | + public function messages($charset = 'UTF-8') { |
|
161 | 161 | return $this->query($charset); |
162 | 162 | } |
163 | 163 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | public function move($new_name, $expunge = true) { |
233 | 233 | $this->client->checkConnection(); |
234 | 234 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
235 | - if($expunge) $this->client->expunge(); |
|
235 | + if ($expunge) $this->client->expunge(); |
|
236 | 236 | |
237 | 237 | $folder = $this->client->getFolder($new_name); |
238 | 238 | $event = $this->getEvent("folder", "moved"); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return array |
249 | 249 | * @throws ConnectionFailedException |
250 | 250 | */ |
251 | - public function overview($sequence = null){ |
|
251 | + public function overview($sequence = null) { |
|
252 | 252 | $this->client->openFolder($this->path); |
253 | 253 | $sequence = $sequence === null ? "1:*" : $sequence; |
254 | 254 | return $this->client->getConnection()->overview($sequence); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | |
274 | 274 | if ($internal_date != null) { |
275 | - if ($internal_date instanceof Carbon){ |
|
275 | + if ($internal_date instanceof Carbon) { |
|
276 | 276 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
277 | 277 | } |
278 | 278 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function delete($expunge = true) { |
308 | 308 | $status = $this->client->getConnection()->deleteFolder($this->path); |
309 | - if($expunge) $this->client->expunge(); |
|
309 | + if ($expunge) $this->client->expunge(); |
|
310 | 310 | |
311 | 311 | $event = $this->getEvent("folder", "deleted"); |
312 | 312 | $event::dispatch($this); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | try { |
362 | 362 | $line = $connection->nextLine(); |
363 | 363 | if (($pos = strpos($line, "EXISTS")) !== false) { |
364 | - $msgn = (int) substr($line, 2, $pos -2); |
|
364 | + $msgn = (int) substr($line, 2, $pos - 2); |
|
365 | 365 | $connection->done(); |
366 | 366 | |
367 | 367 | $message = $this->query()->getMessage($msgn); |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | |
373 | 373 | $connection->idle(); |
374 | 374 | } |
375 | - }catch (Exceptions\RuntimeException $e) { |
|
376 | - if(strpos($e->getMessage(), "connection closed") === false) { |
|
375 | + } catch (Exceptions\RuntimeException $e) { |
|
376 | + if (strpos($e->getMessage(), "connection closed") === false) { |
|
377 | 377 | throw $e; |
378 | - }else{ |
|
378 | + }else { |
|
379 | 379 | $this->client->connect(); |
380 | 380 | $this->client->openFolder($this->path); |
381 | 381 | $connection = $this->client->getConnection(); |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | * Set the delimiter |
421 | 421 | * @param $delimiter |
422 | 422 | */ |
423 | - public function setDelimiter($delimiter){ |
|
424 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
423 | + public function setDelimiter($delimiter) { |
|
424 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
425 | 425 | $delimiter = ClientManager::get('options.delimiter', '/'); |
426 | 426 | } |
427 | 427 |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getCustomHTMLBody($callback = false) { |
48 | 48 | $body = $this->getHtmlBody(); |
49 | - if($body === null) return null; |
|
49 | + if($body === null) { |
|
50 | + return null; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | if ($callback !== false) { |
52 | 54 | $aAttachment = $this->parent->getAttachments(); |
@@ -54,7 +56,7 @@ discard block |
||
54 | 56 | /** @var Attachment $oAttachment */ |
55 | 57 | if(is_callable($callback)) { |
56 | 58 | $body = $callback($body, $oAttachment); |
57 | - }elseif(is_string($callback)) { |
|
59 | + } elseif(is_string($callback)) { |
|
58 | 60 | call_user_func($callback, [$body, $oAttachment]); |
59 | 61 | } |
60 | 62 | }); |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return null |
32 | 32 | */ |
33 | - public function getHtmlBody(){ |
|
33 | + public function getHtmlBody() { |
|
34 | 34 | $bodies = $this->parent->getBodies(); |
35 | 35 | if (!isset($bodies['html'])) { |
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | - if(is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
39 | + if (is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
40 | 40 | return $bodies['html']->content; |
41 | 41 | } |
42 | 42 | return $bodies['html']; |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCustomHTMLBody($callback = false) { |
52 | 52 | $body = $this->getHtmlBody(); |
53 | - if($body === null) return null; |
|
53 | + if ($body === null) return null; |
|
54 | 54 | |
55 | 55 | if ($callback !== false) { |
56 | 56 | $aAttachment = $this->parent->getAttachments(); |
57 | 57 | $aAttachment->each(function($oAttachment) use(&$body, $callback) { |
58 | 58 | /** @var Attachment $oAttachment */ |
59 | - if(is_callable($callback)) { |
|
59 | + if (is_callable($callback)) { |
|
60 | 60 | $body = $callback($body, $oAttachment); |
61 | - }elseif(is_string($callback)) { |
|
61 | + }elseif (is_string($callback)) { |
|
62 | 62 | call_user_func($callback, [$body, $oAttachment]); |
63 | 63 | } |
64 | 64 | }); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string|null |
75 | 75 | */ |
76 | 76 | public function getHTMLBodyWithEmbeddedBase64Images() { |
77 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
77 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
78 | 78 | /** @var \Webklex\PHPIMAP\Attachment $oAttachment */ |
79 | 79 | if ($oAttachment->id) { |
80 | 80 | $body = str_replace('cid:'.$oAttachment->id, 'data:'.$oAttachment->getContentType().';base64, '.base64_encode($oAttachment->getContent()), $body); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | return $this->attributes[$name]; |
68 | 68 | } |
69 | 69 | |
70 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
70 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
71 | 71 | $name = Str::snake(substr($method, 3)); |
72 | 72 | |
73 | 73 | if(isset($this->attributes[$name])) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function __construct($parent) { |
44 | 44 | $this->parent = $parent; |
45 | 45 | |
46 | - if(method_exists($this->parent, 'getAttributes')){ |
|
46 | + if (method_exists($this->parent, 'getAttributes')) { |
|
47 | 47 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
48 | 48 | } |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Boot method made to be used by any custom mask |
55 | 55 | */ |
56 | - protected function boot(){} |
|
56 | + protected function boot() {} |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Call dynamic attribute setter and getter methods and inherit the parent calls |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | * @throws MethodNotFoundException |
65 | 65 | */ |
66 | 66 | public function __call($method, $arguments) { |
67 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
67 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
68 | 68 | $name = Str::snake(substr($method, 3)); |
69 | 69 | |
70 | - if(isset($this->attributes[$name])) { |
|
70 | + if (isset($this->attributes[$name])) { |
|
71 | 71 | return $this->attributes[$name]; |
72 | 72 | } |
73 | 73 | |
74 | 74 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
75 | 75 | $name = Str::snake(substr($method, 3)); |
76 | 76 | |
77 | - if(isset($this->attributes[$name])) { |
|
77 | + if (isset($this->attributes[$name])) { |
|
78 | 78 | $this->attributes[$name] = array_pop($arguments); |
79 | 79 | |
80 | 80 | return $this->attributes[$name]; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | } |
84 | 84 | |
85 | - if(method_exists($this->parent, $method) === true){ |
|
85 | + if (method_exists($this->parent, $method) === true) { |
|
86 | 86 | return call_user_func_array([$this->parent, $method], $arguments); |
87 | 87 | } |
88 | 88 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return mixed|null |
110 | 110 | */ |
111 | 111 | public function __get($name) { |
112 | - if(isset($this->attributes[$name])) { |
|
112 | + if (isset($this->attributes[$name])) { |
|
113 | 113 | return $this->attributes[$name]; |
114 | 114 | } |
115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return mixed |
123 | 123 | */ |
124 | - public function getParent(){ |
|
124 | + public function getParent() { |
|
125 | 125 | return $this->parent; |
126 | 126 | } |
127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return array |
132 | 132 | */ |
133 | - public function getAttributes(){ |
|
133 | + public function getAttributes() { |
|
134 | 134 | return $this->attributes; |
135 | 135 | } |
136 | 136 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @return int|null |
70 | 70 | */ |
71 | 71 | public function total($total = null) { |
72 | - if($total === null) { |
|
72 | + if ($total === null) { |
|
73 | 73 | return $this->total; |
74 | 74 | } |
75 | 75 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | // so add them back in manually if we can |
56 | 56 | if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { |
57 | 57 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
58 | - }elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { |
|
58 | + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { |
|
59 | 59 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; |
60 | 60 | } |
61 | 61 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | * |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public function getEvents(){ |
|
68 | + public function getEvents() { |
|
69 | 69 | return $this->events; |
70 | 70 | } |
71 | 71 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | if (strpos(strtolower($name), "where") === false){ |
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | } |
129 | 129 | return $this->where($key, $value); |
130 | 130 | } |
131 | - }else{ |
|
131 | + } else{ |
|
132 | 132 | $criteria = $this->validate_criteria($criteria); |
133 | 133 | $value = $this->parse_value($value); |
134 | 134 | |
135 | 135 | if($value === null || $value === ''){ |
136 | 136 | $this->query->push([$criteria]); |
137 | - }else{ |
|
137 | + } else{ |
|
138 | 138 | $this->query->push([$criteria, $value]); |
139 | 139 | } |
140 | 140 | } |
@@ -149,7 +149,9 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function orWhere(\Closure $closure = null) { |
151 | 151 | $this->query->push(['OR']); |
152 | - if($closure !== null) $closure($this); |
|
152 | + if($closure !== null) { |
|
153 | + $closure($this); |
|
154 | + } |
|
153 | 155 | |
154 | 156 | return $this; |
155 | 157 | } |
@@ -161,7 +163,9 @@ discard block |
||
161 | 163 | */ |
162 | 164 | public function andWhere(\Closure $closure = null) { |
163 | 165 | $this->query->push(['AND']); |
164 | - if($closure !== null) $closure($this); |
|
166 | + if($closure !== null) { |
|
167 | + $closure($this); |
|
168 | + } |
|
165 | 169 | |
166 | 170 | return $this; |
167 | 171 | } |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | |
77 | 77 | $name = Str::camel($name); |
78 | 78 | |
79 | - if(strtolower(substr($name, 0, 3)) === 'not') { |
|
79 | + if (strtolower(substr($name, 0, 3)) === 'not') { |
|
80 | 80 | $that = $that->whereNot(); |
81 | 81 | $name = substr($name, 3); |
82 | 82 | } |
83 | 83 | |
84 | - if (strpos(strtolower($name), "where") === false){ |
|
84 | + if (strpos(strtolower($name), "where") === false) { |
|
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + }else { |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
90 | - if(method_exists($this, $method) === true){ |
|
90 | + if (method_exists($this, $method) === true) { |
|
91 | 91 | return call_user_func_array([$that, $method], $arguments); |
92 | 92 | } |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if (substr($criteria, 0, 7) === "CUSTOM ") { |
107 | 107 | return substr($criteria, 7); |
108 | 108 | } |
109 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
109 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
110 | 110 | throw new InvalidWhereQueryCriteriaException(); |
111 | 111 | } |
112 | 112 | |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | * @throws InvalidWhereQueryCriteriaException |
122 | 122 | */ |
123 | 123 | public function where($criteria, $value = null) { |
124 | - if(is_array($criteria)){ |
|
125 | - foreach($criteria as $key => $value){ |
|
126 | - if(is_numeric($key)){ |
|
124 | + if (is_array($criteria)) { |
|
125 | + foreach ($criteria as $key => $value) { |
|
126 | + if (is_numeric($key)) { |
|
127 | 127 | return $this->where($value); |
128 | 128 | } |
129 | 129 | return $this->where($key, $value); |
130 | 130 | } |
131 | - }else{ |
|
131 | + }else { |
|
132 | 132 | $criteria = $this->validate_criteria($criteria); |
133 | 133 | $value = $this->parse_value($value); |
134 | 134 | |
135 | - if($value === null || $value === ''){ |
|
135 | + if ($value === null || $value === '') { |
|
136 | 136 | $this->query->push([$criteria]); |
137 | - }else{ |
|
137 | + }else { |
|
138 | 138 | $this->query->push([$criteria, $value]); |
139 | 139 | } |
140 | 140 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function orWhere(\Closure $closure = null) { |
151 | 151 | $this->query->push(['OR']); |
152 | - if($closure !== null) $closure($this); |
|
152 | + if ($closure !== null) $closure($this); |
|
153 | 153 | |
154 | 154 | return $this; |
155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function andWhere(\Closure $closure = null) { |
163 | 163 | $this->query->push(['AND']); |
164 | - if($closure !== null) $closure($this); |
|
164 | + if ($closure !== null) $closure($this); |
|
165 | 165 | |
166 | 166 | return $this; |
167 | 167 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return WhereQuery |
402 | 402 | * @throws InvalidWhereQueryCriteriaException |
403 | 403 | */ |
404 | - public function whereNoXSpam(){ |
|
404 | + public function whereNoXSpam() { |
|
405 | 405 | return $this->where("CUSTOM X-Spam-Flag NO"); |
406 | 406 | } |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @return WhereQuery |
410 | 410 | * @throws InvalidWhereQueryCriteriaException |
411 | 411 | */ |
412 | - public function whereIsXSpam(){ |
|
412 | + public function whereIsXSpam() { |
|
413 | 413 | return $this->where("CUSTOM X-Spam-Flag YES"); |
414 | 414 | } |
415 | 415 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @return WhereQuery |
422 | 422 | * @throws InvalidWhereQueryCriteriaException |
423 | 423 | */ |
424 | - public function whereHeader($header, $value){ |
|
424 | + public function whereHeader($header, $value) { |
|
425 | 425 | return $this->where("CUSTOM HEADER $header $value"); |
426 | 426 | } |
427 | 427 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @return WhereQuery |
433 | 433 | * @throws InvalidWhereQueryCriteriaException |
434 | 434 | */ |
435 | - public function whereMessageId($messageId){ |
|
435 | + public function whereMessageId($messageId) { |
|
436 | 436 | return $this->whereHeader("Message-ID", $messageId); |
437 | 437 | } |
438 | 438 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @return WhereQuery |
444 | 444 | * @throws InvalidWhereQueryCriteriaException |
445 | 445 | */ |
446 | - public function whereInReplyTo($messageId){ |
|
446 | + public function whereInReplyTo($messageId) { |
|
447 | 447 | return $this->whereHeader("In-Reply-To", $messageId); |
448 | 448 | } |
449 | 449 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @return WhereQuery |
454 | 454 | * @throws InvalidWhereQueryCriteriaException |
455 | 455 | */ |
456 | - public function whereLanguage($country_code){ |
|
456 | + public function whereLanguage($country_code) { |
|
457 | 457 | return $this->where("Content-Language $country_code"); |
458 | 458 | } |
459 | 459 | } |
460 | 460 | \ No newline at end of file |