%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/www/admin1/vendor/craftsys/msg91-php/src/Support/ |
Upload File : |
<?php
namespace Craftsys\Msg91\Support;
use Craftsys\Msg91\Contracts\Options;
use GuzzleHttp\Client as HttpClient;
abstract class Service
{
/**
* Options for Request
* @var \Craftsys\Msg91\Contracts\Options
*/
protected $options;
/**
* The msg91 client instance
* @var \Craftsys\Msg91\Client
*/
protected $client;
/**
* Options for Request
*/
public function getOptions(): Options
{
return $this->options;
}
/**
* Get the http client
* @return \GuzzleHttp\Client
*/
protected function getHttpClient()
{
return $this->client->getHttpClient() ?: new HttpClient();
}
/**
* Set the receipient(s)
* @param int|null $mobile
* @return $this
*/
public function to($mobile = null)
{
$this->getOptions()->to($mobile);
return $this;
}
/**
* Set the sender
* @param int|null $sender_id
* @return $this
*/
public function from($sender_id = null)
{
$this->getOptions()->from($sender_id);
return $this;
}
/**
* Set the content of message
* @param string|null $message
* @return $this
*/
public function message($message = '')
{
$this->getOptions()->message($message);
return $this;
}
/**
* Pass any other options to the message
* @param mixed $options
* @return $this;
*/
public function options($options = null)
{
$this->getOptions()->mergeWith($options);
return $this;
}
/**
* Create a new instance of given request
* @param string $request - Request class name
* @return \Craftsys\Msg91\Response
*/
protected function sendRequest(string $request)
{
return (new $request($this->getHttpClient(), $this->getOptions()))->handle();
}
}