Completed
Branch develop (091b9c)
by
unknown
19:44
created
htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -15,130 +15,130 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
17 17
 {
18
-    /** Recognized MIME types */
19
-    private $mimeTypes = [];
20
-
21
-    /**
22
-     * Create a new Attachment with $headers, $encoder and $cache.
23
-     *
24
-     * @param array $mimeTypes
25
-     */
26
-    public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
27
-    {
28
-        parent::__construct($headers, $encoder, $cache, $idGenerator);
29
-        $this->setDisposition('attachment');
30
-        $this->setContentType('application/octet-stream');
31
-        $this->mimeTypes = $mimeTypes;
32
-    }
33
-
34
-    /**
35
-     * Get the nesting level used for this attachment.
36
-     *
37
-     * Always returns {@link LEVEL_MIXED}.
38
-     *
39
-     * @return int
40
-     */
41
-    public function getNestingLevel()
42
-    {
43
-        return self::LEVEL_MIXED;
44
-    }
45
-
46
-    /**
47
-     * Get the Content-Disposition of this attachment.
48
-     *
49
-     * By default attachments have a disposition of "attachment".
50
-     *
51
-     * @return string
52
-     */
53
-    public function getDisposition()
54
-    {
55
-        return $this->getHeaderFieldModel('Content-Disposition');
56
-    }
57
-
58
-    /**
59
-     * Set the Content-Disposition of this attachment.
60
-     *
61
-     * @param string $disposition
62
-     *
63
-     * @return $this
64
-     */
65
-    public function setDisposition($disposition)
66
-    {
67
-        if (!$this->setHeaderFieldModel('Content-Disposition', $disposition)) {
68
-            $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
69
-        }
70
-
71
-        return $this;
72
-    }
73
-
74
-    /**
75
-     * Get the filename of this attachment when downloaded.
76
-     *
77
-     * @return string
78
-     */
79
-    public function getFilename()
80
-    {
81
-        return $this->getHeaderParameter('Content-Disposition', 'filename');
82
-    }
83
-
84
-    /**
85
-     * Set the filename of this attachment.
86
-     *
87
-     * @param string $filename
88
-     *
89
-     * @return $this
90
-     */
91
-    public function setFilename($filename)
92
-    {
93
-        $this->setHeaderParameter('Content-Disposition', 'filename', $filename);
94
-        $this->setHeaderParameter('Content-Type', 'name', $filename);
95
-
96
-        return $this;
97
-    }
98
-
99
-    /**
100
-     * Get the file size of this attachment.
101
-     *
102
-     * @return int
103
-     */
104
-    public function getSize()
105
-    {
106
-        return $this->getHeaderParameter('Content-Disposition', 'size');
107
-    }
108
-
109
-    /**
110
-     * Set the file size of this attachment.
111
-     *
112
-     * @param int $size
113
-     *
114
-     * @return $this
115
-     */
116
-    public function setSize($size)
117
-    {
118
-        $this->setHeaderParameter('Content-Disposition', 'size', $size);
119
-
120
-        return $this;
121
-    }
122
-
123
-    /**
124
-     * Set the file that this attachment is for.
125
-     *
126
-     * @param string $contentType optional
127
-     *
128
-     * @return $this
129
-     */
130
-    public function setFile(Swift_FileStream $file, $contentType = null)
131
-    {
132
-        $this->setFilename(basename($file->getPath()));
133
-        $this->setBody($file, $contentType);
134
-        if (!isset($contentType)) {
135
-            $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
136
-
137
-            if (\array_key_exists($extension, $this->mimeTypes)) {
138
-                $this->setContentType($this->mimeTypes[$extension]);
139
-            }
140
-        }
141
-
142
-        return $this;
143
-    }
18
+	/** Recognized MIME types */
19
+	private $mimeTypes = [];
20
+
21
+	/**
22
+	 * Create a new Attachment with $headers, $encoder and $cache.
23
+	 *
24
+	 * @param array $mimeTypes
25
+	 */
26
+	public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
27
+	{
28
+		parent::__construct($headers, $encoder, $cache, $idGenerator);
29
+		$this->setDisposition('attachment');
30
+		$this->setContentType('application/octet-stream');
31
+		$this->mimeTypes = $mimeTypes;
32
+	}
33
+
34
+	/**
35
+	 * Get the nesting level used for this attachment.
36
+	 *
37
+	 * Always returns {@link LEVEL_MIXED}.
38
+	 *
39
+	 * @return int
40
+	 */
41
+	public function getNestingLevel()
42
+	{
43
+		return self::LEVEL_MIXED;
44
+	}
45
+
46
+	/**
47
+	 * Get the Content-Disposition of this attachment.
48
+	 *
49
+	 * By default attachments have a disposition of "attachment".
50
+	 *
51
+	 * @return string
52
+	 */
53
+	public function getDisposition()
54
+	{
55
+		return $this->getHeaderFieldModel('Content-Disposition');
56
+	}
57
+
58
+	/**
59
+	 * Set the Content-Disposition of this attachment.
60
+	 *
61
+	 * @param string $disposition
62
+	 *
63
+	 * @return $this
64
+	 */
65
+	public function setDisposition($disposition)
66
+	{
67
+		if (!$this->setHeaderFieldModel('Content-Disposition', $disposition)) {
68
+			$this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
69
+		}
70
+
71
+		return $this;
72
+	}
73
+
74
+	/**
75
+	 * Get the filename of this attachment when downloaded.
76
+	 *
77
+	 * @return string
78
+	 */
79
+	public function getFilename()
80
+	{
81
+		return $this->getHeaderParameter('Content-Disposition', 'filename');
82
+	}
83
+
84
+	/**
85
+	 * Set the filename of this attachment.
86
+	 *
87
+	 * @param string $filename
88
+	 *
89
+	 * @return $this
90
+	 */
91
+	public function setFilename($filename)
92
+	{
93
+		$this->setHeaderParameter('Content-Disposition', 'filename', $filename);
94
+		$this->setHeaderParameter('Content-Type', 'name', $filename);
95
+
96
+		return $this;
97
+	}
98
+
99
+	/**
100
+	 * Get the file size of this attachment.
101
+	 *
102
+	 * @return int
103
+	 */
104
+	public function getSize()
105
+	{
106
+		return $this->getHeaderParameter('Content-Disposition', 'size');
107
+	}
108
+
109
+	/**
110
+	 * Set the file size of this attachment.
111
+	 *
112
+	 * @param int $size
113
+	 *
114
+	 * @return $this
115
+	 */
116
+	public function setSize($size)
117
+	{
118
+		$this->setHeaderParameter('Content-Disposition', 'size', $size);
119
+
120
+		return $this;
121
+	}
122
+
123
+	/**
124
+	 * Set the file that this attachment is for.
125
+	 *
126
+	 * @param string $contentType optional
127
+	 *
128
+	 * @return $this
129
+	 */
130
+	public function setFile(Swift_FileStream $file, $contentType = null)
131
+	{
132
+		$this->setFilename(basename($file->getPath()));
133
+		$this->setBody($file, $contentType);
134
+		if (!isset($contentType)) {
135
+			$extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
136
+
137
+			if (\array_key_exists($extension, $this->mimeTypes)) {
138
+				$this->setContentType($this->mimeTypes[$extension]);
139
+			}
140
+		}
141
+
142
+		return $this;
143
+	}
144 144
 }
