      1: <?php
      2:
      3: namespace SMSApi\Api;
      4:
      5: /**
      6:  * Class PhonebookFactory
      7:  * @package SMSApi\Api
      8:  */
      9: class PhonebookFactory extends ActionFactory {
     10:
     11:     /**
     12:      * @return Action\Phonebook\GroupList
     13:      */
     14:     public function actionGroupList() {
     15:         $action = new \SMSApi\Api\Action\Phonebook\GroupList();
     16:         $action->client( $this->client );
     17:         $action->proxy( $this->proxy );
     18:
     19:         return $action;
     20:     }
     21:
     22:     /**
     23:      * @param null $groupName
     24:      * @return Action\Phonebook\GroupAdd
     25:      */
     26:     public function actionGroupAdd( $groupName = null ) {
     27:         $action = new \SMSApi\Api\Action\Phonebook\GroupAdd();
     28:         $action->client( $this->client );
     29:         $action->proxy( $this->proxy );
     30:
     31:         if ( !empty( $groupName ) ) {
     32:             $action->setName( $groupName );
     33:         }
     34:
     35:         return $action;
     36:     }
     37:
     38:     /**
     39:      * @param null $groupName
     40:      * @return Action\Phonebook\GroupEdit
     41:      */
     42:     public function actionGroupEdit( $groupName = null ) {
     43:         $action = new \SMSApi\Api\Action\Phonebook\GroupEdit();
     44:         $action->client( $this->client );
     45:         $action->proxy( $this->proxy );
     46:
     47:         if ( !empty( $groupName ) ) {
     48:             $action->filterByGroupName( $groupName );
     49:         }
     50:
     51:         return $action;
     52:     }
     53:
     54:     /**
     55:      * @param null $groupName
     56:      * @return Action\Phonebook\GroupGet
     57:      */
     58:     public function actionGroupGet( $groupName = null ) {
     59:         $action = new \SMSApi\Api\Action\Phonebook\GroupGet();
     60:         $action->client( $this->client );
     61:         $action->proxy( $this->proxy );
     62:
     63:         if ( !empty( $groupName ) ) {
     64:             $action->filterByGroupName( $groupName );
     65:         }
     66:
     67:         return $action;
     68:     }
     69:
     70:     /**
     71:      * @param null $groupName
     72:      * @return Action\Phonebook\GroupDelete
     73:      */
     74:     public function actionGroupDelete( $groupName = null ) {
     75:         $action = new \SMSApi\Api\Action\Phonebook\GroupDelete();
     76:         $action->client( $this->client );
     77:         $action->proxy( $this->proxy );
     78:
     79:         if ( !empty( $groupName ) ) {
     80:             $action->filterByGroupName( $groupName );
     81:         }
     82:
     83:         return $action;
     84:     }
     85:
     86:     /**
     87:      * @return Action\Phonebook\ContactList
     88:      */
     89:     public function actionContactList() {
     90:         $action = new \SMSApi\Api\Action\Phonebook\ContactList();
     91:         $action->client( $this->client );
     92:         $action->proxy( $this->proxy );
     93:
     94:         return $action;
     95:     }
     96:
     97:     /**
     98:      * @param null $number
     99:      * @return Action\Phonebook\ContactAdd
    100:      */
    101:     public function actionContactAdd( $number = null ) {
    102:         $action = new \SMSApi\Api\Action\Phonebook\ContactAdd();
    103:         $action->client( $this->client );
    104:         $action->proxy( $this->proxy );
    105:
    106:         if ( !empty( $number ) ) {
    107:             $action->setNumber( $number );
    108:         }
    109:
    110:         return $action;
    111:     }
    112:
    113:     /**
    114:      * @param null $number
    115:      * @return Action\Phonebook\ContactEdit
    116:      */
    117:     public function actionContactEdit( $number = null ) {
    118:         $action = new \SMSApi\Api\Action\Phonebook\ContactEdit();
    119:         $action->client( $this->client );
    120:         $action->proxy( $this->proxy );
    121:
    122:         if ( !empty( $number ) ) {
    123:             $action->filterByPhoneNumber( $number );
    124:         }
    125:
    126:         return $action;
    127:     }
    128:
    129:     /**
    130:      * @param null $number
    131:      * @return Action\Phonebook\ContactGet
    132:      */
    133:     public function actionContactGet( $number = null ) {
    134:         $action = new \SMSApi\Api\Action\Phonebook\ContactGet();
    135:         $action->client( $this->client );
    136:         $action->proxy( $this->proxy );
    137:
    138:         if ( !empty( $number ) ) {
    139:             $action->filterByPhoneNumber( $number );
    140:         }
    141:
    142:         return $action;
    143:     }
    144:
    145:     /**
    146:      * @param null $number
    147:      * @return Action\Phonebook\ContactDelete
    148:      */
    149:     public function actionContactDelete( $number = null ) {
    150:         $action = new \SMSApi\Api\Action\Phonebook\ContactDelete();
    151:         $action->client( $this->client );
    152:         $action->proxy( $this->proxy );
    153:
    154:         if ( !empty( $number ) ) {
    155:             $action->filterByPhoneNumber( $number );
    156:         }
    157:
    158:         return $action;
    159:     }
    160:
    161: }
    162: