Complex classes like Message often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Message, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
23 | class Message extends MimePart |
||
24 | { |
||
25 | /** |
||
26 | * @var string unique ID used to identify the object to |
||
27 | * $this->partStreamRegistry when registering the stream. The ID is |
||
28 | * used for opening stream parts with the mmp-mime-message "protocol". |
||
29 | * |
||
30 | * @see \ZBateson\MailMimeParser\SimpleDi::registerStreamExtensions |
||
31 | * @see \ZBateson\MailMimeParser\Stream\PartStream::stream_open |
||
32 | */ |
||
33 | protected $objectId; |
||
34 | |||
35 | /** |
||
36 | * @var \ZBateson\MailMimeParser\Message\MimePartFactory a MimePartFactory to create |
||
37 | * parts for attachments/content |
||
38 | */ |
||
39 | protected $mimePartFactory; |
||
40 | |||
41 | /** |
||
42 | * @var \ZBateson\MailMimeParser\Message\Writer\MessageWriter the part |
||
43 | * writer for this Message. The same object is assigned to $partWriter |
||
44 | * but as an AbstractWriter -- not really needed in PHP but helps with |
||
45 | * auto-complete and code analyzers. |
||
46 | */ |
||
47 | protected $messageWriter = null; |
||
48 | |||
49 | /** |
||
50 | * Convenience method to parse a handle or string into a Message without |
||
51 | * requiring including MailMimeParser, instantiating it, and calling parse. |
||
52 | * |
||
53 | * @param resource|string $handleOrString the resource handle to the input |
||
54 | * stream of the mime message, or a string containing a mime message |
||
55 | */ |
||
56 | 1 | public static function from($handleOrString) |
|
61 | |||
62 | /** |
||
63 | * Constructs a Message. |
||
64 | * |
||
65 | * @param HeaderFactory $headerFactory |
||
66 | * @param MessageWriter $messageWriter |
||
67 | * @param MimePartFactory $mimePartFactory |
||
68 | */ |
||
69 | 97 | public function __construct( |
|
79 | |||
80 | /** |
||
81 | * Returns the unique object ID registered with the PartStreamRegistry |
||
82 | * service object. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 91 | public function getObjectId() |
|
90 | |||
91 | /** |
||
92 | * Returns the text/plain part at the given index (or null if not found.) |
||
93 | * |
||
94 | * @param int $index |
||
95 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
96 | */ |
||
97 | 68 | public function getTextPart($index = 0) |
|
104 | |||
105 | /** |
||
106 | * Returns the number of text/plain parts in this message. |
||
107 | * |
||
108 | * @return int |
||
109 | */ |
||
110 | public function getTextPartCount() |
||
114 | |||
115 | /** |
||
116 | * Returns the text/html part at the given index (or null if not found.) |
||
117 | * |
||
118 | * @param $index |
||
119 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
120 | */ |
||
121 | 39 | public function getHtmlPart($index = 0) |
|
128 | |||
129 | /** |
||
130 | * Returns the number of text/html parts in this message. |
||
131 | * |
||
132 | * @return int |
||
133 | */ |
||
134 | public function getHtmlPartCount() |
||
138 | |||
139 | /** |
||
140 | * Returns the content MimePart, which could be a text/plain part, |
||
141 | * text/html part, multipart/alternative part, or null if none is set. |
||
142 | * |
||
143 | * This function is deprecated in favour of getTextPart/getHtmlPart and |
||
144 | * getPartByMimeType. |
||
145 | * |
||
146 | * @deprecated since version 0.4.2 |
||
147 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
148 | */ |
||
149 | public function getContentPart() |
||
158 | |||
159 | /** |
||
160 | * Returns an open resource handle for the passed string or resource handle. |
||
161 | * |
||
162 | * For a string, creates a php://temp stream and returns it. |
||
163 | * |
||
164 | * @param resource|string $stringOrHandle |
||
165 | * @return resource |
||
166 | */ |
||
167 | 5 | private function getHandleForStringOrHandle($stringOrHandle) |
|
178 | |||
179 | /** |
||
180 | * Creates and returns a unique boundary. |
||
181 | * |
||
182 | * @param string $mimeType first 3 characters of a multipart type are used, |
||
183 | * e.g. REL for relative or ALT for alternative |
||
184 | * @return string |
||
185 | */ |
||
186 | 18 | private function getUniqueBoundary($mimeType) |
|
191 | |||
192 | /** |
||
193 | * Creates a unique mime boundary and assigns it to the passed part's |
||
194 | * Content-Type header with the passed mime type. |
||
195 | * |
||
196 | * @param \ZBateson\MailMimeParser\Message\MimePart $part |
||
197 | * @param string $mimeType |
||
198 | */ |
||
199 | 11 | private function setMimeHeaderBoundaryOnPart(MimePart $part, $mimeType) |
|
207 | |||
208 | /** |
||
209 | * Sets this message to be a multipart/alternative message, making space for |
||
210 | * a second content part. |
||
211 | * |
||
212 | * Creates a content part and assigns the content stream from the message to |
||
213 | * that newly created part. |
||
214 | */ |
||
215 | 2 | private function setMessageAsAlternative() |
|
229 | |||
230 | /** |
||
231 | * Returns the direct child of $alternativePart containing a part of |
||
232 | * $mimeType. |
||
233 | * |
||
234 | * Used for alternative mime types that have a multipart/mixed or |
||
235 | * multipart/related child containing a content part of $mimeType, where |
||
236 | * the whole mixed/related part should be removed. |
||
237 | * |
||
238 | * @param string $mimeType the content-type to find below $alternativePart |
||
239 | * @param MimePart $alternativePart The multipart/alternative part to look |
||
240 | * under |
||
241 | * @return boolean|MimePart false if a part is not found |
||
242 | */ |
||
243 | 10 | private function getContentPartContainerFromAlternative($mimeType, MimePart $alternativePart) |
|
256 | |||
257 | /** |
||
258 | * Moves all parts under $from into this message except those with a |
||
259 | * content-type equal to $exceptMimeType. If the message is not a |
||
260 | * multipart/mixed message, it is set to multipart/mixed first. |
||
261 | * |
||
262 | * @param MimePart $from |
||
263 | * @param string $exceptMimeType |
||
264 | */ |
||
265 | 6 | private function moveAllPartsAsAttachmentsExcept(MimePart $from, $exceptMimeType) |
|
283 | |||
284 | /** |
||
285 | * Removes all parts of $mimeType from $alternativePart. |
||
286 | * |
||
287 | * If $alternativePart contains a multipart/mixed or multipart/relative part |
||
288 | * with other parts of different content-types, the multipart part is |
||
289 | * removed, and parts of different content-types can optionally be moved to |
||
290 | * the main message part. |
||
291 | * |
||
292 | * @param string $mimeType |
||
293 | * @param MimePart $alternativePart |
||
294 | * @param bool $keepOtherContent |
||
295 | * @return bool |
||
296 | */ |
||
297 | 6 | private function removeAllContentPartsFromAlternative($mimeType, $alternativePart, $keepOtherContent) |
|
322 | |||
323 | /** |
||
324 | * Removes the content part of the message with the passed mime type. If |
||
325 | * there is a remaining content part and it is an alternative part of the |
||
326 | * main message, the content part is moved to the message part. |
||
327 | * |
||
328 | * If the content part is part of an alternative part beneath the message, |
||
329 | * the alternative part is replaced by the remaining content part, |
||
330 | * optionally keeping other parts if $keepOtherContent is set to true. |
||
331 | * |
||
332 | * @param string $mimeType |
||
333 | * @param bool $keepOtherContent |
||
334 | * @return boolean true on success |
||
335 | */ |
||
336 | 6 | protected function removeAllContentPartsByMimeType($mimeType, $keepOtherContent = false) |
|
345 | |||
346 | /** |
||
347 | * Removes the 'inline' part with the passed contentType, at the given index |
||
348 | * defaulting to the first |
||
349 | * |
||
350 | * @param string $contentType |
||
351 | * @param int $index |
||
352 | * @return boolean true on success |
||
353 | */ |
||
354 | 5 | protected function removePartByMimeType($mimeType, $index = 0) |
|
370 | |||
371 | /** |
||
372 | * Creates a new mime part as a multipart/alternative and assigns the passed |
||
373 | * $contentPart as a part below it before returning it. |
||
374 | * |
||
375 | * @param MimePart $contentPart |
||
376 | * @return MimePart the alternative part |
||
377 | */ |
||
378 | 2 | private function createAlternativeContentPart(MimePart $contentPart) |
|
387 | |||
388 | /** |
||
389 | * Copies type headers (Content-Type, Content-Disposition, |
||
390 | * Content-Transfer-Encoding) from the $from MimePart to $to. Attaches the |
||
391 | * content resource handle of $from to $to, and loops over child parts, |
||
392 | * removing them from $from and adding them to $to. |
||
393 | * |
||
394 | * @param MimePart $from |
||
395 | * @param MimePart $to |
||
396 | */ |
||
397 | 3 | private function movePartContentAndChildrenToPart(MimePart $from, MimePart $to) |
|
407 | |||
408 | /** |
||
409 | * Replaces the $part MimePart with $replacement. |
||
410 | * |
||
411 | * Essentially removes $part from its parent, and adds $replacement in its |
||
412 | * same position. If $part is this Message, its type headers are moved from |
||
413 | * this message to $replacement, the content resource is moved, and children |
||
414 | * are assigned to $replacement. |
||
415 | * |
||
416 | * @param MimePart $part |
||
417 | * @param MimePart $replacement |
||
418 | */ |
||
419 | 4 | private function replacePart(MimePart $part, MimePart $replacement) |
|
430 | |||
431 | /** |
||
432 | * Copies Content-Type, Content-Disposition and Content-Transfer-Encoding |
||
433 | * headers from the $from header into the $to header. If the Content-Type |
||
434 | * header isn't defined in $from, defaults to text/plain and |
||
435 | * quoted-printable. |
||
436 | * |
||
437 | * @param \ZBateson\MailMimeParser\Message\MimePart $from |
||
438 | * @param \ZBateson\MailMimeParser\Message\MimePart $to |
||
439 | */ |
||
440 | 16 | private function copyTypeHeadersFromPartToPart(MimePart $from, MimePart $to) |
|
458 | |||
459 | /** |
||
460 | * Creates a new content part from the passed part, allowing the part to be |
||
461 | * used for something else (e.g. changing a non-mime message to a multipart |
||
462 | * mime message). |
||
463 | * |
||
464 | * @param MimePart $part |
||
465 | * @return MimePart the newly-created MimePart |
||
466 | */ |
||
467 | 8 | private function createNewContentPartFromPart(MimePart $part) |
|
475 | |||
476 | /** |
||
477 | * Creates a new part out of the current contentPart and sets the message's |
||
478 | * type to be multipart/mixed. |
||
479 | */ |
||
480 | 9 | private function setMessageAsMixed() |
|
490 | |||
491 | /** |
||
492 | * This function makes space by moving the main message part down one level. |
||
493 | * |
||
494 | * The content-type, content-disposition and content-transfer-encoding |
||
495 | * headers are copied from this message to the newly created part, the |
||
496 | * resource handle is moved and detached, any attachments and content parts |
||
497 | * with parents set to this message get their parents set to the newly |
||
498 | * created part. |
||
499 | */ |
||
500 | 8 | private function makeSpaceForMultipartSignedMessage() |
|
515 | |||
516 | /** |
||
517 | * Creates and returns a new MimePart for the signature part of a |
||
518 | * multipart/signed message |
||
519 | * |
||
520 | * @param string $body |
||
521 | */ |
||
522 | 8 | public function createSignaturePart($body) |
|
535 | |||
536 | /** |
||
537 | * Loops over parts of this message and sets the content-transfer-encoding |
||
538 | * header to quoted-printable for text/* mime parts, and to base64 |
||
539 | * otherwise for parts that are '8bit' encoded. |
||
540 | * |
||
541 | * Used for multipart/signed messages which doesn't support 8bit transfer |
||
542 | * encodings. |
||
543 | */ |
||
544 | 8 | private function overwrite8bitContentEncoding() |
|
560 | |||
561 | /** |
||
562 | * Ensures a non-text part comes first in a signed multipart/alternative |
||
563 | * message as some clients seem to prefer the first content part if the |
||
564 | * client doesn't understand multipart/signed. |
||
565 | */ |
||
566 | 8 | private function ensureHtmlPartFirstForSignedMessage() |
|
579 | |||
580 | /** |
||
581 | * Turns the message into a multipart/signed message, moving the actual |
||
582 | * message into a child part, sets the content-type of the main message to |
||
583 | * multipart/signed and adds a signature part as well. |
||
584 | * |
||
585 | * @param string $micalg The Message Integrity Check algorithm being used |
||
586 | * @param string $protocol The mime-type of the signature body |
||
587 | */ |
||
588 | 8 | public function setAsMultipartSigned($micalg, $protocol) |
|
605 | |||
606 | /** |
||
607 | * Returns the signed part or null if not set. |
||
608 | * |
||
609 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
610 | */ |
||
611 | 16 | public function getSignaturePart() |
|
615 | |||
616 | /** |
||
617 | * Returns a string containing the original message's signed part, useful |
||
618 | * for verifying the email. |
||
619 | * |
||
620 | * If the signed part of the message ends in a final empty line, the line is |
||
621 | * removed as it's considered part of the signature's mime boundary. From |
||
622 | * RFC-3156: |
||
623 | * |
||
624 | * Note: The accepted OpenPGP convention is for signed data to end |
||
625 | * with a <CR><LF> sequence. Note that the <CR><LF> sequence |
||
626 | * immediately preceding a MIME boundary delimiter line is considered |
||
627 | * to be part of the delimiter in [3], 5.1. Thus, it is not part of |
||
628 | * the signed data preceding the delimiter line. An implementation |
||
629 | * which elects to adhere to the OpenPGP convention has to make sure |
||
630 | * it inserts a <CR><LF> pair on the last line of the data to be |
||
631 | * signed and transmitted (signed message and transmitted message |
||
632 | * MUST be identical). |
||
633 | * |
||
634 | * The additional line should be inserted by the signer -- for verification |
||
635 | * purposes if it's missing, it would seem the content part would've been |
||
636 | * signed without a last <CR><LF>. |
||
637 | * |
||
638 | * @return string or null if the message doesn't have any children, or the |
||
639 | * child returns null for getOriginalStreamHandle |
||
640 | */ |
||
641 | 12 | public function getOriginalMessageStringForSignatureVerification() |
|
658 | |||
659 | /** |
||
660 | * Enforces the message to be a mime message for a non-mime (e.g. uuencoded |
||
661 | * or unspecified) message. If the message has uuencoded attachments, sets |
||
662 | * up the message as a multipart/mixed message and creates a content part. |
||
663 | */ |
||
664 | 12 | private function enforceMime() |
|
675 | |||
676 | /** |
||
677 | * Creates a multipart/related part out of 'inline' children of $parent and |
||
678 | * returns it. |
||
679 | * |
||
680 | * @param MimePart $parent |
||
681 | * @return MimePart |
||
682 | */ |
||
683 | private function createMultipartRelatedPartForInlineChildrenOf(MimePart $parent) |
||
694 | |||
695 | /** |
||
696 | * Finds an alternative inline part in the message and returns it if one |
||
697 | * exists. |
||
698 | * |
||
699 | * If the passed $mimeType is text/plain, searches for a text/html part. |
||
700 | * Otherwise searches for a text/plain part to return. |
||
701 | * |
||
702 | * @param string $mimeType |
||
703 | * @return MimeType or null if not found |
||
704 | */ |
||
705 | 4 | private function findOtherContentPartFor($mimeType) |
|
719 | |||
720 | /** |
||
721 | * Creates a new content part for the passed mimeType and charset, making |
||
722 | * space by creating a multipart/alternative if needed |
||
723 | * |
||
724 | * @param string $mimeType |
||
725 | * @param string $charset |
||
726 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
727 | */ |
||
728 | 4 | private function createContentPartForMimeType($mimeType, $charset) |
|
749 | |||
750 | /** |
||
751 | * Either creates a mime part or sets the existing mime part with the passed |
||
752 | * mimeType to $strongOrHandle. |
||
753 | * |
||
754 | * @param string $mimeType |
||
755 | * @param string|resource $stringOrHandle |
||
756 | * @param string $charset |
||
757 | */ |
||
758 | 4 | protected function setContentPartForMimeType($mimeType, $stringOrHandle, $charset) |
|
770 | |||
771 | /** |
||
772 | * Sets the text/plain part of the message to the passed $stringOrHandle, |
||
773 | * either creating a new part if one doesn't exist for text/plain, or |
||
774 | * assigning the value of $stringOrHandle to an existing text/plain part. |
||
775 | * |
||
776 | * The optional $charset parameter is the charset for saving to. |
||
777 | * $stringOrHandle is expected to be in UTF-8 regardless of the target |
||
778 | * charset. |
||
779 | * |
||
780 | * @param string|resource $stringOrHandle |
||
781 | * @param string $charset |
||
782 | */ |
||
783 | 1 | public function setTextPart($stringOrHandle, $charset = 'UTF-8') |
|
787 | |||
788 | /** |
||
789 | * Sets the text/html part of the message to the passed $stringOrHandle, |
||
790 | * either creating a new part if one doesn't exist for text/html, or |
||
791 | * assigning the value of $stringOrHandle to an existing text/html part. |
||
792 | * |
||
793 | * The optional $charset parameter is the charset for saving to. |
||
794 | * $stringOrHandle is expected to be in UTF-8 regardless of the target |
||
795 | * charset. |
||
796 | * |
||
797 | * @param string|resource $stringOrHandle |
||
798 | * @param string $charset |
||
799 | */ |
||
800 | 4 | public function setHtmlPart($stringOrHandle, $charset = 'UTF-8') |
|
804 | |||
805 | /** |
||
806 | * Removes the text/plain part of the message at the passed index if one |
||
807 | * exists. Returns true on success. |
||
808 | * |
||
809 | * @return bool true on success |
||
810 | */ |
||
811 | 3 | public function removeTextPart($index = 0) |
|
815 | |||
816 | /** |
||
817 | * Removes all text/plain inline parts in this message, optionally keeping |
||
818 | * other inline parts as attachments on the main message (defaults to |
||
819 | * keeping them). |
||
820 | * |
||
821 | * @param bool $keepOtherPartsAsAttachments |
||
822 | * @return bool true on success |
||
823 | */ |
||
824 | public function removeAllTextParts($keepOtherPartsAsAttachments = true) |
||
828 | |||
829 | /** |
||
830 | * Removes the html part of the message if one exists. Returns true on |
||
831 | * success. |
||
832 | * |
||
833 | * @return bool true on success |
||
834 | */ |
||
835 | 2 | public function removeHtmlPart($index = 0) |
|
839 | |||
840 | /** |
||
841 | * Removes all text/html inline parts in this message, optionally keeping |
||
842 | * other inline parts as attachments on the main message (defaults to |
||
843 | * keeping them). |
||
844 | * |
||
845 | * @param bool $keepOtherPartsAsAttachments |
||
846 | * @return bool true on success |
||
847 | */ |
||
848 | 1 | public function removeAllHtmlParts($keepOtherPartsAsAttachments = true) |
|
852 | |||
853 | /** |
||
854 | * Returns the attachment part at the given 0-based index, or null if none |
||
855 | * is set. |
||
856 | * |
||
857 | * @param int $index |
||
858 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
859 | */ |
||
860 | 7 | public function getAttachmentPart($index) |
|
868 | |||
869 | /** |
||
870 | * Returns all attachment parts. |
||
871 | * |
||
872 | * Attachments are any non-multipart, non-signature and non inline text or |
||
873 | * html part (a text or html part with a Content-Disposition set to |
||
874 | * 'attachment' is considered an attachment). |
||
875 | * |
||
876 | * @return \ZBateson\MailMimeParser\Message\MimePart[] |
||
877 | */ |
||
878 | 52 | public function getAllAttachmentParts() |
|
895 | |||
896 | /** |
||
897 | * Returns the number of attachments available. |
||
898 | * |
||
899 | * @return int |
||
900 | */ |
||
901 | 49 | public function getAttachmentCount() |
|
905 | |||
906 | /** |
||
907 | * Removes the attachment with the given index |
||
908 | * |
||
909 | * @param int $index |
||
910 | */ |
||
911 | 2 | public function removeAttachmentPart($index) |
|
916 | |||
917 | /** |
||
918 | * Creates and returns a MimePart for use with a new attachment part being |
||
919 | * created. |
||
920 | * |
||
921 | * @return \ZBateson\MailMimeParser\Message\MimePart |
||
922 | */ |
||
923 | 2 | protected function createPartForAttachment() |
|
935 | |||
936 | /** |
||
937 | * Adds an attachment part for the passed raw data string or handle and |
||
938 | * given parameters. |
||
939 | * |
||
940 | * @param string|handle $stringOrHandle |
||
941 | * @param strubg $mimeType |
||
942 | * @param string $filename |
||
943 | * @param string $disposition |
||
944 | */ |
||
945 | 1 | public function addAttachmentPart($stringOrHandle, $mimeType, $filename = null, $disposition = 'attachment') |
|
957 | |||
958 | /** |
||
959 | * Adds an attachment part using the passed file. |
||
960 | * |
||
961 | * Essentially creates a file stream and uses it. |
||
962 | * |
||
963 | * @param string $file |
||
964 | * @param string $mimeType |
||
965 | * @param string $filename |
||
966 | * @param string $disposition |
||
967 | */ |
||
968 | 2 | public function addAttachmentPartFromFile($file, $mimeType, $filename = null, $disposition = 'attachment') |
|
981 | |||
982 | /** |
||
983 | * Returns a resource handle where the 'inline' text/plain content at the |
||
984 | * passed $index can be read or null if unavailable. |
||
985 | * |
||
986 | * @param int $index |
||
987 | * @return resource |
||
988 | */ |
||
989 | 61 | public function getTextStream($index = 0) |
|
997 | |||
998 | /** |
||
999 | * Returns the content of the inline text/plain part at the given index. |
||
1000 | * |
||
1001 | * Reads the entire stream content into a string and returns it. Returns |
||
1002 | * null if the message doesn't have an inline text part. |
||
1003 | * |
||
1004 | * @param int $index |
||
1005 | * @return string |
||
1006 | */ |
||
1007 | 1 | public function getTextContent($index = 0) |
|
1015 | |||
1016 | /** |
||
1017 | * Returns a resource handle where the 'inline' text/html content at the |
||
1018 | * passed $index can be read or null if unavailable. |
||
1019 | * |
||
1020 | * @return resource |
||
1021 | */ |
||
1022 | 31 | public function getHtmlStream($index = 0) |
|
1030 | |||
1031 | /** |
||
1032 | * Returns the content of the inline text/html part at the given index. |
||
1033 | * |
||
1034 | * Reads the entire stream content into a string and returns it. Returns |
||
1035 | * null if the message doesn't have an inline html part. |
||
1036 | * |
||
1037 | * @param int $index |
||
1038 | * @return string |
||
1039 | */ |
||
1040 | 1 | public function getHtmlContent($index = 0) |
|
1048 | |||
1049 | /** |
||
1050 | * Returns true if either a Content-Type or Mime-Version header are defined |
||
1051 | * in this Message. |
||
1052 | * |
||
1053 | * @return bool |
||
1054 | */ |
||
1055 | 91 | public function isMime() |
|
1061 | |||
1062 | /** |
||
1063 | * Saves the message as a MIME message to the passed resource handle. |
||
1064 | * |
||
1065 | * @param resource $handle |
||
1066 | */ |
||
1067 | 83 | public function save($handle) |
|
1071 | |||
1072 | /** |
||
1073 | * Returns the content part of a signed message for a signature to be |
||
1074 | * calculated on the message. |
||
1075 | * |
||
1076 | * @return string |
||
1077 | */ |
||
1078 | 8 | public function getSignableBody() |
|
1082 | |||
1083 | /** |
||
1084 | * Shortcut to call Message::save with a php://temp stream and return the |
||
1085 | * written email message as a string. |
||
1086 | * |
||
1087 | * @return string |
||
1088 | */ |
||
1089 | public function __toString() |
||
1098 | } |
||
1099 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.