1: <?php
2: /**
3: * Contact entity
4: *
5: * @author Yannick Huerre <dev@sheoak.fr>
6: * @copyright 2015 (c) Oasiswork
7: * @license https://opensource.org/licenses/MIT MIT
8: */
9: namespace Crunchmail\Entities;
10:
11: /**
12: * Message entity class
13: */
14: class ContactEntity extends \Crunchmail\Entities\GenericEntity
15: {
16: /**
17: * To string
18: *
19: * @return string
20: */
21: public function __toString()
22: {
23: return $this->name;
24: }
25:
26: /**
27: * Copy contact to another list
28: *
29: * @param ContactListEntity $list List where to copy
30: *
31: * @return ContactEntity
32: */
33: public function copyTo($list)
34: {
35: $body = $this->getBody();
36:
37: unset($body->url);
38: $body->contact_list = $list->url;
39:
40: return $this->_resource->client->contacts->post($body);
41: }
42: }
43: