@@ -69,7 +69,7 @@ |
||
69 | 69 | protected function iteratorToLowercaseArray( $iterator ) { |
70 | 70 | $data = []; |
71 | 71 | foreach ( $iterator as $name => $value ) { |
72 | - $data[ strtolower($name) ] = $value; |
|
72 | + $data[strtolower($name)] = $value; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $data; |
@@ -95,7 +95,7 @@ |
||
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - if ( $options['limit'] && isset($messages[ $options['limit'] - 1 ]) ) { |
|
98 | + if ( $options['limit'] && isset($messages[$options['limit'] - 1]) ) { |
|
99 | 99 | break; |
100 | 100 | } |
101 | 101 | } |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | $this->parameters['bytes'] = @$structure->bytes; |
48 | 48 | |
49 | 49 | foreach ( (array) @$structure->parameters as $param ) { |
50 | - $this->parameters[ strtolower($param->attribute) ] = $param->value; |
|
50 | + $this->parameters[strtolower($param->attribute)] = $param->value; |
|
51 | 51 | } |
52 | 52 | foreach ( (array) @$structure->dparameters as $param ) { |
53 | - $this->parameters[ strtolower($param->attribute) ] = $param->value; |
|
53 | + $this->parameters[strtolower($param->attribute)] = $param->value; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function parameter( $name ) { |
62 | 62 | $parameters = $this->parameters(); |
63 | 63 | $structure = $this->structure(); |
64 | - return @$parameters[ strtolower($name) ] ?: @$structure->$name; |
|
64 | + return @$parameters[strtolower($name)] ?: @$structure->$name; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** @return string[] */ |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | $headers = array_map('mb_decode_mimeheader', $headers); |
72 | 72 | |
73 | 73 | $this->headers = []; |
74 | - foreach ($headers as $header) { |
|
74 | + foreach ( $headers as $header ) { |
|
75 | 75 | $x = explode(':', $header, 2); |
76 | - $this->headers[ trim(strtolower($x[0])) ][] = trim($x[1]); |
|
76 | + $this->headers[trim(strtolower($x[0]))][] = trim($x[1]); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $parts = $recursive ? $this->allParts() : $this->parts(); |
95 | 95 | array_unshift($parts, $this); |
96 | 96 | |
97 | - return array_values(array_filter($parts, function(IMAPMessagePartInterface $part) use ($subtypes) { |
|
97 | + return array_values(array_filter($parts, function( IMAPMessagePartInterface $part ) use ($subtypes) { |
|
98 | 98 | return in_array($part->subtype(), $subtypes); |
99 | 99 | })); |
100 | 100 | } |
@@ -179,7 +179,7 @@ |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | if ( $bytes = $part->parameter('bytes') ) { |
182 | - $name .= ' (' . number_format($bytes/1024, 1) . 'kb)'; |
|
182 | + $name .= ' (' . number_format($bytes / 1024, 1) . 'kb)'; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $parts[] = $name; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | /** @return string */ |
59 | 59 | public function safeFilename() { |
60 | - if ($filename = $this->filename()) { |
|
60 | + if ( $filename = $this->filename() ) { |
|
61 | 61 | return trim(preg_replace('#_+#', '_', preg_replace('#[^a-z0-9\-_\.]+#i', '', $filename)), '_'); |
62 | 62 | } |
63 | 63 | } |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** @return string */ |
74 | 74 | public function decodedContent() { |
75 | - if ($raw = $this->content()) { |
|
76 | - switch ($this->parameter('encoding')) { |
|
75 | + if ( $raw = $this->content() ) { |
|
76 | + switch ( $this->parameter('encoding') ) { |
|
77 | 77 | case ENC7BIT: |
78 | 78 | case ENC8BIT: |
79 | 79 | case ENCQUOTEDPRINTABLE: |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | /** @return string */ |
91 | 91 | public function headerString() { |
92 | - if ($this->subtype() == 'RFC822') { |
|
92 | + if ( $this->subtype() == 'RFC822' ) { |
|
93 | 93 | $x = explode("\r\n\r\n", $this->content()); |
94 | 94 | return trim($x[0]); |
95 | 95 | } |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | /** @return bool */ |
101 | - public function saveAttachment($dir, $filenameOverride = null) { |
|
102 | - if ($filename = $this->safeFilename()) { |
|
101 | + public function saveAttachment( $dir, $filenameOverride = null ) { |
|
102 | + if ( $filename = $this->safeFilename() ) { |
|
103 | 103 | $filepath = realpath($dir) . '/' . ($filenameOverride ?? $filename); |
104 | - if (file_put_contents($filepath, $this->decodedContent())) { |
|
104 | + if ( file_put_contents($filepath, $this->decodedContent()) ) { |
|
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | } |