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 Get
10: *
11: * @package SMSApi\Api\Action\Sms
12: */
13: class Get extends AbstractAction {
14:
15: /**
16: * @var \ArrayObject
17: */
18: private $id;
19:
20: /**
21: *
22: */
23: function __construct() {
24: $this->id = new \ArrayObject();
25: }
26:
27: /**
28: * @param $data
29: * @return \SMSApi\Api\Response\StatusResponse
30: */
31: protected function response( $data ) {
32:
33: return new \SMSApi\Api\Response\StatusResponse( $data );
34: }
35:
36: /**
37: * @return Uri
38: */
39: public function uri() {
40:
41: $query = "";
42:
43: $query .= $this->paramsLoginToQuery();
44:
45: $query .= $this->paramsOther();
46:
47: $query .= "&status=" . implode( "|", $this->id->getArrayCopy() );
48:
49: return new Uri( $this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/sms.do", $query );
50: }
51:
52: /**
53: * Set ID of message to check.
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 check.
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: * @param $id
91: * @return $this
92: */
93: public function id( $id ) {
94: return $this->filterById($id);
95: }
96:
97: }
98: