| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | final class EmailTransformer implements Packable, Unpackable |
||
| 22 | { |
||
| 23 | private $type; |
||
| 24 | |||
| 25 | public function __construct(int $type) |
||
| 26 | { |
||
| 27 | $this->type = $type; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function getType() : int |
||
| 31 | { |
||
| 32 | return $this->type; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function pack(Packer $packer, $value) : ?string |
||
| 36 | { |
||
| 37 | if (!$value instanceof Email) { |
||
| 38 | return null; |
||
| 39 | } |
||
| 40 | |||
| 41 | return $packer->packExt($this->type, $packer->packStr($value->toString())); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function unpack(BufferUnpacker $unpacker, int $extLength) : Email |
||
| 47 | } |
||
| 48 | } |
||
| 49 |