Total Complexity | 8 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
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(){ |
||
76 | ]; |
||
77 | } |
||
78 | } |