@@ -80,7 +80,7 @@ |
||
| 80 | 80 | public function findContentType(){ |
| 81 | 81 | if(stripos($this->header->get("content-type"), 'multipart') === 0) { |
| 82 | 82 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 83 | - }else{ |
|
| 83 | + } else{ |
|
| 84 | 84 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | public function __construct(Client $client, $charset = 'UTF-8') { |
| 74 | 74 | $this->setClient($client); |
| 75 | 75 | |
| 76 | - if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 76 | + if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
| 77 | + $this->leaveUnread(); |
|
| 78 | + } |
|
| 77 | 79 | |
| 78 | 80 | $this->date_format = ClientManager::get('date_format', 'd M y'); |
| 79 | 81 | |
@@ -111,7 +113,9 @@ discard block |
||
| 111 | 113 | * @throws MessageSearchValidationException |
| 112 | 114 | */ |
| 113 | 115 | protected function parse_date($date) { |
| 114 | - if($date instanceof \Carbon\Carbon) return $date; |
|
| 116 | + if($date instanceof \Carbon\Carbon) { |
|
| 117 | + return $date; |
|
| 118 | + } |
|
| 115 | 119 | |
| 116 | 120 | try { |
| 117 | 121 | $date = Carbon::parse($date); |
@@ -261,7 +265,7 @@ discard block |
||
| 261 | 265 | $messages->each(function($message) use(&$collection){ |
| 262 | 266 | $collection[] = $message; |
| 263 | 267 | }); |
| 264 | - }else{ |
|
| 268 | + } else{ |
|
| 265 | 269 | $collection = array_fill(0, $messages->total(), true); |
| 266 | 270 | } |
| 267 | 271 | |
@@ -281,7 +285,7 @@ discard block |
||
| 281 | 285 | } else { |
| 282 | 286 | if($statement[1] === null){ |
| 283 | 287 | $query .= $statement[0]; |
| 284 | - }else{ |
|
| 288 | + } else{ |
|
| 285 | 289 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 286 | 290 | } |
| 287 | 291 | } |
@@ -311,7 +315,9 @@ discard block |
||
| 311 | 315 | * @return $this |
| 312 | 316 | */ |
| 313 | 317 | public function limit($limit, $page = 1) { |
| 314 | - if($page >= 1) $this->page = $page; |
|
| 318 | + if($page >= 1) { |
|
| 319 | + $this->page = $page; |
|
| 320 | + } |
|
| 315 | 321 | $this->limit = $limit; |
| 316 | 322 | |
| 317 | 323 | return $this; |
@@ -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 | } |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | if($value === null) { |
| 73 | 73 | if(isset(self::$config[$part])) { |
| 74 | 74 | $value = self::$config[$part]; |
| 75 | - }else{ |
|
| 75 | + } else{ |
|
| 76 | 76 | break; |
| 77 | 77 | } |
| 78 | - }else{ |
|
| 78 | + } else{ |
|
| 79 | 79 | if(isset($value[$part])) { |
| 80 | 80 | $value = $value[$part]; |
| 81 | - }else{ |
|
| 81 | + } else{ |
|
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -227,11 +227,15 @@ discard block |
||
| 227 | 227 | $arrays = func_get_args(); |
| 228 | 228 | $base = array_shift($arrays); |
| 229 | 229 | |
| 230 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
| 230 | + if(!is_array($base)) { |
|
| 231 | + $base = empty($base) ? array() : array($base); |
|
| 232 | + } |
|
| 231 | 233 | |
| 232 | 234 | foreach($arrays as $append) { |
| 233 | 235 | |
| 234 | - if(!is_array($append)) $append = array($append); |
|
| 236 | + if(!is_array($append)) { |
|
| 237 | + $append = array($append); |
|
| 238 | + } |
|
| 235 | 239 | |
| 236 | 240 | foreach($append as $key => $value) { |
| 237 | 241 | |
@@ -243,7 +247,9 @@ discard block |
||
| 243 | 247 | if(is_array($value) or is_array($base[$key])) { |
| 244 | 248 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
| 245 | 249 | } else if(is_numeric($key)) { |
| 246 | - if(!in_array($value, $base)) $base[] = $value; |
|
| 250 | + if(!in_array($value, $base)) { |
|
| 251 | + $base[] = $value; |
|
| 252 | + } |
|
| 247 | 253 | } else { |
| 248 | 254 | $base[$key] = $value; |
| 249 | 255 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $value = $this->default_account_config[$key]; |
| 173 | 173 | if(isset($config[$key])) { |
| 174 | 174 | $value = $config[$key]; |
| 175 | - }elseif(isset($default_config[$key])) { |
|
| 175 | + } elseif(isset($default_config[$key])) { |
|
| 176 | 176 | $value = $default_config[$key]; |
| 177 | 177 | } |
| 178 | 178 | $this->$key = $value; |
@@ -206,39 +206,39 @@ discard block |
||
| 206 | 206 | if(isset($config['masks']['message'])) { |
| 207 | 207 | if(class_exists($config['masks']['message'])) { |
| 208 | 208 | $this->default_message_mask = $config['masks']['message']; |
| 209 | - }else{ |
|
| 209 | + } else{ |
|
| 210 | 210 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
| 211 | 211 | } |
| 212 | - }else{ |
|
| 212 | + } else{ |
|
| 213 | 213 | if(class_exists($default_config['message'])) { |
| 214 | 214 | $this->default_message_mask = $default_config['message']; |
| 215 | - }else{ |
|
| 215 | + } else{ |
|
| 216 | 216 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | if(isset($config['masks']['attachment'])) { |
| 220 | 220 | if(class_exists($config['masks']['attachment'])) { |
| 221 | 221 | $this->default_message_mask = $config['masks']['attachment']; |
| 222 | - }else{ |
|
| 222 | + } else{ |
|
| 223 | 223 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
| 224 | 224 | } |
| 225 | - }else{ |
|
| 225 | + } else{ |
|
| 226 | 226 | if(class_exists($default_config['attachment'])) { |
| 227 | 227 | $this->default_message_mask = $default_config['attachment']; |
| 228 | - }else{ |
|
| 228 | + } else{ |
|
| 229 | 229 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | - }else{ |
|
| 232 | + } else{ |
|
| 233 | 233 | if(class_exists($default_config['message'])) { |
| 234 | 234 | $this->default_message_mask = $default_config['message']; |
| 235 | - }else{ |
|
| 235 | + } else{ |
|
| 236 | 236 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if(class_exists($default_config['attachment'])) { |
| 240 | 240 | $this->default_message_mask = $default_config['attachment']; |
| 241 | - }else{ |
|
| 241 | + } else{ |
|
| 242 | 242 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 243 | 243 | } |
| 244 | 244 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
| 303 | 303 | $this->connection = new ImapProtocol($this->validate_cert); |
| 304 | 304 | $this->connection->setConnectionTimeout($timeout); |
| 305 | - }else{ |
|
| 305 | + } else{ |
|
| 306 | 306 | if (extension_loaded('imap') === false) { |
| 307 | 307 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
| 308 | 308 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | try { |
| 329 | 329 | if ($this->authentication == "oauth") { |
| 330 | 330 | $this->connection->authenticate($this->username, $this->password); |
| 331 | - }else{ |
|
| 331 | + } else{ |
|
| 332 | 332 | $this->connection->login($this->username, $this->password); |
| 333 | 333 | } |
| 334 | 334 | } catch (\Exception $e) { |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | return $folders; |
| 396 | - }else{ |
|
| 396 | + } else{ |
|
| 397 | 397 | throw new FolderFetchingException("failed to fetch any folders"); |
| 398 | 398 | } |
| 399 | 399 | } |
@@ -427,7 +427,9 @@ discard block |
||
| 427 | 427 | public function createFolder($folder, $expunge = true) { |
| 428 | 428 | $this->checkConnection(); |
| 429 | 429 | $status = $this->connection->createFolder($folder); |
| 430 | - if($expunge) $this->expunge(); |
|
| 430 | + if($expunge) { |
|
| 431 | + $this->expunge(); |
|
| 432 | + } |
|
| 431 | 433 | |
| 432 | 434 | $folder = $this->getFolder($folder); |
| 433 | 435 | if($status && $folder) { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if ($prev_header !== null) { |
| 170 | 170 | $headers[$prev_header][] = $line; |
| 171 | 171 | } |
| 172 | - }else{ |
|
| 172 | + } else{ |
|
| 173 | 173 | if (($pos = strpos($line, ":")) > 0) { |
| 174 | 174 | $key = strtolower(substr($line, 0, $pos)); |
| 175 | 175 | $value = trim(rtrim(strtolower(substr($line, $pos + 1)))); |
@@ -180,7 +180,9 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | foreach($headers as $key => $values) { |
| 183 | - if (isset($imap_headers[$key])) continue; |
|
| 183 | + if (isset($imap_headers[$key])) { |
|
| 184 | + continue; |
|
| 185 | + } |
|
| 184 | 186 | $value = null; |
| 185 | 187 | switch($key){ |
| 186 | 188 | case 'from': |
@@ -298,9 +300,9 @@ discard block |
||
| 298 | 300 | return EncodingAliases::get($parameter->value, $this->fallback_encoding); |
| 299 | 301 | } |
| 300 | 302 | } |
| 301 | - }elseif (property_exists($structure, 'charset')) { |
|
| 303 | + } elseif (property_exists($structure, 'charset')) { |
|
| 302 | 304 | return EncodingAliases::get($structure->charset, $this->fallback_encoding); |
| 303 | - }elseif (is_string($structure) === true){ |
|
| 305 | + } elseif (is_string($structure) === true){ |
|
| 304 | 306 | return mb_detect_encoding($structure); |
| 305 | 307 | } |
| 306 | 308 | |
@@ -326,9 +328,9 @@ discard block |
||
| 326 | 328 | if ($this->notDecoded($original_value, $value)) { |
| 327 | 329 | $value = $this->mime_header_decode(imap_utf8($value)); |
| 328 | 330 | } |
| 329 | - }elseif($decoder === 'iconv') { |
|
| 331 | + } elseif($decoder === 'iconv') { |
|
| 330 | 332 | $value = iconv_mime_decode($value); |
| 331 | - }else{ |
|
| 333 | + } else{ |
|
| 332 | 334 | $value = mb_decode_mimeheader($value); |
| 333 | 335 | } |
| 334 | 336 | |
@@ -344,7 +346,9 @@ discard block |
||
| 344 | 346 | * Try to extract the priority from a given raw header string |
| 345 | 347 | */ |
| 346 | 348 | private function findPriority() { |
| 347 | - if(($priority = $this->get("x-priority")) === null) return; |
|
| 349 | + if(($priority = $this->get("x-priority")) === null) { |
|
| 350 | + return; |
|
| 351 | + } |
|
| 348 | 352 | switch($priority){ |
| 349 | 353 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
| 350 | 354 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |