Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| Mimepart | |
100.00% |
10 / 10 |
|
100.00% |
7 / 7 |
12 | |
100.00% |
1 / 1 |
| getDefaults | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| isBase64Encoded | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| isHtml | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| isText | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| isIcs | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| getContent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| getExtension | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsentities; |
| 4 | |
| 5 | class Mimepart extends Schema\Entity |
| 6 | { |
| 7 | public const PRIMARY = 'id'; |
| 8 | |
| 9 | public static $schema = "mimepart.json"; |
| 10 | |
| 11 | public function getDefaults() |
| 12 | { |
| 13 | return [ |
| 14 | 'mime' => '', |
| 15 | 'content' => '', |
| 16 | ]; |
| 17 | } |
| 18 | |
| 19 | public function isBase64Encoded() |
| 20 | { |
| 21 | return ($this->base64) ? true : false; |
| 22 | } |
| 23 | |
| 24 | public function isHtml() |
| 25 | { |
| 26 | return ($this->mime == 'text/html') ? true : false; |
| 27 | } |
| 28 | |
| 29 | public function isText() |
| 30 | { |
| 31 | return ($this->mime == 'text/plain') ? true : false; |
| 32 | } |
| 33 | |
| 34 | public function isIcs() |
| 35 | { |
| 36 | return ($this->mime == 'text/calendar') ? true : false; |
| 37 | } |
| 38 | |
| 39 | public function getContent() |
| 40 | { |
| 41 | return ($this->isBase64Encoded()) ? \base64_decode($this->content) : $this->content; |
| 42 | } |
| 43 | |
| 44 | public function getExtension() |
| 45 | { |
| 46 | return preg_replace('#^.*/#', '', $this->mime); |
| 47 | } |
| 48 | } |