mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-29 08:26:06 +03:00
Reduce code complexity
This commit is contained in:
parent
dc16e3f4d6
commit
3114b8a17a
@ -295,30 +295,21 @@ class MessageBuilder
|
|||||||
*
|
*
|
||||||
* @throws InvalidParameter
|
* @throws InvalidParameter
|
||||||
*
|
*
|
||||||
* @return bool|true
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function addInlineImage($inlineImagePath, $inlineImageName = null)
|
public function addInlineImage($inlineImagePath, $inlineImageName = null)
|
||||||
{
|
{
|
||||||
if (strpos($inlineImagePath, '@') === 0) {
|
if (strpos($inlineImagePath, '@') !== 0) {
|
||||||
if (isset($this->files['inline'])) {
|
|
||||||
$inlineAttachment = [
|
|
||||||
'filePath' => $inlineImagePath,
|
|
||||||
'remoteName' => $inlineImageName,
|
|
||||||
];
|
|
||||||
array_push($this->files['inline'], $inlineAttachment);
|
|
||||||
} else {
|
|
||||||
$this->files['inline'] = [
|
|
||||||
[
|
|
||||||
'filePath' => $inlineImagePath,
|
|
||||||
'remoteName' => $inlineImageName,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
throw new InvalidParameter(ExceptionMessages::INVALID_PARAMETER_INLINE);
|
throw new InvalidParameter(ExceptionMessages::INVALID_PARAMETER_INLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->files['inline'][] = [
|
||||||
|
'filePath' => $inlineImagePath,
|
||||||
|
'remoteName' => $inlineImageName,
|
||||||
|
];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user