Completed
Push — master ( 7ee17a...53dc02 )
by Malte
326:57 queued 225:36
created
src/Query/Query.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
         $this->setClient($client);
81 81
 
82 82
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
83
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
83
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
84 84
 
85 85
         if (ClientManager::get('options.fetch_order') === 'desc') {
86 86
             $this->fetch_order = 'desc';
87
-        } else {
87
+        }else {
88 88
             $this->fetch_order = 'asc';
89 89
         }
90 90
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * Instance boot method for additional functionality
100 100
      */
101
-    protected function boot(){}
101
+    protected function boot() {}
102 102
 
103 103
     /**
104 104
      * Parse a given value
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @return string
108 108
      */
109
-    protected function parse_value($value){
110
-        switch(true){
109
+    protected function parse_value($value) {
110
+        switch (true) {
111 111
             case $value instanceof \Carbon\Carbon:
112 112
                 $value = $value->format($this->date_format);
113 113
                 break;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @throws MessageSearchValidationException
125 125
      */
126 126
     protected function parse_date($date) {
127
-        if($date instanceof \Carbon\Carbon) return $date;
127
+        if ($date instanceof \Carbon\Carbon) return $date;
128 128
 
129 129
         try {
130 130
             $date = Carbon::parse($date);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @return Collection
176 176
      * @throws GetMessagesFailedException
177 177
      */
178
-    protected function search(){
178
+    protected function search() {
179 179
         $this->generate_query();
180 180
 
181 181
         try {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     $raw_flag = isset($raw_flags[$uid]) ? $raw_flags[$uid] : [];
241 241
 
242 242
                     $message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence);
243
-                    switch ($message_key){
243
+                    switch ($message_key) {
244 244
                         case 'number':
245 245
                             $key = $message->getMessageNo();
246 246
                             break;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
             return $messages;
264 264
         } catch (\Exception $e) {
265
-            throw new GetMessagesFailedException($e->getMessage(),0, $e);
265
+            throw new GetMessagesFailedException($e->getMessage(), 0, $e);
266 266
         }
267 267
     }
268 268
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
282 282
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
283 283
      */
284
-    public function getMessage($uid, $msglist = null, $sequence = null){
284
+    public function getMessage($uid, $msglist = null, $sequence = null) {
285 285
         return new Message($uid, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags(), $sequence ? $sequence : $this->sequence);
286 286
     }
287 287
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
300 300
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
301 301
      */
302
-    public function getMessageByMsgn($msgn, $msglist = null){
302
+    public function getMessageByMsgn($msgn, $msglist = null) {
303 303
         return $this->getMessage($msgn, $msglist, IMAP::ST_MSGN);
304 304
     }
305 305
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
317 317
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
318 318
      */
319
-    public function getMessageByUid($uid){
319
+    public function getMessageByUid($uid) {
320 320
         return $this->getMessage($uid, null, IMAP::ST_UID);
321 321
     }
322 322
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @return LengthAwarePaginator
330 330
      * @throws GetMessagesFailedException
331 331
      */
332
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
332
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
333 333
         if (
334 334
                $page === null
335 335
             && isset($_GET[$page_name])
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
         $this->query->each(function($statement) use(&$query) {
356 356
             if (count($statement) == 1) {
357 357
                 $query .= $statement[0];
358
-            } else {
359
-                if($statement[1] === null){
358
+            }else {
359
+                if ($statement[1] === null) {
360 360
                     $query .= $statement[0];
361
-                }else{
361
+                }else {
362 362
                     $query .= $statement[0].' "'.$statement[1].'"';
363 363
                 }
364 364
             }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @return $this
389 389
      */
390 390
     public function limit($limit, $page = 1) {
391
-        if($page >= 1) $this->page = $page;
391
+        if ($page >= 1) $this->page = $page;
392 392
         $this->limit = $limit;
393 393
 
394 394
         return $this;
Please login to merge, or discard this patch.
src/Structure.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @throws MessageContentFetchingException
78 78
      * @throws InvalidMessageDateException
79 79
      */
80
-    protected function parse(){
80
+    protected function parse() {
81 81
         $this->findContentType();
82 82
         $this->parts = $this->find_parts();
83 83
     }
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Determine the message content type
87 87
      */
88
-    public function findContentType(){
88
+    public function findContentType() {
89 89
 
90 90
         $content_type = $this->header->get("content_type");
91 91
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
92
-        if(stripos($content_type, 'multipart') === 0) {
92
+        if (stripos($content_type, 'multipart') === 0) {
93 93
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
94
-        }else{
94
+        }else {
95 95
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
96 96
         }
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return string|null
103 103
      */
104
-    public function getBoundary(){
104
+    public function getBoundary() {
105 105
         $boundary = $this->header->find("/boundary=\"?([^\"]*)[\";\s]/i");
106 106
 
107 107
         if ($boundary === null) {
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
      * @throws MessageContentFetchingException
119 119
      * @throws InvalidMessageDateException
120 120
      */
121
-    public function find_parts(){
122
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
123
-            if (($boundary = $this->getBoundary()) === null)  {
121
+    public function find_parts() {
122
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
123
+            if (($boundary = $this->getBoundary()) === null) {
124 124
                 throw new MessageContentFetchingException("no content found", 0);
125 125
             }
126 126
 
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
             ];
130 130
 
131 131
             if (preg_match("/boundary\=\"?(.*)\"?/", $this->raw, $match) == 1) {
132
-                if(is_array($match[1])){
133
-                    foreach($match[1] as $matched){
132
+                if (is_array($match[1])) {
133
+                    foreach ($match[1] as $matched) {
134 134
                         $boundaries[] = str_replace('"', '', $matched);
135 135
                     }
136
-                }else{
137
-                    if(!empty($match[1])) {
136
+                }else {
137
+                    if (!empty($match[1])) {
138 138
                         $boundaries[] = str_replace('"', '', $match[1]);
139 139
                     }
140 140
                 }
141 141
             }
142 142
 
143
-            $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) );
143
+            $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw));
144 144
             $parts = [];
145 145
             $part_number = 0;
146
-            foreach($raw_parts as $part) {
146
+            foreach ($raw_parts as $part) {
147 147
                 $part = trim(rtrim($part));
148 148
                 if ($part !== "--") {
149 149
                     $parts[] = new Part($part, null, $part_number);
Please login to merge, or discard this patch.