1: <?php
2:
3: namespace SMSApi\Api\Action\Sms;
4:
5: use SMSApi\Api\Action\AbstractAction;
6: use SMSApi\Proxy\Uri;
7:
8: /**
9: * Class Delete
10: * @package SMSApi\Api\Action\Sms
11: */
12: class Delete extends AbstractAction {
13:
14: /**
15: * @var \ArrayObject
16: */
17: private $id;
18:
19: /**
20: *
21: */
22: function __construct() {
23: $this->id = new \ArrayObject();
24: }
25:
26: /**
27: * @param $data
28: * @return \SMSApi\Api\Response\CountableResponse
29: */
30: protected function response( $data ) {
31:
32: return new \SMSApi\Api\Response\CountableResponse( $data );
33: }
34:
35: /**
36: * @return Uri
37: */
38: public function uri() {
39:
40: $query = "";
41:
42: $query .= $this->paramsLoginToQuery();
43:
44: $query .= $this->paramsOther();
45:
46: $query .= "&sch_del=" . implode( "|", $this->id->getArrayCopy() );
47:
48: return new Uri( $this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/sms.do", $query );
49: }
50:
51:
52: /**
53: * Set ID of message to delete.
54: *
55: * This id was returned after sending message.
56: *
57: * @param $id
58: * @return $this
59: * @throws \SMSApi\Exception\ActionException
60: */
61: public function filterById( $id ) {
62: $this->id->append( $id );
63: return $this;
64: }
65:
66: /**
67: * Set IDs of messages to delete.
68: *
69: * This id was returned after sending message.
70: *
71: * @param array $ids Message ids
72: * @return $this
73: */
74: public function filterByIds( array $ids ) {
75: $this->id->exchangeArray( $ids );
76: return $this;
77: }
78:
79: /**
80: * @deprecated since v1.0.0
81: * @param array $ids
82: * @return $this
83: */
84: public function ids( array $ids ) {
85: return $this->filterByIds( $ids );
86: }
87:
88: /**
89: * @deprecated since v1.0.0
90: *
91: * @param $id
92: * @return $this
93: */
94: public function id( $id ) {
95: return $this->filterById($id);
96: }
97:
98: }
99:
100: