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