@@ -58,7 +58,7 @@ discard block  | 
                                                    ||
| 58 | 58 | * If however the default account is missing a parameter the package default account parameter will be used.  | 
                                                        
| 59 | 59 | * This can be disabled by setting imap.default in your config file to 'false'  | 
                                                        
| 60 | 60 | */  | 
                                                        
| 61 | -    private function setVendorConfig(){ | 
                                                        |
| 61 | +    private function setVendorConfig() { | 
                                                        |
| 62 | 62 | |
| 63 | 63 | $config_key = 'imap';  | 
                                                        
| 64 | 64 | $path = __DIR__.'/../../config/'.$config_key.'.php';  | 
                                                        
@@ -70,17 +70,17 @@ discard block  | 
                                                    ||
| 70 | 70 | |
| 71 | 71 | $config = $this->app['config']->get($config_key);  | 
                                                        
| 72 | 72 | |
| 73 | -        if(is_array($config)){ | 
                                                        |
| 74 | -            if(isset($config['default'])){ | 
                                                        |
| 75 | -                if(isset($config['accounts']) && $config['default'] != false){ | 
                                                        |
| 73 | +        if (is_array($config)) { | 
                                                        |
| 74 | +            if (isset($config['default'])) { | 
                                                        |
| 75 | +                if (isset($config['accounts']) && $config['default'] != false) { | 
                                                        |
| 76 | 76 | |
| 77 | 77 | $default_config = $vendor_config['accounts']['default'];  | 
                                                        
| 78 | -                    if(isset($config['accounts'][$config['default']])){ | 
                                                        |
| 78 | +                    if (isset($config['accounts'][$config['default']])) { | 
                                                        |
| 79 | 79 | $default_config = array_merge($default_config, $config['accounts'][$config['default']]);  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
| 82 | -                    if(is_array($config['accounts'])){ | 
                                                        |
| 83 | -                        foreach($config['accounts'] as $account_key => $account){ | 
                                                        |
| 82 | +                    if (is_array($config['accounts'])) { | 
                                                        |
| 83 | +                        foreach ($config['accounts'] as $account_key => $account) { | 
                                                        |
| 84 | 84 | $config['accounts'][$account_key] = array_merge($default_config, $account);  | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | }  | 
                                                        
@@ -114,23 +114,23 @@ discard block  | 
                                                    ||
| 114 | 114 | $arrays = func_get_args();  | 
                                                        
| 115 | 115 | $base = array_shift($arrays);  | 
                                                        
| 116 | 116 | |
| 117 | - if(!is_array($base)) $base = empty($base) ? array() : array($base);  | 
                                                        |
| 117 | + if (!is_array($base)) $base = empty($base) ? array() : array($base);  | 
                                                        |
| 118 | 118 | |
| 119 | -        foreach($arrays as $append) { | 
                                                        |
| 119 | +        foreach ($arrays as $append) { | 
                                                        |
| 120 | 120 | |
| 121 | - if(!is_array($append)) $append = array($append);  | 
                                                        |
| 121 | + if (!is_array($append)) $append = array($append);  | 
                                                        |
| 122 | 122 | |
| 123 | -            foreach($append as $key => $value) { | 
                                                        |
| 123 | +            foreach ($append as $key => $value) { | 
                                                        |
| 124 | 124 | |
| 125 | -                if(!array_key_exists($key, $base) and !is_numeric($key)) { | 
                                                        |
| 125 | +                if (!array_key_exists($key, $base) and !is_numeric($key)) { | 
                                                        |
| 126 | 126 | $base[$key] = $append[$key];  | 
                                                        
| 127 | 127 | continue;  | 
                                                        
| 128 | 128 | }  | 
                                                        
| 129 | 129 | |
| 130 | -                if(is_array($value) or is_array($base[$key])) { | 
                                                        |
| 130 | +                if (is_array($value) or is_array($base[$key])) { | 
                                                        |
| 131 | 131 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);  | 
                                                        
| 132 | -                } else if(is_numeric($key)) { | 
                                                        |
| 133 | - if(!in_array($value, $base)) $base[] = $value;  | 
                                                        |
| 132 | +                } else if (is_numeric($key)) { | 
                                                        |
| 133 | + if (!in_array($value, $base)) $base[] = $value;  | 
                                                        |
| 134 | 134 |                  } else { | 
                                                        
| 135 | 135 | $base[$key] = $value;  | 
                                                        
| 136 | 136 | }  | 
                                                        
@@ -114,11 +114,15 @@ discard block  | 
                                                    ||
| 114 | 114 | $arrays = func_get_args();  | 
                                                        
| 115 | 115 | $base = array_shift($arrays);  | 
                                                        
| 116 | 116 | |
| 117 | - if(!is_array($base)) $base = empty($base) ? array() : array($base);  | 
                                                        |
| 117 | +        if(!is_array($base)) { | 
                                                        |
| 118 | + $base = empty($base) ? array() : array($base);  | 
                                                        |
| 119 | + }  | 
                                                        |
| 118 | 120 | |
| 119 | 121 |          foreach($arrays as $append) { | 
                                                        
| 120 | 122 | |
| 121 | - if(!is_array($append)) $append = array($append);  | 
                                                        |
| 123 | +            if(!is_array($append)) { | 
                                                        |
| 124 | + $append = array($append);  | 
                                                        |
| 125 | + }  | 
                                                        |
| 122 | 126 | |
| 123 | 127 |              foreach($append as $key => $value) { | 
                                                        
| 124 | 128 | |
@@ -130,7 +134,9 @@ discard block  | 
                                                    ||
| 130 | 134 |                  if(is_array($value) or is_array($base[$key])) { | 
                                                        
| 131 | 135 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);  | 
                                                        
| 132 | 136 |                  } else if(is_numeric($key)) { | 
                                                        
| 133 | - if(!in_array($value, $base)) $base[] = $value;  | 
                                                        |
| 137 | +                    if(!in_array($value, $base)) { | 
                                                        |
| 138 | + $base[] = $value;  | 
                                                        |
| 139 | + }  | 
                                                        |
| 134 | 140 |                  } else { | 
                                                        
| 135 | 141 | $base[$key] = $value;  | 
                                                        
| 136 | 142 | }  | 
                                                        
@@ -45,7 +45,9 @@ discard block  | 
                                                    ||
| 45 | 45 | */  | 
                                                        
| 46 | 46 |      public function getCustomHTMLBody($callback = false) { | 
                                                        
| 47 | 47 | $body = $this->getHtmlBody();  | 
                                                        
| 48 | - if($body === null) return null;  | 
                                                        |
| 48 | +        if($body === null) { | 
                                                        |
| 49 | + return null;  | 
                                                        |
| 50 | + }  | 
                                                        |
| 49 | 51 | |
| 50 | 52 |          if ($callback !== false) { | 
                                                        
| 51 | 53 | $aAttachment = $this->parent->getAttachments();  | 
                                                        
@@ -53,7 +55,7 @@ discard block  | 
                                                    ||
| 53 | 55 | /** @var Attachment $oAttachment */  | 
                                                        
| 54 | 56 |                  if(is_callable($callback)) { | 
                                                        
| 55 | 57 | $body = $callback($body, $oAttachment);  | 
                                                        
| 56 | -                }elseif(is_string($callback)) { | 
                                                        |
| 58 | +                } elseif(is_string($callback)) { | 
                                                        |
| 57 | 59 | call_user_func($callback, [$body, $oAttachment]);  | 
                                                        
| 58 | 60 | }  | 
                                                        
| 59 | 61 | });  | 
                                                        
@@ -29,7 +29,7 @@ discard block  | 
                                                    ||
| 29 | 29 | * Get the message html body  | 
                                                        
| 30 | 30 | * @return null  | 
                                                        
| 31 | 31 | */  | 
                                                        
| 32 | -    public function getHtmlBody(){ | 
                                                        |
| 32 | +    public function getHtmlBody() { | 
                                                        |
| 33 | 33 | $bodies = $this->parent->getBodies();  | 
                                                        
| 34 | 34 |          if (!isset($bodies['html'])) { | 
                                                        
| 35 | 35 | return null;  | 
                                                        
@@ -46,15 +46,15 @@ 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) return null;  | 
                                                        |
| 50 | 50 | |
| 51 | 51 |          if ($callback !== false) { | 
                                                        
| 52 | 52 | $aAttachment = $this->parent->getAttachments();  | 
                                                        
| 53 | 53 |              $aAttachment->each(function($oAttachment) use(&$body, $callback) { | 
                                                        
| 54 | 54 | /** @var Attachment $oAttachment */  | 
                                                        
| 55 | -                if(is_callable($callback)) { | 
                                                        |
| 55 | +                if (is_callable($callback)) { | 
                                                        |
| 56 | 56 | $body = $callback($body, $oAttachment);  | 
                                                        
| 57 | -                }elseif(is_string($callback)) { | 
                                                        |
| 57 | +                }elseif (is_string($callback)) { | 
                                                        |
| 58 | 58 | call_user_func($callback, [$body, $oAttachment]);  | 
                                                        
| 59 | 59 | }  | 
                                                        
| 60 | 60 | });  | 
                                                        
@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | * @return string|null  | 
                                                        
| 71 | 71 | */  | 
                                                        
| 72 | 72 |      public function getHTMLBodyWithEmbeddedBase64Images() { | 
                                                        
| 73 | -        return $this->getCustomHTMLBody(function($body, $oAttachment){ | 
                                                        |
| 73 | +        return $this->getCustomHTMLBody(function($body, $oAttachment) { | 
                                                        |
| 74 | 74 | /** @var \Webklex\IMAP\Attachment $oAttachment */  | 
                                                        
| 75 | 75 |              if ($oAttachment->id && $oAttachment->getImgSrc() != null) { | 
                                                        
| 76 | 76 |                  $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); | 
                                                        
@@ -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 | |
@@ -20,7 +20,7 @@  | 
                                                    ||
| 20 | 20 | /** @var \Webklex\IMAP\Message $message */  | 
                                                        
| 21 | 21 | $message = $folder->query()->limit(1)->get()->first();  | 
                                                        
| 22 | 22 | |
| 23 | -$html = $message->getHTMLBody(function($body, $oAttachment){ | 
                                                        |
| 23 | +$html = $message->getHTMLBody(function($body, $oAttachment) { | 
                                                        |
| 24 | 24 | /** @var \Webklex\IMAP\Attachment $oAttachment */  | 
                                                        
| 25 | 25 |      if ($oAttachment->id && $oAttachment->getImgSrc() != null) { | 
                                                        
| 26 | 26 | $oMessage = $oAttachment->getMessage();  | 
                                                        
@@ -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 | |
@@ -39,7 +39,7 @@ discard block  | 
                                                    ||
| 39 | 39 |      public function __construct($parent) { | 
                                                        
| 40 | 40 | $this->parent = $parent;  | 
                                                        
| 41 | 41 | |
| 42 | -        if(method_exists($this->parent, 'getAttributes')){ | 
                                                        |
| 42 | +        if (method_exists($this->parent, 'getAttributes')) { | 
                                                        |
| 43 | 43 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes());  | 
                                                        
| 44 | 44 | }  | 
                                                        
| 45 | 45 | |
@@ -49,7 +49,7 @@ discard block  | 
                                                    ||
| 49 | 49 | /**  | 
                                                        
| 50 | 50 | * Boot method made to be used by any custom mask  | 
                                                        
| 51 | 51 | */  | 
                                                        
| 52 | -    protected function boot(){} | 
                                                        |
| 52 | +    protected function boot() {} | 
                                                        |
| 53 | 53 | |
| 54 | 54 | /**  | 
                                                        
| 55 | 55 | * Call dynamic attribute setter and getter methods and inherit the parent calls  | 
                                                        
@@ -60,17 +60,17 @@ discard block  | 
                                                    ||
| 60 | 60 | * @throws MethodNotFoundException  | 
                                                        
| 61 | 61 | */  | 
                                                        
| 62 | 62 |      public function __call($method, $arguments) { | 
                                                        
| 63 | -        if(strtolower(substr($method, 0, 3)) === 'get') { | 
                                                        |
| 63 | +        if (strtolower(substr($method, 0, 3)) === 'get') { | 
                                                        |
| 64 | 64 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 65 | 65 | |
| 66 | -            if(isset($this->attributes[$name])) { | 
                                                        |
| 66 | +            if (isset($this->attributes[$name])) { | 
                                                        |
| 67 | 67 | return $this->attributes[$name];  | 
                                                        
| 68 | 68 | }  | 
                                                        
| 69 | 69 | |
| 70 | 70 |          }elseif (strtolower(substr($method, 0, 3)) === 'set') { | 
                                                        
| 71 | 71 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 72 | 72 | |
| 73 | -            if(isset($this->attributes[$name])) { | 
                                                        |
| 73 | +            if (isset($this->attributes[$name])) { | 
                                                        |
| 74 | 74 | $this->attributes[$name] = array_pop($arguments);  | 
                                                        
| 75 | 75 | |
| 76 | 76 | return $this->attributes[$name];  | 
                                                        
@@ -78,7 +78,7 @@ discard block  | 
                                                    ||
| 78 | 78 | |
| 79 | 79 | }  | 
                                                        
| 80 | 80 | |
| 81 | -        if(method_exists($this->parent, $method) === true){ | 
                                                        |
| 81 | +        if (method_exists($this->parent, $method) === true) { | 
                                                        |
| 82 | 82 | return call_user_func_array([$this->parent, $method], $arguments);  | 
                                                        
| 83 | 83 | }  | 
                                                        
| 84 | 84 | |
@@ -103,7 +103,7 @@ discard block  | 
                                                    ||
| 103 | 103 | * @return mixed|null  | 
                                                        
| 104 | 104 | */  | 
                                                        
| 105 | 105 |      public function __get($name) { | 
                                                        
| 106 | -        if(isset($this->attributes[$name])) { | 
                                                        |
| 106 | +        if (isset($this->attributes[$name])) { | 
                                                        |
| 107 | 107 | return $this->attributes[$name];  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
@@ -113,14 +113,14 @@ discard block  | 
                                                    ||
| 113 | 113 | /**  | 
                                                        
| 114 | 114 | * @return mixed  | 
                                                        
| 115 | 115 | */  | 
                                                        
| 116 | -    public function getParent(){ | 
                                                        |
| 116 | +    public function getParent() { | 
                                                        |
| 117 | 117 | return $this->parent;  | 
                                                        
| 118 | 118 | }  | 
                                                        
| 119 | 119 | |
| 120 | 120 | /**  | 
                                                        
| 121 | 121 | * @return array  | 
                                                        
| 122 | 122 | */  | 
                                                        
| 123 | -    public function getAttributes(){ | 
                                                        |
| 123 | +    public function getAttributes() { | 
                                                        |
| 124 | 124 | return $this->attributes;  | 
                                                        
| 125 | 125 | }  | 
                                                        
| 126 | 126 | |
@@ -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])) { | 
                                                        
@@ -436,14 +436,14 @@  | 
                                                    ||
| 436 | 436 | return $status;  | 
                                                        
| 437 | 437 | }  | 
                                                        
| 438 | 438 | |
| 439 | - /**  | 
                                                        |
| 440 | - * Delete Folder  | 
                                                        |
| 441 | - * @param string $name  | 
                                                        |
| 442 | - * @param boolean $expunge  | 
                                                        |
| 443 | - *  | 
                                                        |
| 444 | - * @return bool  | 
                                                        |
| 445 | - * @throws ConnectionFailedException  | 
                                                        |
| 446 | - */  | 
                                                        |
| 439 | + /**  | 
                                                        |
| 440 | + * Delete Folder  | 
                                                        |
| 441 | + * @param string $name  | 
                                                        |
| 442 | + * @param boolean $expunge  | 
                                                        |
| 443 | + *  | 
                                                        |
| 444 | + * @return bool  | 
                                                        |
| 445 | + * @throws ConnectionFailedException  | 
                                                        |
| 446 | + */  | 
                                                        |
| 447 | 447 |      public function deleteFolder($name, $expunge = true) { | 
                                                        
| 448 | 448 | $this->checkConnection();  | 
                                                        
| 449 | 449 | $status = \imap_deletemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));  | 
                                                        
@@ -173,45 +173,45 @@ discard block  | 
                                                    ||
| 173 | 173 | * @throws MaskNotFoundException  | 
                                                        
| 174 | 174 | */  | 
                                                        
| 175 | 175 |      protected function setMaskFromConfig($config) { | 
                                                        
| 176 | -        $default_config  = config("imap.masks"); | 
                                                        |
| 176 | +        $default_config = config("imap.masks"); | 
                                                        |
| 177 | 177 | |
| 178 | -        if(isset($config['masks'])){ | 
                                                        |
| 179 | -            if(isset($config['masks']['message'])) { | 
                                                        |
| 180 | -                if(class_exists($config['masks']['message'])) { | 
                                                        |
| 178 | +        if (isset($config['masks'])) { | 
                                                        |
| 179 | +            if (isset($config['masks']['message'])) { | 
                                                        |
| 180 | +                if (class_exists($config['masks']['message'])) { | 
                                                        |
| 181 | 181 | $this->default_message_mask = $config['masks']['message'];  | 
                                                        
| 182 | -                }else{ | 
                                                        |
| 182 | +                } else { | 
                                                        |
| 183 | 183 |                      throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); | 
                                                        
| 184 | 184 | }  | 
                                                        
| 185 | -            }else{ | 
                                                        |
| 186 | -                if(class_exists($default_config['message'])) { | 
                                                        |
| 185 | +            } else { | 
                                                        |
| 186 | +                if (class_exists($default_config['message'])) { | 
                                                        |
| 187 | 187 | $this->default_message_mask = $default_config['message'];  | 
                                                        
| 188 | -                }else{ | 
                                                        |
| 188 | +                } else { | 
                                                        |
| 189 | 189 |                      throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); | 
                                                        
| 190 | 190 | }  | 
                                                        
| 191 | 191 | }  | 
                                                        
| 192 | -            if(isset($config['masks']['attachment'])) { | 
                                                        |
| 193 | -                if(class_exists($config['masks']['attachment'])) { | 
                                                        |
| 192 | +            if (isset($config['masks']['attachment'])) { | 
                                                        |
| 193 | +                if (class_exists($config['masks']['attachment'])) { | 
                                                        |
| 194 | 194 | $this->default_message_mask = $config['masks']['attachment'];  | 
                                                        
| 195 | -                }else{ | 
                                                        |
| 195 | +                } else { | 
                                                        |
| 196 | 196 |                      throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); | 
                                                        
| 197 | 197 | }  | 
                                                        
| 198 | -            }else{ | 
                                                        |
| 199 | -                if(class_exists($default_config['attachment'])) { | 
                                                        |
| 198 | +            } else { | 
                                                        |
| 199 | +                if (class_exists($default_config['attachment'])) { | 
                                                        |
| 200 | 200 | $this->default_message_mask = $default_config['attachment'];  | 
                                                        
| 201 | -                }else{ | 
                                                        |
| 201 | +                } else { | 
                                                        |
| 202 | 202 |                      throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | 204 | }  | 
                                                        
| 205 | -        }else{ | 
                                                        |
| 206 | -            if(class_exists($default_config['message'])) { | 
                                                        |
| 205 | +        } else { | 
                                                        |
| 206 | +            if (class_exists($default_config['message'])) { | 
                                                        |
| 207 | 207 | $this->default_message_mask = $default_config['message'];  | 
                                                        
| 208 | -            }else{ | 
                                                        |
| 208 | +            } else { | 
                                                        |
| 209 | 209 |                  throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); | 
                                                        
| 210 | 210 | }  | 
                                                        
| 211 | 211 | |
| 212 | -            if(class_exists($default_config['attachment'])) { | 
                                                        |
| 212 | +            if (class_exists($default_config['attachment'])) { | 
                                                        |
| 213 | 213 | $this->default_message_mask = $default_config['attachment'];  | 
                                                        
| 214 | -            }else{ | 
                                                        |
| 214 | +            } else { | 
                                                        |
| 215 | 215 |                  throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); | 
                                                        
| 216 | 216 | }  | 
                                                        
| 217 | 217 | }  | 
                                                        
@@ -361,7 +361,7 @@ discard block  | 
                                                    ||
| 361 | 361 | $pattern = $parent_folder.($hierarchical ? '%' : '*');  | 
                                                        
| 362 | 362 | |
| 363 | 363 | $items = \imap_getmailboxes($this->connection, $this->getAddress(), $pattern);  | 
                                                        
| 364 | -        if(is_array($items)){ | 
                                                        |
| 364 | +        if (is_array($items)) { | 
                                                        |
| 365 | 365 |              foreach ($items as $item) { | 
                                                        
| 366 | 366 | $folder = new Folder($this, $item);  | 
                                                        
| 367 | 367 | |
@@ -376,7 +376,7 @@ discard block  | 
                                                    ||
| 376 | 376 | }  | 
                                                        
| 377 | 377 | |
| 378 | 378 | return $folders;  | 
                                                        
| 379 | -        }else{ | 
                                                        |
| 379 | +        } else { | 
                                                        |
| 380 | 380 | throw new MailboxFetchingException($this->getLastError());  | 
                                                        
| 381 | 381 | }  | 
                                                        
| 382 | 382 | }  | 
                                                        
@@ -392,7 +392,7 @@ discard block  | 
                                                    ||
| 392 | 392 |      public function openFolder($folder_path, $attempts = 3) { | 
                                                        
| 393 | 393 | $this->checkConnection();  | 
                                                        
| 394 | 394 | |
| 395 | -        if(property_exists($folder_path, 'path')) { | 
                                                        |
| 395 | +        if (property_exists($folder_path, 'path')) { | 
                                                        |
| 396 | 396 | $folder_path = $folder_path->path;  | 
                                                        
| 397 | 397 | }  | 
                                                        
| 398 | 398 | |
@@ -413,8 +413,8 @@ discard block  | 
                                                    ||
| 413 | 413 | */  | 
                                                        
| 414 | 414 |      public function createFolder($name, $expunge = true) { | 
                                                        
| 415 | 415 | $this->checkConnection();  | 
                                                        
| 416 | - $status = \imap_createmailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));  | 
                                                        |
| 417 | - if($expunge) $this->expunge();  | 
                                                        |
| 416 | + $status = \imap_createmailbox($this->getConnection(), $this->getAddress().\imap_utf7_encode($name));  | 
                                                        |
| 417 | + if ($expunge) $this->expunge();  | 
                                                        |
| 418 | 418 | |
| 419 | 419 | return $status;  | 
                                                        
| 420 | 420 | }  | 
                                                        
@@ -430,8 +430,8 @@ discard block  | 
                                                    ||
| 430 | 430 | */  | 
                                                        
| 431 | 431 |      public function renameFolder($old_name, $new_name, $expunge = true) { | 
                                                        
| 432 | 432 | $this->checkConnection();  | 
                                                        
| 433 | - $status = \imap_renamemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($old_name), $this->getAddress() . \imap_utf7_encode($new_name));  | 
                                                        |
| 434 | - if($expunge) $this->expunge();  | 
                                                        |
| 433 | + $status = \imap_renamemailbox($this->getConnection(), $this->getAddress().\imap_utf7_encode($old_name), $this->getAddress().\imap_utf7_encode($new_name));  | 
                                                        |
| 434 | + if ($expunge) $this->expunge();  | 
                                                        |
| 435 | 435 | |
| 436 | 436 | return $status;  | 
                                                        
| 437 | 437 | }  | 
                                                        
@@ -446,8 +446,8 @@ discard block  | 
                                                    ||
| 446 | 446 | */  | 
                                                        
| 447 | 447 |      public function deleteFolder($name, $expunge = true) { | 
                                                        
| 448 | 448 | $this->checkConnection();  | 
                                                        
| 449 | - $status = \imap_deletemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));  | 
                                                        |
| 450 | - if($expunge) $this->expunge();  | 
                                                        |
| 449 | + $status = \imap_deletemailbox($this->getConnection(), $this->getAddress().\imap_utf7_encode($name));  | 
                                                        |
| 450 | + if ($expunge) $this->expunge();  | 
                                                        |
| 451 | 451 | |
| 452 | 452 | return $status;  | 
                                                        
| 453 | 453 | }  | 
                                                        
@@ -541,7 +541,7 @@ discard block  | 
                                                    ||
| 541 | 541 |          if (!$this->validate_cert) { | 
                                                        
| 542 | 542 | $address .= '/novalidate-cert';  | 
                                                        
| 543 | 543 | }  | 
                                                        
| 544 | -        if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { | 
                                                        |
| 544 | +        if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { | 
                                                        |
| 545 | 545 | $address .= '/'.$this->encryption;  | 
                                                        
| 546 | 546 |          } elseif ($this->encryption === "starttls") { | 
                                                        
| 547 | 547 | $address .= '/tls';  | 
                                                        
@@ -664,7 +664,7 @@ discard block  | 
                                                    ||
| 664 | 664 | * @throws InvalidImapTimeoutTypeException  | 
                                                        
| 665 | 665 | */  | 
                                                        
| 666 | 666 |      public function setTimeout($type, $timeout) { | 
                                                        
| 667 | -        if(0 <= $type && $type <= 4) { | 
                                                        |
| 667 | +        if (0 <= $type && $type <= 4) { | 
                                                        |
| 668 | 668 | return \imap_timeout($type, $timeout);  | 
                                                        
| 669 | 669 | }  | 
                                                        
| 670 | 670 | |
@@ -678,8 +678,8 @@ discard block  | 
                                                    ||
| 678 | 678 | * @return mixed  | 
                                                        
| 679 | 679 | * @throws InvalidImapTimeoutTypeException  | 
                                                        
| 680 | 680 | */  | 
                                                        
| 681 | -    public function getTimeout($type){ | 
                                                        |
| 682 | -        if(0 <= $type && $type <= 4) { | 
                                                        |
| 681 | +    public function getTimeout($type) { | 
                                                        |
| 682 | +        if (0 <= $type && $type <= 4) { | 
                                                        |
| 683 | 683 | return \imap_timeout($type);  | 
                                                        
| 684 | 684 | }  | 
                                                        
| 685 | 685 | |
@@ -689,7 +689,7 @@ discard block  | 
                                                    ||
| 689 | 689 | /**  | 
                                                        
| 690 | 690 | * @return string  | 
                                                        
| 691 | 691 | */  | 
                                                        
| 692 | -    public function getDefaultMessageMask(){ | 
                                                        |
| 692 | +    public function getDefaultMessageMask() { | 
                                                        |
| 693 | 693 | return $this->default_message_mask;  | 
                                                        
| 694 | 694 | }  | 
                                                        
| 695 | 695 | |
@@ -700,7 +700,7 @@ discard block  | 
                                                    ||
| 700 | 700 | * @throws MaskNotFoundException  | 
                                                        
| 701 | 701 | */  | 
                                                        
| 702 | 702 |      public function setDefaultMessageMask($mask) { | 
                                                        
| 703 | -        if(class_exists($mask)) { | 
                                                        |
| 703 | +        if (class_exists($mask)) { | 
                                                        |
| 704 | 704 | $this->default_message_mask = $mask;  | 
                                                        
| 705 | 705 | |
| 706 | 706 | return $this;  | 
                                                        
@@ -712,7 +712,7 @@ discard block  | 
                                                    ||
| 712 | 712 | /**  | 
                                                        
| 713 | 713 | * @return string  | 
                                                        
| 714 | 714 | */  | 
                                                        
| 715 | -    public function getDefaultAttachmentMask(){ | 
                                                        |
| 715 | +    public function getDefaultAttachmentMask() { | 
                                                        |
| 716 | 716 | return $this->default_attachment_mask;  | 
                                                        
| 717 | 717 | }  | 
                                                        
| 718 | 718 | |
@@ -723,7 +723,7 @@ discard block  | 
                                                    ||
| 723 | 723 | * @throws MaskNotFoundException  | 
                                                        
| 724 | 724 | */  | 
                                                        
| 725 | 725 |      public function setDefaultAttachmentMask($mask) { | 
                                                        
| 726 | -        if(class_exists($mask)) { | 
                                                        |
| 726 | +        if (class_exists($mask)) { | 
                                                        |
| 727 | 727 | $this->default_attachment_mask = $mask;  | 
                                                        
| 728 | 728 | |
| 729 | 729 | return $this;  | 
                                                        
@@ -737,7 +737,7 @@ discard block  | 
                                                    ||
| 737 | 737 | *  | 
                                                        
| 738 | 738 | * @return Folder  | 
                                                        
| 739 | 739 | */  | 
                                                        
| 740 | -    public function getFolderPath(){ | 
                                                        |
| 740 | +    public function getFolderPath() { | 
                                                        |
| 741 | 741 | return $this->active_folder;  | 
                                                        
| 742 | 742 | }  | 
                                                        
| 743 | 743 | }  | 
                                                        
@@ -179,39 +179,39 @@ discard block  | 
                                                    ||
| 179 | 179 |              if(isset($config['masks']['message'])) { | 
                                                        
| 180 | 180 |                  if(class_exists($config['masks']['message'])) { | 
                                                        
| 181 | 181 | $this->default_message_mask = $config['masks']['message'];  | 
                                                        
| 182 | -                }else{ | 
                                                        |
| 182 | +                } else{ | 
                                                        |
| 183 | 183 |                      throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); | 
                                                        
| 184 | 184 | }  | 
                                                        
| 185 | -            }else{ | 
                                                        |
| 185 | +            } else{ | 
                                                        |
| 186 | 186 |                  if(class_exists($default_config['message'])) { | 
                                                        
| 187 | 187 | $this->default_message_mask = $default_config['message'];  | 
                                                        
| 188 | -                }else{ | 
                                                        |
| 188 | +                } else{ | 
                                                        |
| 189 | 189 |                      throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); | 
                                                        
| 190 | 190 | }  | 
                                                        
| 191 | 191 | }  | 
                                                        
| 192 | 192 |              if(isset($config['masks']['attachment'])) { | 
                                                        
| 193 | 193 |                  if(class_exists($config['masks']['attachment'])) { | 
                                                        
| 194 | 194 | $this->default_message_mask = $config['masks']['attachment'];  | 
                                                        
| 195 | -                }else{ | 
                                                        |
| 195 | +                } else{ | 
                                                        |
| 196 | 196 |                      throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); | 
                                                        
| 197 | 197 | }  | 
                                                        
| 198 | -            }else{ | 
                                                        |
| 198 | +            } else{ | 
                                                        |
| 199 | 199 |                  if(class_exists($default_config['attachment'])) { | 
                                                        
| 200 | 200 | $this->default_message_mask = $default_config['attachment'];  | 
                                                        
| 201 | -                }else{ | 
                                                        |
| 201 | +                } else{ | 
                                                        |
| 202 | 202 |                      throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | 204 | }  | 
                                                        
| 205 | -        }else{ | 
                                                        |
| 205 | +        } else{ | 
                                                        |
| 206 | 206 |              if(class_exists($default_config['message'])) { | 
                                                        
| 207 | 207 | $this->default_message_mask = $default_config['message'];  | 
                                                        
| 208 | -            }else{ | 
                                                        |
| 208 | +            } else{ | 
                                                        |
| 209 | 209 |                  throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); | 
                                                        
| 210 | 210 | }  | 
                                                        
| 211 | 211 | |
| 212 | 212 |              if(class_exists($default_config['attachment'])) { | 
                                                        
| 213 | 213 | $this->default_message_mask = $default_config['attachment'];  | 
                                                        
| 214 | -            }else{ | 
                                                        |
| 214 | +            } else{ | 
                                                        |
| 215 | 215 |                  throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); | 
                                                        
| 216 | 216 | }  | 
                                                        
| 217 | 217 | }  | 
                                                        
@@ -376,7 +376,7 @@ discard block  | 
                                                    ||
| 376 | 376 | }  | 
                                                        
| 377 | 377 | |
| 378 | 378 | return $folders;  | 
                                                        
| 379 | -        }else{ | 
                                                        |
| 379 | +        } else{ | 
                                                        |
| 380 | 380 | throw new MailboxFetchingException($this->getLastError());  | 
                                                        
| 381 | 381 | }  | 
                                                        
| 382 | 382 | }  | 
                                                        
@@ -414,7 +414,9 @@ discard block  | 
                                                    ||
| 414 | 414 |      public function createFolder($name, $expunge = true) { | 
                                                        
| 415 | 415 | $this->checkConnection();  | 
                                                        
| 416 | 416 | $status = \imap_createmailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));  | 
                                                        
| 417 | - if($expunge) $this->expunge();  | 
                                                        |
| 417 | +        if($expunge) { | 
                                                        |
| 418 | + $this->expunge();  | 
                                                        |
| 419 | + }  | 
                                                        |
| 418 | 420 | |
| 419 | 421 | return $status;  | 
                                                        
| 420 | 422 | }  | 
                                                        
@@ -431,7 +433,9 @@ discard block  | 
                                                    ||
| 431 | 433 |      public function renameFolder($old_name, $new_name, $expunge = true) { | 
                                                        
| 432 | 434 | $this->checkConnection();  | 
                                                        
| 433 | 435 | $status = \imap_renamemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($old_name), $this->getAddress() . \imap_utf7_encode($new_name));  | 
                                                        
| 434 | - if($expunge) $this->expunge();  | 
                                                        |
| 436 | +        if($expunge) { | 
                                                        |
| 437 | + $this->expunge();  | 
                                                        |
| 438 | + }  | 
                                                        |
| 435 | 439 | |
| 436 | 440 | return $status;  | 
                                                        
| 437 | 441 | }  | 
                                                        
@@ -447,7 +451,9 @@ discard block  | 
                                                    ||
| 447 | 451 |      public function deleteFolder($name, $expunge = true) { | 
                                                        
| 448 | 452 | $this->checkConnection();  | 
                                                        
| 449 | 453 | $status = \imap_deletemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));  | 
                                                        
| 450 | - if($expunge) $this->expunge();  | 
                                                        |
| 454 | +        if($expunge) { | 
                                                        |
| 455 | + $this->expunge();  | 
                                                        |
| 456 | + }  | 
                                                        |
| 451 | 457 | |
| 452 | 458 | return $status;  | 
                                                        
| 453 | 459 | }  | 
                                                        
@@ -119,7 +119,7 @@ discard block  | 
                                                    ||
| 119 | 119 | |
| 120 | 120 | $this->setDelimiter($structure->delimiter);  | 
                                                        
| 121 | 121 | $this->path = $structure->name;  | 
                                                        
| 122 | - $this->full_name = $this->decodeName($structure->name);  | 
                                                        |
| 122 | + $this->full_name = $this->decodeName($structure->name);  | 
                                                        |
| 123 | 123 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name);  | 
                                                        
| 124 | 124 | |
| 125 | 125 | $this->parseAttributes($structure->attributes);  | 
                                                        
@@ -132,7 +132,7 @@ discard block  | 
                                                    ||
| 132 | 132 | * @return WhereQuery  | 
                                                        
| 133 | 133 | * @throws Exceptions\ConnectionFailedException  | 
                                                        
| 134 | 134 | */  | 
                                                        
| 135 | -    public function query($charset = 'UTF-8'){ | 
                                                        |
| 135 | +    public function query($charset = 'UTF-8') { | 
                                                        |
| 136 | 136 | $this->getClient()->checkConnection();  | 
                                                        
| 137 | 137 | $this->getClient()->openFolder($this->path);  | 
                                                        
| 138 | 138 | |
@@ -143,7 +143,7 @@ discard block  | 
                                                    ||
| 143 | 143 | * @inheritdoc self::query($charset = 'UTF-8')  | 
                                                        
| 144 | 144 | * @throws Exceptions\ConnectionFailedException  | 
                                                        
| 145 | 145 | */  | 
                                                        
| 146 | -    public function search($charset = 'UTF-8'){ | 
                                                        |
| 146 | +    public function search($charset = 'UTF-8') { | 
                                                        |
| 147 | 147 | return $this->query($charset);  | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | * @inheritdoc self::query($charset = 'UTF-8')  | 
                                                        
| 152 | 152 | * @throws Exceptions\ConnectionFailedException  | 
                                                        
| 153 | 153 | */  | 
                                                        
| 154 | -    public function messages($charset = 'UTF-8'){ | 
                                                        |
| 154 | +    public function messages($charset = 'UTF-8') { | 
                                                        |
| 155 | 155 | return $this->query($charset);  | 
                                                        
| 156 | 156 | }  | 
                                                        
| 157 | 157 | |
@@ -316,7 +316,7 @@ discard block  | 
                                                    ||
| 316 | 316 | * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead  | 
                                                        
| 317 | 317 | * @see Folder::query()  | 
                                                        
| 318 | 318 | */  | 
                                                        
| 319 | -    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true,  $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { | 
                                                        |
| 319 | +    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { | 
                                                        |
| 320 | 320 | $this->getClient()->checkConnection();  | 
                                                        
| 321 | 321 | |
| 322 | 322 | return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body)  | 
                                                        
@@ -375,7 +375,7 @@ discard block  | 
                                                    ||
| 375 | 375 | */  | 
                                                        
| 376 | 376 |      public function delete($expunge = true) { | 
                                                        
| 377 | 377 | $status = \imap_deletemailbox($this->client->getConnection(), $this->path);  | 
                                                        
| 378 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 378 | + if ($expunge) $this->client->expunge();  | 
                                                        |
| 379 | 379 | |
| 380 | 380 | return $status;  | 
                                                        
| 381 | 381 | }  | 
                                                        
@@ -392,7 +392,7 @@ discard block  | 
                                                    ||
| 392 | 392 | */  | 
                                                        
| 393 | 393 |      public function move($target_mailbox, $expunge = true) { | 
                                                        
| 394 | 394 | $status = \imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);  | 
                                                        
| 395 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 395 | + if ($expunge) $this->client->expunge();  | 
                                                        |
| 396 | 396 | |
| 397 | 397 | return $status;  | 
                                                        
| 398 | 398 | }  | 
                                                        
@@ -433,7 +433,7 @@ discard block  | 
                                                    ||
| 433 | 433 | */  | 
                                                        
| 434 | 434 | |
| 435 | 435 |          if ($internal_date != null) { | 
                                                        
| 436 | -            if ($internal_date instanceof \Carbon\Carbon){ | 
                                                        |
| 436 | +            if ($internal_date instanceof \Carbon\Carbon) { | 
                                                        |
| 437 | 437 |                  $internal_date = $internal_date->format('d-M-Y H:i:s O'); | 
                                                        
| 438 | 438 | }  | 
                                                        
| 439 | 439 | return \imap_append($this->client->getConnection(), $this->path, $message, $options, $internal_date);  | 
                                                        
@@ -454,8 +454,8 @@ discard block  | 
                                                    ||
| 454 | 454 | /**  | 
                                                        
| 455 | 455 | * @param $delimiter  | 
                                                        
| 456 | 456 | */  | 
                                                        
| 457 | -    public function setDelimiter($delimiter){ | 
                                                        |
| 458 | -        if(in_array($delimiter, [null, '', ' ', false]) === true) { | 
                                                        |
| 457 | +    public function setDelimiter($delimiter) { | 
                                                        |
| 458 | +        if (in_array($delimiter, [null, '', ' ', false]) === true) { | 
                                                        |
| 459 | 459 |              $delimiter = config('imap.options.delimiter', '/'); | 
                                                        
| 460 | 460 | }  | 
                                                        
| 461 | 461 | |
@@ -375,7 +375,9 @@ discard block  | 
                                                    ||
| 375 | 375 | */  | 
                                                        
| 376 | 376 |      public function delete($expunge = true) { | 
                                                        
| 377 | 377 | $status = \imap_deletemailbox($this->client->getConnection(), $this->path);  | 
                                                        
| 378 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 378 | +        if($expunge) { | 
                                                        |
| 379 | + $this->client->expunge();  | 
                                                        |
| 380 | + }  | 
                                                        |
| 379 | 381 | |
| 380 | 382 | return $status;  | 
                                                        
| 381 | 383 | }  | 
                                                        
@@ -392,7 +394,9 @@ discard block  | 
                                                    ||
| 392 | 394 | */  | 
                                                        
| 393 | 395 |      public function move($target_mailbox, $expunge = true) { | 
                                                        
| 394 | 396 | $status = \imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);  | 
                                                        
| 395 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 397 | +        if($expunge) { | 
                                                        |
| 398 | + $this->client->expunge();  | 
                                                        |
| 399 | + }  | 
                                                        |
| 396 | 400 | |
| 397 | 401 | return $status;  | 
                                                        
| 398 | 402 | }  | 
                                                        
@@ -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 | |
@@ -129,13 +129,13 @@ discard block  | 
                                                    ||
| 129 | 129 | }  | 
                                                        
| 130 | 130 | return $this->where($key, $value);  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | -        }else{ | 
                                                        |
| 132 | +        } else{ | 
                                                        |
| 133 | 133 | $criteria = $this->validate_criteria($criteria);  | 
                                                        
| 134 | 134 | $value = $this->parse_value($value);  | 
                                                        
| 135 | 135 | |
| 136 | 136 |              if($value === null || $value === ''){ | 
                                                        
| 137 | 137 | $this->query->push([$criteria]);  | 
                                                        
| 138 | -            }else{ | 
                                                        |
| 138 | +            } else{ | 
                                                        |
| 139 | 139 | $this->query->push([$criteria, $value]);  | 
                                                        
| 140 | 140 | }  | 
                                                        
| 141 | 141 | }  | 
                                                        
@@ -150,7 +150,9 @@ discard block  | 
                                                    ||
| 150 | 150 | */  | 
                                                        
| 151 | 151 |      public function orWhere(\Closure $closure = null) { | 
                                                        
| 152 | 152 | $this->query->push(['OR']);  | 
                                                        
| 153 | - if($closure !== null) $closure($this);  | 
                                                        |
| 153 | +        if($closure !== null) { | 
                                                        |
| 154 | + $closure($this);  | 
                                                        |
| 155 | + }  | 
                                                        |
| 154 | 156 | |
| 155 | 157 | return $this;  | 
                                                        
| 156 | 158 | }  | 
                                                        
@@ -162,7 +164,9 @@ discard block  | 
                                                    ||
| 162 | 164 | */  | 
                                                        
| 163 | 165 |      public function andWhere(\Closure $closure = null) { | 
                                                        
| 164 | 166 | $this->query->push(['AND']);  | 
                                                        
| 165 | - if($closure !== null) $closure($this);  | 
                                                        |
| 167 | +        if($closure !== null) { | 
                                                        |
| 168 | + $closure($this);  | 
                                                        |
| 169 | + }  | 
                                                        |
| 166 | 170 | |
| 167 | 171 | return $this;  | 
                                                        
| 168 | 172 | }  | 
                                                        
@@ -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 | |
@@ -419,7 +419,7 @@ discard block  | 
                                                    ||
| 419 | 419 | * @return WhereQuery  | 
                                                        
| 420 | 420 | * @throws InvalidWhereQueryCriteriaException  | 
                                                        
| 421 | 421 | */  | 
                                                        
| 422 | -    public function whereLanguage($country_code){ | 
                                                        |
| 422 | +    public function whereLanguage($country_code) { | 
                                                        |
| 423 | 423 |          return $this->where("Content-Language $country_code"); | 
                                                        
| 424 | 424 | }  | 
                                                        
| 425 | 425 | }  |