1: <?php
2:
3: namespace SMSApi\Api\Action\Phonebook;
4:
5: use SMSApi\Api\Action\AbstractAction;
6: use SMSApi\Proxy\Uri;
7:
8: /**
9: * Class GroupDelete
10: * @package SMSApi\Api\Action\Phonebook
11: */
12: class GroupDelete extends AbstractAction {
13:
14: /**
15: * @param $data
16: * @return \SMSApi\Api\Response\RawResponse
17: */
18: protected function response( $data ) {
19:
20: return new \SMSApi\Api\Response\RawResponse( $data );
21: }
22:
23: /**
24: * @return Uri
25: */
26: public function uri() {
27:
28: $query = "";
29:
30: $query .= $this->paramsLoginToQuery();
31:
32: $query .= $this->paramsOther();
33:
34: return new Uri( $this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/phonebook.do", $query );
35: }
36:
37: /**
38: * @deprecated since v1.0.0
39: * @param string $groupName group name
40: * @return $this
41: */
42: public function setGroup( $groupName ) {
43: $this->params[ "delete_group" ] = $groupName;
44: return $this;
45: }
46:
47: /**
48: * Set group to delete.
49: *
50: * @param string $groupName group name
51: * @return $this
52: */
53: public function filterByGroupName( $groupName ) {
54: $this->params[ "delete_group" ] = $groupName;
55: return $this;
56: }
57:
58: /**
59: * Set true to remove contacts from phonebook.
60: * If contacts are in other groups, they will be only unbind.
61: *
62: * If this flag is false or unset contact will be only unbind from group.
63: *
64: * @param bool $remove if true contact in group will be removed
65: * @return $this
66: */
67: public function removeContacts( $remove ) {
68: if ( $remove == true ) {
69: $this->params[ "remove_contacts" ] = "1";
70: } else if ( $remove == false && isset( $this->params[ "remove_contacts" ] ) ) {
71: unset( $this->params[ "remove_contacts" ] );
72: }
73:
74: return $this;
75: }
76:
77: }