diff --git a/NexmoClient/NexmoClient.php b/NexmoClient/NexmoClient.php index 8abe503..a546cbe 100644 --- a/NexmoClient/NexmoClient.php +++ b/NexmoClient/NexmoClient.php @@ -31,18 +31,25 @@ class NexmoClient { */ protected $delivery_phone; + /** + * @var boolean + */ + protected $disable_delivery; + /** * @param $api_key * @param $api_secret * @param string $api_method GET|POST configured in Nexmo API preferences - * @param $delivery_phone + * @param string $delivery_phone + * @param boolean $disable_delivery */ - public function __construct($api_key,$api_secret,$api_method='GET',$delivery_phone) { + public function __construct($api_key,$api_secret,$api_method='GET',$delivery_phone,$disable_delivery=false) { $this->rest_url = 'https://rest.nexmo.com'; $this->api_key = $api_key; $this->api_secret = $api_secret; $this->api_method = $api_method; $this->delivery_phone = $delivery_phone; + $this->disable_delivery = $disable_delivery; } /** @@ -111,6 +118,11 @@ class NexmoClient { 'text'=>$text, 'status-report-req'=>$status_report_req, ); + + if($this->disable_delivery) { + return null; + } + $response = $this->jsonRequest('/sms/json',$params); if((int)$response['messages'][0]['status']!=0) { diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 408a075..9c2013e 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -1,7 +1,9 @@ services: jhg_nexmo_client: class: Jhg\NexmoBundle\NexmoClient\NexmoClient - arguments: ["%jhg_nexmo.api_key%","%jhg_nexmo.api_secret%","%jhg_nexmo.api_method%","%jhg_nexmo.delivery_phone%"] + arguments: ["%jhg_nexmo.api_key%","%jhg_nexmo.api_secret%", + "%jhg_nexmo.api_method%","%jhg_nexmo.delivery_phone%", + "%jhg_nexmo.disable_delivery%"] jhg_nexmo_account: class: Jhg\NexmoBundle\Managers\AccountManager