Permalink
Browse files

Code simplification in setBody()

  • Loading branch information...
1 parent fd983f9 commit 179235d12ac1be4b7b62b5bcba5ca09334c5f529 @alecpl alecpl committed Jul 14, 2016
Showing with 9 additions and 15 deletions.
  1. +9 −15 Mail/mime.php
View
@@ -1544,23 +1544,17 @@ protected function checkParams()
*/
protected function setBody($type, $data, $isfile = false, $append = false)
{
- if (!$isfile) {
- if (!$append) {
- $this->{$type} = $data;
- } else {
- $this->{$type} .= $data;
- }
- } else {
- $cont = $this->file2str($data);
- if (self::isError($cont)) {
- return $cont;
+ if ($isfile) {
+ $data = $this->file2str($data);
+ if (self::isError($data)) {
+ return $data;
}
+ }
- if (!$append) {
- $this->{$type} = $cont;
- } else {
- $this->{$type} .= $cont;
- }
+ if (!$append) {
+ $this->{$type} = $data;
+ } else {
+ $this->{$type} .= $data;
}
return true;

0 comments on commit 179235d

Please sign in to comment.