src/Ovh/Sms/SmsClient.php
public function createSender($domain, $sender)
    {
        if (!$domain)
            throw new BadMethodCallException('Parameter $domain is missing.');
        if (!$sender)
            throw new BadMethodCallException('Parameter $sender is missing.');
        if (!is_array($sender))
            throw new BadMethodCallException('Parameter $sender must be a array. ' . gettype($sender) . ' given.');
        // required fields (sender)
        if (!array_key_exists('sender', $sender))
            throw new BadMethodCallException('Parameter $sender have key sender (string).');
        // sanitize
        $t = array();
        $t['sender'] = $sender['sender'];
        // relaunch
        ($sender['relaunch']) ? $t['relaunch'] = $sender['relaunch'] : $t['relaunch'] = '';
        // reason
        ($sender['reason']) ? $t['reason'] = $sender['reason'] : $t['reason'] = '';
        unset($sender);
        try {
            $r = $this->post('sms/' . $domain . '/senders', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($t))->send();
        } catch (\Exception $e) {
            throw new SmsException($e->getMessage(), $e->getCode(), $e);
        }
    }
public function createSender($domain, $sender)
    {
        if (!$domain)
            throw new BadMethodCallException('Parameter $domain is missing.');
        if (!$sender)
            throw new BadMethodCallException('Parameter $sender is missing.');
        if (!is_array($sender))
            throw new BadMethodCallException('Parameter $sender must be a array. ' . gettype($sender) . ' given.');
        // required fields (sender)
        if (!array_key_exists('sender', $sender))
            throw new BadMethodCallException('Parameter $sender have key sender (string).');
        // sanitize
        $t = array();
        $t['sender'] = $sender['sender'];
        // relaunch
        ($sender['relaunch']) ? $t['relaunch'] = $sender['relaunch'] : $t['relaunch'] = '';
        // reason
        ($sender['reason']) ? $t['reason'] = $sender['reason'] : $t['reason'] = '';
        unset($sender);
        try {
            $r = $this->post('sms/' . $domain . '/senders', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($t))->send();
        } catch (\Exception $e) {
            throw new SmsException($e->getMessage(), $e->getCode(), $e);
        }
    }
public function createSender ( $ domain , $ sender ) { if ( ! $ domain ) throw new BadMethodCallException ( 'Parameter $domain is missing.' ) ; if ( ! $ sender ) throw new BadMethodCallException ( 'Parameter $sender is missing.' ) ; if ( ! is_array ( $ sender ) ) throw new BadMethodCallException ( 'Parameter $sender must be a array. ' . gettype ( $ sender ) . ' given.' ) ; // required fields (sender) if ( ! array_key_exists ( 'sender' , $ sender ) ) throw new BadMethodCallException ( 'Parameter $sender have key sender (string).' ) ; // sanitize $ t = array ( ) ; $ t [ 'sender' ] = $ sender [ 'sender' ] ; // relaunch ( $ sender [ 'relaunch' ] ) ? $ t [ 'relaunch' ] = $ sender [ 'relaunch' ] : $ t [ 'relaunch' ] = '' ; // reason ( $ sender [ 'reason' ] ) ? $ t [ 'reason' ] = $ sender [ 'reason' ] : $ t [ 'reason' ] = '' ; unset ( $ sender ) ; try { $ r = $ this -> post ( 'sms/' . $ domain . '/senders' , array ( 'Content-Type' => 'application/json;charset=UTF-8' ) , json_encode ( $ t ) ) -> send ( ) ; } catch ( \ Exception $ e ) { throw new SmsException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Create a new sender

@param string $domain
@param array $sender (keys : sender (requiered) => string, relaunch => string, reason => string)
@return void
@throws \Ovh\Common\Exception\BadMethodCallException
@throws Exception\SmsException
Create a new sender