Please login to merge, or discard this patch.
swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -19,47 +19,47 @@
 block discarded – undo
19 19
  */
20 20
 class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder
21 21
 {
22
-    /**
23
-     * Encode a given string to produce an encoded string.
24
-     *
25
-     * @param string $string
26
-     * @param int    $firstLineOffset ignored
27
-     * @param int    $maxLineLength   ignored
28
-     *
29
-     * @return string
30
-     */
31
-    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
32
-    {
33
-        return $string;
34
-    }
22
+	/**
23
+	 * Encode a given string to produce an encoded string.
24
+	 *
25
+	 * @param string $string
26
+	 * @param int    $firstLineOffset ignored
27
+	 * @param int    $maxLineLength   ignored
28
+	 *
29
+	 * @return string
30
+	 */
31
+	public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
32
+	{
33
+		return $string;
34
+	}
35 35
 
36
-    /**
37
-     * Encode stream $in to stream $out.
38
-     *
39
-     * @param int $firstLineOffset ignored
40
-     * @param int $maxLineLength   ignored
41
-     */
42
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
43
-    {
44
-        while (false !== ($bytes = $os->read(8192))) {
45
-            $is->write($bytes);
46
-        }
47
-    }
36
+	/**
37
+	 * Encode stream $in to stream $out.
38
+	 *
39
+	 * @param int $firstLineOffset ignored
40
+	 * @param int $maxLineLength   ignored
41
+	 */
42
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
43
+	{
44
+		while (false !== ($bytes = $os->read(8192))) {
45
+			$is->write($bytes);
46
+		}
47
+	}
48 48
 
49
-    /**
50
-     * Get the name of this encoding scheme.
51
-     *
52
-     * @return string
53
-     */
54
-    public function getName()
55
-    {
56
-        return 'raw';
57
-    }
49
+	/**
50
+	 * Get the name of this encoding scheme.
51
+	 *
52
+	 * @return string
53
+	 */
54
+	public function getName()
55
+	{
56
+		return 'raw';
57
+	}
58 58
 
59
-    /**
60
-     * Not used.
61
-     */
62
-    public function charsetChanged($charset)
63
-    {
64
-    }
59
+	/**
60
+	 * Not used.
61
+	 */
62
+	public function charsetChanged($charset)
63
+	{
64
+	}
65 65
 }
