|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* File: Address.php |
|
4
|
|
|
* Category: - |
|
5
|
|
|
* Author: M. Goldenbaum |
|
6
|
|
|
* Created: 01.01.21 21:17 |
|
7
|
|
|
* Updated: - |
|
8
|
|
|
* |
|
9
|
|
|
* Description: |
|
10
|
|
|
* - |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Webklex\PHPIMAP; |
|
14
|
|
|
|
|
15
|
|
|
use Illuminate\Support\Str; |
|
16
|
|
|
use Illuminate\Support\Facades\File; |
|
17
|
|
|
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException; |
|
18
|
|
|
use Webklex\PHPIMAP\Exceptions\MethodNotFoundException; |
|
19
|
|
|
use Webklex\PHPIMAP\Support\Masks\AttachmentMask; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Class Address |
|
23
|
|
|
* |
|
24
|
|
|
* @package Webklex\PHPIMAP |
|
25
|
|
|
*/ |
|
26
|
|
|
class Address { |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Address attributes |
|
30
|
|
|
* @var string $personal |
|
31
|
|
|
* @var string $mailbox |
|
32
|
|
|
* @var string $host |
|
33
|
|
|
* @var string $mail |
|
34
|
|
|
* @var string $full |
|
35
|
|
|
*/ |
|
36
|
|
|
public $personal = ""; |
|
37
|
|
|
public $mailbox = ""; |
|
38
|
|
|
public $host = ""; |
|
39
|
|
|
public $mail = ""; |
|
40
|
|
|
public $full = ""; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Address constructor. |
|
44
|
|
|
* @param object $object |
|
45
|
|
|
*/ |
|
46
|
|
|
public function __construct($object) { |
|
47
|
|
|
if (property_exists($object, "personal")){ $this->personal = $object->personal; } |
|
48
|
|
|
if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; } |
|
49
|
|
|
if (property_exists($object, "host")){ $this->host = $object->host; } |
|
50
|
|
|
if (property_exists($object, "mail")){ $this->mail = $object->mail; } |
|
51
|
|
|
if (property_exists($object, "full")){ $this->full = $object->full; } |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Return the stringified address |
|
57
|
|
|
* |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
|
|
public function __toString() { |
|
61
|
|
|
return $this->full; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Return the serialized address |
|
66
|
|
|
* |
|
67
|
|
|
* @return array |
|
68
|
|
|
*/ |
|
69
|
|
|
public function __serialize(){ |
|
70
|
|
|
return [ |
|
71
|
|
|
"personal" => $this->personal, |
|
72
|
|
|
"mailbox" => $this->mailbox, |
|
73
|
|
|
"host" => $this->host, |
|
74
|
|
|
"mail" => $this->mail, |
|
75
|
|
|
"full" => $this->full, |
|
76
|
|
|
]; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Convert instance to array |
|
81
|
|
|
* |
|
82
|
|
|
* @return array |
|
83
|
|
|
*/ |
|
84
|
|
|
public function toArray(){ |
|
85
|
|
|
return $this->__serialize(); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Return the stringified attribute |
|
90
|
|
|
* |
|
91
|
|
|
* @return string |
|
92
|
|
|
*/ |
|
93
|
|
|
public function toString(){ |
|
94
|
|
|
return $this->__toString(); |
|
95
|
|
|
} |
|
96
|
|
|
} |