francis94c /
ci-gmail
| 1 | <?php |
||
| 2 | declare(strict_types=1); |
||
| 3 | |||
| 4 | defined('BASEPATH') OR exit('No direct script access allowed');
|
||
| 5 | |||
| 6 | class MessagePart |
||
| 7 | {
|
||
| 8 | /** |
||
| 9 | * [protected description] |
||
| 10 | * @var [type] |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 11 | */ |
||
| 12 | protected $part; |
||
| 13 | /** |
||
| 14 | * [__construct description] |
||
| 15 | * @date 2019-11-23 |
||
| 16 | * @param [type] $part [description] |
||
|
0 ignored issues
–
show
|
|||
| 17 | */ |
||
| 18 | function __construct($part) |
||
| 19 | {
|
||
| 20 | $this->part = $part; |
||
| 21 | } |
||
| 22 | /** |
||
| 23 | * [__get description] |
||
| 24 | * @date 2019-11-23 |
||
| 25 | * @param string $key [description] |
||
| 26 | * @return [type] [description] |
||
|
0 ignored issues
–
show
|
|||
| 27 | */ |
||
| 28 | public function __get(string $key):string |
||
| 29 | {
|
||
| 30 | return $this->part->{$key};
|
||
| 31 | } |
||
| 32 | /** |
||
| 33 | * [header description] |
||
| 34 | * @date 2019-11-22 |
||
| 35 | * @param string $key [description] |
||
| 36 | * @return string|null [description] |
||
| 37 | */ |
||
| 38 | public function header(string $key):?string |
||
| 39 | {
|
||
| 40 | foreach ($this->part->headers as $header) {
|
||
| 41 | if ($header->name == $key) {
|
||
| 42 | return $header->value; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | return null; |
||
| 46 | } |
||
| 47 | /** |
||
| 48 | * [getSize description] |
||
| 49 | * @date 2019-11-23 |
||
| 50 | * @return int [description] |
||
| 51 | */ |
||
| 52 | public function getSize():int |
||
| 53 | {
|
||
| 54 | return $this->part->body->size; |
||
| 55 | } |
||
| 56 | /** |
||
| 57 | * [body description] |
||
| 58 | * @date 2019-11-23 |
||
| 59 | * @param integer $partId [description] |
||
| 60 | * @return [type] [description] |
||
|
0 ignored issues
–
show
|
|||
| 61 | */ |
||
| 62 | public function body(int $partId=0) |
||
| 63 | {
|
||
| 64 | return base64url_decode($this->part->body->data); |
||
| 65 | } |
||
| 66 | } |
||
| 67 | ?> |
||
| 68 |