| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | class AttachmentMask extends Mask { |
||
| 23 | |||
| 24 | /** @var Attachment $parent */ |
||
| 25 | protected $parent; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Get the attachment content base64 encoded |
||
| 29 | * |
||
| 30 | * @return string|null |
||
| 31 | */ |
||
| 32 | public function getContentBase64Encoded() { |
||
| 33 | return base64_encode($this->parent->content); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Get an base64 image src string |
||
| 38 | * |
||
| 39 | * @return string|null |
||
| 40 | */ |
||
| 41 | public function getImageSrc() { |
||
| 42 | return 'data:'.$this->parent->content_type.';base64,'.$this->getContentBase64Encoded(); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Alias method for better code reading |
||
| 47 | * |
||
| 48 | * @return Attachment |
||
| 49 | */ |
||
| 50 | public function getAttachment(){ |
||
| 52 | } |
||
| 53 | } |