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