Please login to merge, or discard this patch.
swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -15,87 +15,87 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_ContentEncoder
17 17
 {
18
-    /**
19
-     * Encode stream $in to stream $out.
20
-     *
21
-     * @param int $firstLineOffset
22
-     */
23
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
24
-    {
25
-        if (0 >= $maxLineLength || 76 < $maxLineLength) {
26
-            $maxLineLength = 76;
27
-        }
18
+	/**
19
+	 * Encode stream $in to stream $out.
20
+	 *
21
+	 * @param int $firstLineOffset
22
+	 */
23
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
24
+	{
25
+		if (0 >= $maxLineLength || 76 < $maxLineLength) {
26
+			$maxLineLength = 76;
27
+		}
28 28
 
29
-        $remainder = 0;
30
-        $base64ReadBufferRemainderBytes = '';
29
+		$remainder = 0;
30
+		$base64ReadBufferRemainderBytes = '';
31 31
 
32
-        // To reduce memory usage, the output buffer is streamed to the input buffer like so:
33
-        //   Output Stream => base64encode => wrap line length => Input Stream
34
-        // HOWEVER it's important to note that base64_encode() should only be passed whole triplets of data (except for the final chunk of data)
35
-        // otherwise it will assume the input data has *ended* and it will incorrectly pad/terminate the base64 data mid-stream.
36
-        // We use $base64ReadBufferRemainderBytes to carry over 1-2 "remainder" bytes from the each chunk from OutputStream and pre-pend those onto the
37
-        // chunk of bytes read in the next iteration.
38
-        // When the OutputStream is empty, we must flush any remainder bytes.
39
-        while (true) {
40
-            $readBytes = $os->read(8192);
41
-            $atEOF = (false === $readBytes);
32
+		// To reduce memory usage, the output buffer is streamed to the input buffer like so:
33
+		//   Output Stream => base64encode => wrap line length => Input Stream
34
+		// HOWEVER it's important to note that base64_encode() should only be passed whole triplets of data (except for the final chunk of data)
35
+		// otherwise it will assume the input data has *ended* and it will incorrectly pad/terminate the base64 data mid-stream.
36
+		// We use $base64ReadBufferRemainderBytes to carry over 1-2 "remainder" bytes from the each chunk from OutputStream and pre-pend those onto the
37
+		// chunk of bytes read in the next iteration.
38
+		// When the OutputStream is empty, we must flush any remainder bytes.
39
+		while (true) {
40
+			$readBytes = $os->read(8192);
41
+			$atEOF = (false === $readBytes);
42 42
 
43
-            if ($atEOF) {
44
-                $streamTheseBytes = $base64ReadBufferRemainderBytes;
45
-            } else {
46
-                $streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;
47
-            }
48
-            $base64ReadBufferRemainderBytes = '';
49
-            $bytesLength = \strlen($streamTheseBytes);
43
+			if ($atEOF) {
44
+				$streamTheseBytes = $base64ReadBufferRemainderBytes;
45
+			} else {
46
+				$streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;
47
+			}
48
+			$base64ReadBufferRemainderBytes = '';
49
+			$bytesLength = \strlen($streamTheseBytes);
50 50
 
51
-            if (0 === $bytesLength) { // no data left to encode
52
-                break;
53
-            }
51
+			if (0 === $bytesLength) { // no data left to encode
52
+				break;
53
+			}
54 54
 
55
-            // if we're not on the last block of the ouput stream, make sure $streamTheseBytes ends with a complete triplet of data
56
-            // and carry over remainder 1-2 bytes to the next loop iteration
57
-            if (!$atEOF) {
58
-                $excessBytes = $bytesLength % 3;
59
-                if (0 !== $excessBytes) {
60
-                    $base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
61
-                    $streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
62
-                }
63
-            }
55
+			// if we're not on the last block of the ouput stream, make sure $streamTheseBytes ends with a complete triplet of data
56
+			// and carry over remainder 1-2 bytes to the next loop iteration
57
+			if (!$atEOF) {
58
+				$excessBytes = $bytesLength % 3;
59
+				if (0 !== $excessBytes) {
60
+					$base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
61
+					$streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
62
+				}
63
+			}
64 64
 
65
-            $encoded = base64_encode($streamTheseBytes);
66
-            $encodedTransformed = '';
67
-            $thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
65
+			$encoded = base64_encode($streamTheseBytes);
66
+			$encodedTransformed = '';
67
+			$thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
68 68
 
69
-            while ($thisMaxLineLength < \strlen($encoded)) {
70
-                $encodedTransformed .= substr($encoded, 0, $thisMaxLineLength)."\r\n";
71
-                $firstLineOffset = 0;
72
-                $encoded = substr($encoded, $thisMaxLineLength);
73
-                $thisMaxLineLength = $maxLineLength;
74
-                $remainder = 0;
75
-            }
69
+			while ($thisMaxLineLength < \strlen($encoded)) {
70
+				$encodedTransformed .= substr($encoded, 0, $thisMaxLineLength)."\r\n";
71
+				$firstLineOffset = 0;
72
+				$encoded = substr($encoded, $thisMaxLineLength);
73
+				$thisMaxLineLength = $maxLineLength;
74
+				$remainder = 0;
75
+			}
76 76
 
77
-            if (0 < $remainingLength = \strlen($encoded)) {
78
-                $remainder += $remainingLength;
79
-                $encodedTransformed .= $encoded;
80
-                $encoded = null;
81
-            }
77
+			if (0 < $remainingLength = \strlen($encoded)) {
78
+				$remainder += $remainingLength;
79
+				$encodedTransformed .= $encoded;
80
+				$encoded = null;
81
+			}
82 82
 
83
-            $is->write($encodedTransformed);
83
+			$is->write($encodedTransformed);
84 84
 
85
-            if ($atEOF) {
86
-                break;
87
-            }
88
-        }
89
-    }
85
+			if ($atEOF) {
86
+				break;
87
+			}
88
+		}
89
+	}
90 90
 
91
-    /**
92
-     * Get the name of this encoding scheme.
93
-     * Returns the string 'base64'.
94
-     *
95
-     * @return string
96
-     */
97
-    public function getName()
98
-    {
99
-        return 'base64';
100
-    }
91
+	/**
92
+	 * Get the name of this encoding scheme.
93
+	 * Returns the string 'base64'.
94
+	 *
95
+	 * @return string
96
+	 */
97
+	public function getName()
98
+	{
99
+		return 'base64';
100
+	}
101 101
 }
Please login to merge, or discard this patch.
swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -19,146 +19,146 @@
 block discarded – undo
19 19
  */
20 20
 class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_ContentEncoder
