Overview

Namespaces

  • SMSApi
    • Api
      • Action
        • Mms
        • Phonebook
        • Sender
        • Sms
        • User
        • Vms
      • Response
    • Exception
    • Proxy
      • Http

Classes

  • Delete
  • Get
  • Send
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace SMSApi\Api\Action\Mms;
  4: 
  5: use SMSApi\Api\Action\AbstractAction;
  6: use SMSApi\Proxy\Uri;
  7: 
  8: /**
  9:  * Class Send
 10:  * @package SMSApi\Api\Action\Mms
 11:  */
 12: class Send extends AbstractAction {
 13: 
 14:     /**
 15:      * @param $data
 16:      * @return \SMSApi\Api\Response\StatusResponse
 17:      */
 18:     protected function response( $data ) {
 19: 
 20:         return new \SMSApi\Api\Response\StatusResponse( $data );
 21:     }
 22: 
 23:     /**
 24:      * @return Uri
 25:      * @throws \SMSApi\Exception\ActionException
 26:      */
 27:     public function uri() {
 28: 
 29:         $query = "";
 30: 
 31:         $query .= $this->paramsLoginToQuery();
 32: 
 33:         $query .= $this->paramsBasicToQuery();
 34: 
 35:         $query .= $this->paramsOther();
 36: 
 37:         return new Uri( $this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/mms.do", $query );
 38:     }
 39: 
 40:     /**
 41:      * Set mobile phone number of the recipients.
 42:      *
 43:      * @param $to array|string phone number
 44:      * @return $this
 45:      */
 46:     public function setTo( $to ) {
 47: 
 48:         if ( !is_array( $to ) ) {
 49:             $to = array( $to );
 50:         }
 51: 
 52:         $this->to->exchangeArray( $to );
 53:         return $this;
 54:     }
 55: 
 56:     /**
 57:      * Set name of the group from the phone book to which message should be sent.
 58:      *
 59:      * @param string $group group name
 60:      * @return $this
 61:      */
 62:     public function setGroup( $group ) {
 63:         $this->group = $group;
 64:         return $this;
 65:     }
 66: 
 67:     /**
 68:      * Set scheduled date sending message.
 69:      *
 70:      * Setting a past date will result in sending message instantly.
 71:      *
 72:      * @param $date
 73:      * @return $this
 74:      */
 75:     public function setDateSent( $date ) {
 76:         $this->date = $date;
 77:         return $this;
 78:     }
 79: 
 80:     /**
 81:      * Set optional custom value sent with SMS and sent back in CALLBACK.
 82:      *
 83:      * @param string|array $idx
 84:      * @return $this
 85:      */
 86:     public function setIDx( $idx ) {
 87:         if ( !is_array( $idx ) ) {
 88:             $idx = array( $idx );
 89:         }
 90: 
 91:         $this->idx->exchangeArray( $idx );
 92:         return $this;
 93:     }
 94: 
 95:     /**
 96:      * Set checking idx is unique.
 97:      *
 98:      * Prevents from sending more than one message with the same idx.
 99:      * When this parameter is set and message with the same idx was
100:      * already sent error 53 is returned.
101:      *
102:      * @param bool $check
103:      * @return $this
104:      */
105:     public function setCheckIDx( $check ) {
106:         if ( $check == true ) {
107:             $this->params[ "check_idx" ] = "1";
108:         } else if ( $check == false ) {
109:             $this->params[ "check_idx" ] = "0";
110:         }
111: 
112:         return $this;
113:     }
114: 
115: 
116:     /**
117:      * Set affiliate code.
118:      *
119:      * @param string $partner affiliate code
120:      * @return $this
121:      */
122:     public function setPartner( $partner ) {
123:         $this->params[ "partner_id" ] = $partner;
124:         return $this;
125:     }
126: 
127:     /**
128:      * Set message subject.
129:      *
130:      * @param string $subject subject of message
131:      * @return $this
132:      */
133:     public function setSubject( $subject ) {
134:         $this->params[ "subject" ] = $subject;
135:         return $this;
136:     }
137: 
138:     /**
139:      * Set MMS smill.
140:      *
141:      * @param string $smil xml smill
142:      * @return $this
143:      */
144:     public function setSmil( $smil ) {
145:         $this->params[ "smil" ] = urlencode($smil);
146:         return $this;
147:     }
148: 
149: }
SMSAPI api client API documentation generated by ApiGen 2.8.0