bytic /
mail
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Nip\Mail\MessageBuilder; |
||
| 4 | |||
| 5 | trait CanBuild |
||
| 6 | { |
||
| 7 | protected $isBuild = false; |
||
| 8 | protected $buildMethods = ['buildFrom', 'buildRecipients', 'buildSubject', 'buildBody', 'buildAttachments']; |
||
| 9 | |||
| 10 | protected function guardIsBuild() |
||
| 11 | { |
||
| 12 | if ($this->isBuild) { |
||
| 13 | return; |
||
| 14 | } |
||
| 15 | $this->build(); |
||
| 16 | $this->isBuild = true; |
||
| 17 | } |
||
| 18 | |||
| 19 | protected function build() |
||
| 20 | { |
||
| 21 | foreach ($this->buildMethods as $method) { |
||
| 22 | if (method_exists($this, $method)) { |
||
| 23 | $this->{$method}(); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | $this->runCallbacks(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 27 | } |
||
| 28 | } |
||
| 29 |