21 21
 {
22
-    /**
23
-     * The name of this encoding scheme (probably 7bit or 8bit).
24
-     *
25
-     * @var string
26
-     */
27
-    private $name;
28
-
29
-    /**
30
-     * True if canonical transformations should be done.
31
-     *
32
-     * @var bool
33
-     */
34
-    private $canonical;
35
-
36
-    /**
37
-     * Creates a new PlainContentEncoder with $name (probably 7bit or 8bit).
38
-     *
39
-     * @param string $name
40
-     * @param bool   $canonical if canonicalization transformation should be done
41
-     */
42
-    public function __construct($name, $canonical = false)
43
-    {
44
-        $this->name = $name;
45
-        $this->canonical = $canonical;
46
-    }
47
-
48
-    /**
49
-     * Encode a given string to produce an encoded string.
50
-     *
51
-     * @param string $string
52
-     * @param int    $firstLineOffset ignored
53
-     * @param int    $maxLineLength   - 0 means no wrapping will occur
54
-     *
55
-     * @return string
56
-     */
57
-    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
58
-    {
59
-        if ($this->canonical) {
60
-            $string = $this->canonicalize($string);
61
-        }
62
-
63
-        return $this->safeWordwrap($string, $maxLineLength, "\r\n");
64
-    }
65
-
66
-    /**
67
-     * Encode stream $in to stream $out.
68
-     *
69
-     * @param int $firstLineOffset ignored
70
-     * @param int $maxLineLength   optional, 0 means no wrapping will occur
71
-     */
72
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
73
-    {
74
-        $leftOver = '';
75
-        while (false !== $bytes = $os->read(8192)) {
76
-            $toencode = $leftOver.$bytes;
77
-            if ($this->canonical) {
78
-                $toencode = $this->canonicalize($toencode);
79
-            }
80
-            $wrapped = $this->safeWordwrap($toencode, $maxLineLength, "\r\n");
81
-            $lastLinePos = strrpos($wrapped, "\r\n");
82
-            $leftOver = substr($wrapped, $lastLinePos);
83
-            $wrapped = substr($wrapped, 0, $lastLinePos);
84
-
85
-            $is->write($wrapped);
86
-        }
87
-        if (\strlen($leftOver)) {
88
-            $is->write($leftOver);
89
-        }
90
-    }
91
-
92
-    /**
93
-     * Get the name of this encoding scheme.
94
-     *
95
-     * @return string
96
-     */
97
-    public function getName()
98
-    {
99
-        return $this->name;
100
-    }
101
-
102
-    /**
103
-     * Not used.
104
-     */
105
-    public function charsetChanged($charset)
106
-    {
107
-    }
108
-
109
-    /**
110
-     * A safer (but weaker) wordwrap for unicode.
111
-     *
112
-     * @param string $string
113
-     * @param int    $length
114
-     * @param string $le
115
-     *
116
-     * @return string
117
-     */
118
-    private function safeWordwrap($string, $length = 75, $le = "\r\n")
119
-    {
120
-        if (0 >= $length) {
121
-            return $string;
122
-        }
123
-
124
-        $originalLines = explode($le, $string);
125
-
126
-        $lines = [];
127
-        $lineCount = 0;
128
-
129
-        foreach ($originalLines as $originalLine) {
130
-            $lines[] = '';
131
-            $currentLine = &$lines[$lineCount++];
132
-
133
-            //$chunks = preg_split('/(?<=[\ \t,\.!\?\-&\+\/])/', $originalLine);
134
-            $chunks = preg_split('/(?<=\s)/', $originalLine);
135
-
136
-            foreach ($chunks as $chunk) {
137
-                if (0 != \strlen($currentLine)
138
-                    && \strlen($currentLine.$chunk) > $length) {
139
-                    $lines[] = '';
140
-                    $currentLine = &$lines[$lineCount++];
141
-                }
142
-                $currentLine .= $chunk;
143
-            }
144
-        }
145
-
146
-        return implode("\r\n", $lines);
147
-    }
148
-
149
-    /**
150
-     * Canonicalize string input (fix CRLF).
151
-     *
152
-     * @param string $string
153
-     *
154
-     * @return string
155
-     */
156
-    private function canonicalize($string)
157
-    {
158
-        return str_replace(
159
-            ["\r\n", "\r", "\n"],
160
-            ["\n", "\n", "\r\n"],
161
-            $string
162
-            );
163
-    }
22
+	/**
23
+	 * The name of this encoding scheme (probably 7bit or 8bit).
24
+	 *
25
+	 * @var string
26
+	 */
27
+	private $name;
28
+
29
+	/**
30
+	 * True if canonical transformations should be done.
31
+	 *
32
+	 * @var bool
33
+	 */
34
+	private $canonical;
35
+
36
+	/**
37
+	 * Creates a new PlainContentEncoder with $name (probably 7bit or 8bit).
38
+	 *
39
+	 * @param string $name
40
+	 * @param bool   $canonical if canonicalization transformation should be done
41
+	 */
42
+	public function __construct($name, $canonical = false)
43
+	{
44
+		$this->name = $name;
45
+		$this->canonical = $canonical;
46
+	}
47
+
48
+	/**
49
+	 * Encode a given string to produce an encoded string.
50
+	 *
51
+	 * @param string $string
52
+	 * @param int    $firstLineOffset ignored
53
+	 * @param int    $maxLineLength   - 0 means no wrapping will occur
54
+	 *
55
+	 * @return string
56
+	 */
57
+	public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
58
+	{
59
+		if ($this->canonical) {
60
+			$string = $this->canonicalize($string);
61
+		}
62
+
63
+		return $this->safeWordwrap($string, $maxLineLength, "\r\n");
64
+	}
65
+
66
+	/**
67
+	 * Encode stream $in to stream $out.
68
+	 *
69
+	 * @param int $firstLineOffset ignored
70
+	 * @param int $maxLineLength   optional, 0 means no wrapping will occur
71
+	 */
72
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
73
+	{
74
+		$leftOver = '';
75
+		while (false !== $bytes = $os->read(8192)) {
76
+			$toencode = $leftOver.$bytes;
77
+			if ($this->canonical) {
78
+				$toencode = $this->canonicalize($toencode);
79
+			}
80
+			$wrapped = $this->safeWordwrap($toencode, $maxLineLength, "\r\n");
81
+			$lastLinePos = strrpos($wrapped, "\r\n");
82
+			$leftOver = substr($wrapped, $lastLinePos);
83
+			$wrapped = substr($wrapped, 0, $lastLinePos);
84
+
85
+			$is->write($wrapped);
86
+		}
87
+		if (\strlen($leftOver)) {
88
+			$is->write($leftOver);
89
+		}
90
+	}
91
+
92
+	/**
93
+	 * Get the name of this encoding scheme.
94
+	 *
95
+	 * @return string
96
+	 */
97
+	public function getName()
98
+	{
99
+		return $this->name;
100
+	}
101
+
102
+	/**
103
+	 * Not used.
104
+	 */
105
+	public function charsetChanged($charset)
106
+	{
107
+	}
108
+
109
+	/**
110
+	 * A safer (but weaker) wordwrap for unicode.
111
+	 *
112
+	 * @param string $string
113
+	 * @param int    $length
114
+	 * @param string $le
115
+	 *
116
+	 * @return string
117
+	 */
118
+	private function safeWordwrap($string, $length = 75, $le = "\r\n")
119
+	{
120
+		if (0 >= $length) {
121
+			return $string;
122
+		}
123
+
124
+		$originalLines = explode($le, $string);
125
+
126
+		$lines = [];
127
+		$lineCount = 0;
128
+
129
+		foreach ($originalLines as $originalLine) {
130
+			$lines[] = '';
131
+			$currentLine = &$lines[$lineCount++];
132
+
133
+			//$chunks = preg_split('/(?<=[\ \t,\.!\?\-&\+\/])/', $originalLine);
134
+			$chunks = preg_split('/(?<=\s)/', $originalLine);
135
+
136
+			foreach ($chunks as $chunk) {
137
+				if (0 != \strlen($currentLine)
138
+					&& \strlen($currentLine.$chunk) > $length) {
139
+					$lines[] = '';
140
+					$currentLine = &$lines[$lineCount++];
141
+				}
142
+				$currentLine .= $chunk;
143
+			}
144
+		}
145
+
146
+		return implode("\r\n", $lines);
147
+	}
148
+
149
+	/**
150
+	 * Canonicalize string input (fix CRLF).
151
+	 *
152
+	 * @param string $string
153
+	 *
154
+	 * @return string
155
+	 */
156
+	private function canonicalize($string)
157
+	{
158
+		return str_replace(
159
+			["\r\n", "\r", "\n"],
160
+			["\n", "\n", "\r\n"],
161
+			$string
162
+			);
163
+	}
164 164
 }
