File tree Expand file tree Collapse file tree 5 files changed +47
-0
lines changed
src/Symfony/Component/Mime Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1
1
CHANGELOG
2
2
=========
3
3
4
+ 4.4.0
5
+ -----
6
+
7
+ * Added ` AbstractPart::asDebugString() `
8
+
4
9
4.3.3
5
10
-----
6
11
Original file line number Diff line number Diff line change @@ -74,6 +74,20 @@ public function bodyToIterable(): iterable
74
74
yield '-- ' .$ this ->getBoundary ()."-- \r\n" ;
75
75
}
76
76
77
+ public function asDebugString (): string
78
+ {
79
+ $ str = parent ::asDebugString ();
80
+ foreach ($ this ->getParts () as $ part ) {
81
+ $ lines = explode ("\n" , $ part ->asDebugString ());
82
+ $ str .= "\n └ " .array_shift ($ lines );
83
+ foreach ($ lines as $ line ) {
84
+ $ str .= "\n | " .$ line ;
85
+ }
86
+ }
87
+
88
+ return $ str ;
89
+ }
90
+
77
91
private function getBoundary (): string
78
92
{
79
93
if (null === $ this ->boundary ) {
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ public function toIterable(): iterable
50
50
yield from $ this ->bodyToIterable ();
51
51
}
52
52
53
+ public function asDebugString (): string
54
+ {
55
+ return $ this ->getMediaType ().'/ ' .$ this ->getMediaSubtype ();
56
+ }
57
+
53
58
abstract public function bodyToString (): string ;
54
59
55
60
abstract public function bodyToIterable (): iterable ;
Original file line number Diff line number Diff line change @@ -103,6 +103,16 @@ public function getPreparedHeaders(): Headers
103
103
return $ headers ;
104
104
}
105
105
106
+ public function asDebugString (): string
107
+ {
108
+ $ str = parent ::asDebugString ();
109
+ if (null !== $ this ->filename ) {
110
+ $ str .= ' filename: ' .$ this ->filename ;
111
+ }
112
+
113
+ return $ str ;
114
+ }
115
+
106
116
private function generateContentId (): string
107
117
{
108
118
return bin2hex (random_bytes (16 )).'@symfony ' ;
Original file line number Diff line number Diff line change @@ -144,6 +144,19 @@ public function getPreparedHeaders(): Headers
144
144
return $ headers ;
145
145
}
146
146
147
+ public function asDebugString (): string
148
+ {
149
+ $ str = parent ::asDebugString ();
150
+ if (null !== $ this ->charset ) {
151
+ $ str .= ' charset: ' .$ this ->charset ;
152
+ }
153
+ if (null !== $ this ->disposition ) {
154
+ $ str .= ' disposition: ' .$ this ->disposition ;
155
+ }
156
+
157
+ return $ str ;
158
+ }
159
+
147
160
private function getEncoder (): ContentEncoderInterface
148
161
{
149
162
if ('8bit ' === $ this ->encoding ) {
You can’t perform that action at this time.
0 commit comments