@@ -29,6 +29,9 @@ discard block |
||
29 | 29 | return $parts; |
30 | 30 | } |
31 | 31 | |
32 | + /** |
|
33 | + * @param integer $index |
|
34 | + */ |
|
32 | 35 | public function part( $index ) { |
33 | 36 | $parts = $this->parts(); |
34 | 37 | return @$parts[$index]; |
@@ -56,6 +59,9 @@ discard block |
||
56 | 59 | return @$parameters[ strtolower($name) ]; |
57 | 60 | } |
58 | 61 | |
62 | + /** |
|
63 | + * @param boolean $recursive |
|
64 | + */ |
|
59 | 65 | protected function subtypeContent( $subtypes, $recursive ) { |
60 | 66 | $subtypes = (array) $subtypes; |
61 | 67 | foreach ( $this->parts($recursive) as $part ) { |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | protected $parts = []; // Array<rdx\imap\IMAPMessagePart> |
9 | 9 | protected $parameters = []; |
10 | 10 | |
11 | - public function allParts( $withContainers = false ) { |
|
11 | + public function allParts($withContainers = false) { |
|
12 | 12 | $parts = []; |
13 | 13 | $iterate = function($message) use (&$iterate, &$parts, $withContainers) { |
14 | - foreach ( $message->parts() as $part ) { |
|
15 | - if ( $part->parts() ) { |
|
16 | - if ( $withContainers ) { |
|
14 | + foreach ($message->parts() as $part) { |
|
15 | + if ($part->parts()) { |
|
16 | + if ($withContainers) { |
|
17 | 17 | $parts[] = $part; |
18 | 18 | } |
19 | 19 | |
@@ -29,51 +29,51 @@ discard block |
||
29 | 29 | return $parts; |
30 | 30 | } |
31 | 31 | |
32 | - public function part( $index ) { |
|
32 | + public function part($index) { |
|
33 | 33 | $parts = $this->parts(); |
34 | 34 | return @$parts[$index]; |
35 | 35 | } |
36 | 36 | |
37 | 37 | public function parameters() { |
38 | - if ( empty($this->parameters) ) { |
|
38 | + if (empty($this->parameters)) { |
|
39 | 39 | $structure = $this->structure(); |
40 | 40 | |
41 | 41 | $this->parameters['bytes'] = @$structure->bytes; |
42 | 42 | |
43 | - foreach ((array) @$structure->parameters as $param) { |
|
44 | - $this->parameters[ strtolower($param->attribute) ] = $param->value; |
|
43 | + foreach ((array)@$structure->parameters as $param) { |
|
44 | + $this->parameters[strtolower($param->attribute)] = $param->value; |
|
45 | 45 | } |
46 | - foreach ((array) @$structure->dparameters as $param) { |
|
47 | - $this->parameters[ strtolower($param->attribute) ] = $param->value; |
|
46 | + foreach ((array)@$structure->dparameters as $param) { |
|
47 | + $this->parameters[strtolower($param->attribute)] = $param->value; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this->parameters; |
52 | 52 | } |
53 | 53 | |
54 | - public function parameter( $name ) { |
|
54 | + public function parameter($name) { |
|
55 | 55 | $parameters = $this->parameters(); |
56 | - return @$parameters[ strtolower($name) ]; |
|
56 | + return @$parameters[strtolower($name)]; |
|
57 | 57 | } |
58 | 58 | |
59 | - protected function subtypeContent( $subtypes, $recursive ) { |
|
60 | - $subtypes = (array) $subtypes; |
|
61 | - foreach ( $this->parts($recursive) as $part ) { |
|
62 | - if ( in_array($part->subtype, $subtypes) ) { |
|
59 | + protected function subtypeContent($subtypes, $recursive) { |
|
60 | + $subtypes = (array)$subtypes; |
|
61 | + foreach ($this->parts($recursive) as $part) { |
|
62 | + if (in_array($part->subtype, $subtypes)) { |
|
63 | 63 | return $part->content(); |
64 | 64 | } |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - public function text( $recursive = false ) { |
|
68 | + public function text($recursive = false) { |
|
69 | 69 | return $this->subtypeContent($this->mailbox()->getTextSubtypes(), $recursive); |
70 | 70 | } |
71 | 71 | |
72 | - public function html( $recursive = false ) { |
|
72 | + public function html($recursive = false) { |
|
73 | 73 | return $this->subtypeContent($this->mailbox()->getHtmlSubtypes(), $recursive); |
74 | 74 | } |
75 | 75 | |
76 | - public function deliveryStatus( $recursive = true ) { |
|
76 | + public function deliveryStatus($recursive = true) { |
|
77 | 77 | return $this->subtypeContent('DELIVERY-STATUS', $recursive); |
78 | 78 | } |
79 | 79 |