Please login to merge, or discard this patch.
swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -15,120 +15,120 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder
17 17
 {
18
-    protected $dotEscape;
19
-
20
-    /**
21
-     * Creates a new QpContentEncoder for the given CharacterStream.
22
-     *
23
-     * @param Swift_CharacterStream $charStream to use for reading characters
24
-     * @param Swift_StreamFilter    $filter     if canonicalization should occur
25
-     * @param bool                  $dotEscape  if dot stuffing workaround must be enabled
26
-     */
27
-    public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null, $dotEscape = false)
28
-    {
29
-        $this->dotEscape = $dotEscape;
30
-        parent::__construct($charStream, $filter);
31
-    }
32
-
33
-    public function __sleep()
34
-    {
35
-        return ['charStream', 'filter', 'dotEscape'];
36
-    }
37
-
38
-    protected function getSafeMapShareId()
39
-    {
40
-        return static::class.($this->dotEscape ? '.dotEscape' : '');
41
-    }
42
-
43
-    protected function initSafeMap()
44
-    {
45
-        parent::initSafeMap();
46
-        if ($this->dotEscape) {
47
-            /* Encode . as =2e for buggy remote servers */
48
-            unset($this->safeMap[0x2e]);
49
-        }
50
-    }
51
-
52
-    /**
53
-     * Encode stream $in to stream $out.
54
-     *
55
-     * QP encoded strings have a maximum line length of 76 characters.
56
-     * If the first line needs to be shorter, indicate the difference with
57
-     * $firstLineOffset.
58
-     *
59
-     * @param Swift_OutputByteStream $os              output stream
60
-     * @param Swift_InputByteStream  $is              input stream
61
-     * @param int                    $firstLineOffset
62
-     * @param int                    $maxLineLength
63
-     */
64
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
65
-    {
66
-        if ($maxLineLength > 76 || $maxLineLength <= 0) {
67
-            $maxLineLength = 76;
68
-        }
69
-
70
-        $thisLineLength = $maxLineLength - $firstLineOffset;
71
-
72
-        $this->charStream->flushContents();
73
-        $this->charStream->importByteStream($os);
74
-
75
-        $currentLine = '';
76
-        $prepend = '';
77
-        $size = $lineLen = 0;
78
-
79
-        while (false !== $bytes = $this->nextSequence()) {
80
-            // If we're filtering the input
81
-            if (isset($this->filter)) {
82
-                // If we can't filter because we need more bytes
83
-                while ($this->filter->shouldBuffer($bytes)) {
84
-                    // Then collect bytes into the buffer
85
-                    if (false === $moreBytes = $this->nextSequence(1)) {
86
-                        break;
87
-                    }
88
-
89
-                    foreach ($moreBytes as $b) {
90
-                        $bytes[] = $b;
91
-                    }
92
-                }
93
-                // And filter them
94
-                $bytes = $this->filter->filter($bytes);
95
-            }
96
-
97
-            $enc = $this->encodeByteSequence($bytes, $size);
98
-
99
-            $i = strpos($enc, '=0D=0A');
100
-            $newLineLength = $lineLen + (false === $i ? $size : $i);
101
-
102
-            if ($currentLine && $newLineLength >= $thisLineLength) {
103
-                $is->write($prepend.$this->standardize($currentLine));
104
-                $currentLine = '';
105
-                $prepend = "=\r\n";
106
-                $thisLineLength = $maxLineLength;
107
-                $lineLen = 0;
108
-            }
109
-
110
-            $currentLine .= $enc;
111
-
112
-            if (false === $i) {
113
-                $lineLen += $size;
114
-            } else {
115
-                // 6 is the length of '=0D=0A'.
116
-                $lineLen = $size - strrpos($enc, '=0D=0A') - 6;
117
-            }
118
-        }
119
-        if (\strlen($currentLine)) {
120
-            $is->write($prepend.$this->standardize($currentLine));
121
-        }
122
-    }
123
-
124
-    /**
125
-     * Get the name of this encoding scheme.
126
-     * Returns the string 'quoted-printable'.
127
-     *
128
-     * @return string
129
-     */
130
-    public function getName()
131
-    {
132
-        return 'quoted-printable';
133
-    }
18
+	protected $dotEscape;
19
+
20
+	/**
21
+	 * Creates a new QpContentEncoder for the given CharacterStream.
22
+	 *
23
+	 * @param Swift_CharacterStream $charStream to use for reading characters
24
+	 * @param Swift_StreamFilter    $filter     if canonicalization should occur
25
+	 * @param bool                  $dotEscape  if dot stuffing workaround must be enabled
26
+	 */
27
+	public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null, $dotEscape = false)
28
+	{
29
+		$this->dotEscape = $dotEscape;
30
+		parent::__construct($charStream, $filter);
31
+	}
32
+
33
+	public function __sleep()
34
+	{
35
+		return ['charStream', 'filter', 'dotEscape'];
36
+	}
37
+
38
+	protected function getSafeMapShareId()
39
+	{
40
+		return static::class.($this->dotEscape ? '.dotEscape' : '');
41
+	}
42
+
43
+	protected function initSafeMap()
44
+	{
45
+		parent::initSafeMap();
46
+		if ($this->dotEscape) {
47
+			/* Encode . as =2e for buggy remote servers */
48
+			unset($this->safeMap[0x2e]);
49
+		}
50
+	}
51
+
52
+	/**
53
+	 * Encode stream $in to stream $out.
54
+	 *
55
+	 * QP encoded strings have a maximum line length of 76 characters.
56
+	 * If the first line needs to be shorter, indicate the difference with
57
+	 * $firstLineOffset.
58
+	 *
59
+	 * @param Swift_OutputByteStream $os              output stream
60
+	 * @param Swift_InputByteStream  $is              input stream
61
+	 * @param int                    $firstLineOffset
62
+	 * @param int                    $maxLineLength
63
+	 */
64
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
65
+	{
66
+		if ($maxLineLength > 76 || $maxLineLength <= 0) {
67
+			$maxLineLength = 76;
68
+		}
69
+
70
+		$thisLineLength = $maxLineLength - $firstLineOffset;
71
+
72
+		$this->charStream->flushContents();
73
+		$this->charStream->importByteStream($os);
74
+
75
+		$currentLine = '';
76
+		$prepend = '';
77
+		$size = $lineLen = 0;
78
+
79
+		while (false !== $bytes = $this->nextSequence()) {
80
+			// If we're filtering the input
81
+			if (isset($this->filter)) {
82
+				// If we can't filter because we need more bytes
83
+				while ($this->filter->shouldBuffer($bytes)) {
84
+					// Then collect bytes into the buffer
85
+					if (false === $moreBytes = $this->nextSequence(1)) {
86
+						break;
87
+					}
88
+
89
+					foreach ($moreBytes as $b) {
90
+						$bytes[] = $b;
91
+					}
92
+				}
93
+				// And filter them
94
+				$bytes = $this->filter->filter($bytes);
95
+			}
96
+
97
+			$enc = $this->encodeByteSequence($bytes, $size);
98
+
99
+			$i = strpos($enc, '=0D=0A');
100
+			$newLineLength = $lineLen + (false === $i ? $size : $i);
101
+
102
+			if ($currentLine && $newLineLength >= $thisLineLength) {
103
+				$is->write($prepend.$this->standardize($currentLine));
104
+				$currentLine = '';
105
+				$prepend = "=\r\n";
106
+				$thisLineLength = $maxLineLength;
107
+				$lineLen = 0;
108
+			}
109
+
110
+			$currentLine .= $enc;
111
+
112
+			if (false === $i) {
113
+				$lineLen += $size;
114
+			} else {
115
+				// 6 is the length of '=0D=0A'.
116
+				$lineLen = $size - strrpos($enc, '=0D=0A') - 6;
117
+			}
118
+		}
119
+		if (\strlen($currentLine)) {
120
+			$is->write($prepend.$this->standardize($currentLine));
121
+		}
122
+	}
123
+
124
+	/**
125
+	 * Get the name of this encoding scheme.
126
+	 * Returns the string 'quoted-printable'.
127
+	 *
128
+	 * @return string
129
+	 */
130
+	public function getName()
131
+	{
132
+		return 'quoted-printable';
133
+	}
134 134
 }
Please login to merge, or discard this patch.
swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NullContentEncoder.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -16,64 +16,64 @@
 block discarded – undo
16 16
  */
17 17
 class Swift_Mime_ContentEncoder_NullContentEncoder implements Swift_Mime_ContentEncoder
18 18
 {
19
-    /**
20
-     * The name of this encoding scheme (probably 7bit or 8bit).
21
-     *
22
-     * @var string
23
-     */
24
-    private $name;
19
+	/**
20
+	 * The name of this encoding scheme (probably 7bit or 8bit).
21
+	 *
22
+	 * @var string
23
+	 */
24
+	private $name;
25 25
 
26
-    /**
27
-     * Creates a new NullContentEncoder with $name (probably 7bit or 8bit).
28
-     *
29
-     * @param string $name
30
-     */
31
-    public function __construct($name)
32
-    {
33
-        $this->name = $name;
34
-    }
26
+	/**
27
+	 * Creates a new NullContentEncoder with $name (probably 7bit or 8bit).
28
+	 *
29
+	 * @param string $name
30
+	 */
31
+	public function __construct($name)
32
+	{
33
+		$this->name = $name;
34
+	}
35 35
 
36
-    /**
37
-     * Encode a given string to produce an encoded string.
38
-     *
39
-     * @param string $string
40
-     * @param int    $firstLineOffset ignored
41
-     * @param int    $maxLineLength   ignored
42
-     *
43
-     * @return string
44
-     */
45
-    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
46
-    {
47
-        return $string;
48
-    }
36
+	/**
37
+	 * Encode a given string to produce an encoded string.
38
+	 *
39
+	 * @param string $string
40
+	 * @param int    $firstLineOffset ignored
41
+	 * @param int    $maxLineLength   ignored
42
+	 *
43
+	 * @return string
44
+	 */
45
+	public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
46
+	{
47
+		return $string;
48
+	}
49 49
 
50
-    /**
51
-     * Encode stream $in to stream $out.
52
-     *
53
-     * @param int $firstLineOffset ignored
54
-     * @param int $maxLineLength   ignored
55
-     */
56
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
57
-    {
58
-        while (false !== ($bytes = $os->read(8192))) {
59
-            $is->write($bytes);
60
-        }
61
-    }
50
+	/**
51
+	 * Encode stream $in to stream $out.
52
+	 *
53
+	 * @param int $firstLineOffset ignored
54
+	 * @param int $maxLineLength   ignored
55
+	 */
56
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
57
+	{
58
+		while (false !== ($bytes = $os->read(8192))) {
59
+			$is->write($bytes);
60
+		}
61
+	}
62 62
 
63
-    /**
64
-     * Get the name of this encoding scheme.
65
-     *
66
-     * @return string
67
-     */
68
-    public function getName()
69
-    {
70
-        return $this->name;
71
-    }
63
+	/**
64
+	 * Get the name of this encoding scheme.
65
+	 *
66
+	 * @return string
67
+	 */
68
+	public function getName()
69
+	{
70
+		return $this->name;
71
+	}
72 72
 
73
-    /**
74
-     * Not used.
75
-     */
76
-    public function charsetChanged($charset)
77
-    {
78
-    }
73
+	/**
74
+	 * Not used.
75
+	 */
76
+	public function charsetChanged($charset)
77
+	{
78
+	}
79 79
 }
Please login to merge, or discard this patch.
lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -15,107 +15,107 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_ContentEncoder
17 17
 {
18
-    /**
19
-     * @var string|null
20
-     */
21
-    private $charset;
18
+	/**
19
+	 * @var string|null
20
+	 */
21
+	private $charset;
22 22
 
23
-    /**
24
-     * @param string|null $charset
25
-     */
26
-    public function __construct($charset = null)
27
-    {
28
-        $this->charset = $charset ?: 'utf-8';
29
-    }
23
+	/**
24
+	 * @param string|null $charset
25
+	 */
26
+	public function __construct($charset = null)
27
+	{
28
+		$this->charset = $charset ?: 'utf-8';
29
+	}
30 30
 
31
-    /**
32
-     * Notify this observer that the entity's charset has changed.
33
-     *
34
-     * @param string $charset
35
-     */
36
-    public function charsetChanged($charset)
37
-    {
38
-        $this->charset = $charset;
39
-    }
31
+	/**
32
+	 * Notify this observer that the entity's charset has changed.
33
+	 *
34
+	 * @param string $charset
35
+	 */
36
+	public function charsetChanged($charset)
37
+	{
38
+		$this->charset = $charset;
39
+	}
40 40
 
41
-    /**
42
-     * Encode $in to $out.
43
-     *
44
-     * @param Swift_OutputByteStream $os              to read from
45
-     * @param Swift_InputByteStream  $is              to write to
46
-     * @param int                    $firstLineOffset
47
-     * @param int                    $maxLineLength   0 indicates the default length for this encoding
48
-     *
49
-     * @throws RuntimeException
50
-     */
51
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
52
-    {
53
-        if ('utf-8' !== $this->charset) {
54
-            throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
55
-        }
41
+	/**
42
+	 * Encode $in to $out.
43
+	 *
44
+	 * @param Swift_OutputByteStream $os              to read from
45
+	 * @param Swift_InputByteStream  $is              to write to
46
+	 * @param int                    $firstLineOffset
47
+	 * @param int                    $maxLineLength   0 indicates the default length for this encoding
48
+	 *
49
+	 * @throws RuntimeException
50
+	 */
51
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
52
+	{
53
+		if ('utf-8' !== $this->charset) {
54
+			throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
55
+		}
56 56
 
57
-        $string = '';
57
+		$string = '';
58 58
 
59
-        while (false !== $bytes = $os->read(8192)) {
60
-            $string .= $bytes;
61
-        }
59
+		while (false !== $bytes = $os->read(8192)) {
60
+			$string .= $bytes;
61
+		}
62 62
 
63
-        $is->write($this->encodeString($string));
64
-    }
63
+		$is->write($this->encodeString($string));
64
+	}
65 65
 
66
-    /**
67
-     * Get the MIME name of this content encoding scheme.
68
-     *
69
-     * @return string
70
-     */
71
-    public function getName()
72
-    {
73
-        return 'quoted-printable';
74
-    }
66
+	/**
67
+	 * Get the MIME name of this content encoding scheme.
68
+	 *
69
+	 * @return string
70
+	 */
71
+	public function getName()
72
+	{
73
+		return 'quoted-printable';
74
+	}
75 75
 
76
-    /**
77
-     * Encode a given string to produce an encoded string.
78
-     *
79
-     * @param string $string
80
-     * @param int    $firstLineOffset if first line needs to be shorter
81
-     * @param int    $maxLineLength   0 indicates the default length for this encoding
82
-     *
83
-     * @throws RuntimeException
84
-     *
85
-     * @return string
86
-     */
87
-    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
88
-    {
89
-        if ('utf-8' !== $this->charset) {
90
-            throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
91
-        }
76
+	/**
77
+	 * Encode a given string to produce an encoded string.
78
+	 *
79
+	 * @param string $string
80
+	 * @param int    $firstLineOffset if first line needs to be shorter
81
+	 * @param int    $maxLineLength   0 indicates the default length for this encoding
82
+	 *
83
+	 * @throws RuntimeException
84
+	 *
85
+	 * @return string
86
+	 */
87
+	public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
88
+	{
89
+		if ('utf-8' !== $this->charset) {
90
+			throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
91
+		}
92 92
 
93
-        return $this->standardize(quoted_printable_encode($string));
94
-    }
93
+		return $this->standardize(quoted_printable_encode($string));
94
+	}
95 95
 
96
-    /**
97
-     * Make sure CRLF is correct and HT/SPACE are in valid places.
98
-     *
99
-     * @param string $string
100
-     *
101
-     * @return string
102
-     */
103
-    protected function standardize($string)
104
-    {
105
-        // transform CR or LF to CRLF
106
-        $string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);
107
-        // transform =0D=0A to CRLF
108
-        $string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'], ["=09\r\n", "=20\r\n", "\r\n"], $string);
96
+	/**
97
+	 * Make sure CRLF is correct and HT/SPACE are in valid places.
98
+	 *
99
+	 * @param string $string
100
+	 *
101
+	 * @return string
102
+	 */
103
+	protected function standardize($string)
104
+	{
105
+		// transform CR or LF to CRLF
106
+		$string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);
107
+		// transform =0D=0A to CRLF
108
+		$string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'], ["=09\r\n", "=20\r\n", "\r\n"], $string);
109 109
 
110
-        switch (\ord(substr($string, -1))) {
111
-            case 0x09:
112
-                $string = substr_replace($string, '=09', -1);
113
-                break;
114
-            case 0x20:
115
-                $string = substr_replace($string, '=20', -1);
116
-                break;
117
-        }
110
+		switch (\ord(substr($string, -1))) {
111
+			case 0x09:
112
+				$string = substr_replace($string, '=09', -1);
113
+				break;
114
+			case 0x20:
115
+				$string = substr_replace($string, '=20', -1);
116
+				break;
117
+		}
118 118
 
119
-        return $string;
120
-    }
119
+		return $string;
120
+	}
121 121
 }
Please login to merge, or discard this patch.
swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -17,80 +17,80 @@
 block discarded – undo
17 17
  */
18 18
 class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_ContentEncoder
19 19
 {
20
-    /**
21
-     * @var Swift_Mime_ContentEncoder_QpContentEncoder
22
-     */
23
-    private $safeEncoder;
20
+	/**
21
+	 * @var Swift_Mime_ContentEncoder_QpContentEncoder
22
+	 */
23
+	private $safeEncoder;
24 24
 
25
-    /**
26
-     * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder
27
-     */
28
-    private $nativeEncoder;
25
+	/**
26
+	 * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder
27
+	 */
28
+	private $nativeEncoder;
29 29
 
30
-    /**
31
-     * @var string|null
32
-     */
33
-    private $charset;
30
+	/**
31
+	 * @var string|null
32
+	 */
33
+	private $charset;
34 34
 
35
-    /**
36
-     * Constructor.
37
-     *
38
-     * @param string|null $charset
39
-     */
40
-    public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset)
41
-    {
42
-        $this->safeEncoder = $safeEncoder;
43
-        $this->nativeEncoder = $nativeEncoder;
44
-        $this->charset = $charset;
45
-    }
35
+	/**
36
+	 * Constructor.
37
+	 *
38
+	 * @param string|null $charset
39
+	 */
40
+	public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset)
41
+	{
42
+		$this->safeEncoder = $safeEncoder;
43
+		$this->nativeEncoder = $nativeEncoder;
44
+		$this->charset = $charset;
45
+	}
46 46
 
47
-    /**
48
-     * Make a deep copy of object.
49
-     */
50
-    public function __clone()
51
-    {
52
-        $this->safeEncoder = clone $this->safeEncoder;
53
-        $this->nativeEncoder = clone $this->nativeEncoder;
54
-    }
47
+	/**
48
+	 * Make a deep copy of object.
49
+	 */
50
+	public function __clone()
51
+	{
52
+		$this->safeEncoder = clone $this->safeEncoder;
53
+		$this->nativeEncoder = clone $this->nativeEncoder;
54
+	}
55 55
 
56
-    /**
57
-     * {@inheritdoc}
58
-     */
59
-    public function charsetChanged($charset)
60
-    {
61
-        $this->charset = $charset;
62
-        $this->safeEncoder->charsetChanged($charset);
63
-    }
56
+	/**
57
+	 * {@inheritdoc}
58
+	 */
59
+	public function charsetChanged($charset)
60
+	{
61
+		$this->charset = $charset;
62
+		$this->safeEncoder->charsetChanged($charset);
63
+	}
64 64
 
65
-    /**
66
-     * {@inheritdoc}
67
-     */
68
-    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
69
-    {
70
-        $this->getEncoder()->encodeByteStream($os, $is, $firstLineOffset, $maxLineLength);
71
-    }
65
+	/**
66
+	 * {@inheritdoc}
67
+	 */
68
+	public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
69
+	{
70
+		$this->getEncoder()->encodeByteStream($os, $is, $firstLineOffset, $maxLineLength);
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritdoc}
75
-     */
76
-    public function getName()
77
-    {
78
-        return 'quoted-printable';
79
-    }
73
+	/**
74
+	 * {@inheritdoc}
75
+	 */
76
+	public function getName()
77
+	{
78
+		return 'quoted-printable';
79
+	}
80 80
 
81
-    /**
82
-     * {@inheritdoc}
83
-     */
84
-    public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
85
-    {
86
-        return $this->getEncoder()->encodeString($string, $firstLineOffset, $maxLineLength);
87
-    }
81
+	/**
82
+	 * {@inheritdoc}
83
+	 */
84
+	public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
85
+	{
86
+		return $this->getEncoder()->encodeString($string, $firstLineOffset, $maxLineLength);
87
+	}
88 88
 
89
-    /**
90
-     * @return Swift_Mime_ContentEncoder
91
-     */
92
-    private function getEncoder()
93
-    {
94
-        return 'utf-8' === $this->charset ? $this->nativeEncoder : $this->safeEncoder;
95
-    }
89
+	/**
90
+	 * @return Swift_Mime_ContentEncoder
91
+	 */
92
+	private function getEncoder()
93
+	{
94
+		return 'utf-8' === $this->charset ? $this->nativeEncoder : $this->safeEncoder;
95
+	}
96 96
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,27 +15,27 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment
17 17
 {
18
-    /**
19
-     * Creates a new Attachment with $headers and $encoder.
20
-     *
21
-     * @param array $mimeTypes optional
22
-     */
23
-    public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
24
-    {
25
-        parent::__construct($headers, $encoder, $cache, $idGenerator, $mimeTypes);
26
-        $this->setDisposition('inline');
27
-        $this->setId($this->getId());
28
-    }
18
+	/**
19
+	 * Creates a new Attachment with $headers and $encoder.
20
+	 *
21
+	 * @param array $mimeTypes optional
22
+	 */
23
+	public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
24
+	{
25
+		parent::__construct($headers, $encoder, $cache, $idGenerator, $mimeTypes);
26
+		$this->setDisposition('inline');
27
+		$this->setId($this->getId());
28
+	}
29 29
 
30
-    /**
31
-     * Get the nesting level of this EmbeddedFile.
32
-     *
33
-     * Returns {@see LEVEL_RELATED}.
34
-     *
35
-     * @return int
36
-     */
37
-    public function getNestingLevel()
38
-    {
39
-        return self::LEVEL_RELATED;
40
-    }
30
+	/**
31
+	 * Get the nesting level of this EmbeddedFile.
32
+	 *
33
+	 * Returns {@see LEVEL_RELATED}.
34
+	 *
35
+	 * @return int
36
+	 */
37
+	public function getNestingLevel()
38
+	{
39
+		return self::LEVEL_RELATED;
40
+	}
41 41
 }
Please login to merge, or discard this patch.