Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

Commit

Permalink
Change
Browse files Browse the repository at this point in the history
  • Loading branch information
arif98741 committed Jan 18, 2022
1 parent afc8116 commit 614aa8b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
Empty file added changelog.md
Empty file.
26 changes: 13 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ service provider.

<pre>
use Xenon\MultiCourier\Provider\ECourier;
use Xenon\MultiCourier\Sender;


$sender = Sender::getInstance();
$sender->setProvider(ECourier::class,'production');
$sender->setConfig([
'API-KEY' => 'XXX',
'API-SECRET' => 'XXX',
'USER-ID' => 'XXXX',
]);
$sender->setRequestEndpoint('packages', ['city' => 'Tangail']);
$response = $sender->send();
echo $response->getData();
use Xenon\MultiCourier\Courier;


$courier = Courier::getInstance();
$courier->setProvider(ECourier::class,'production');
$courier->setConfig([
'API-KEY' => 'XXX',
'API-SECRET' => 'XXX',
'USER-ID' => 'XXXX',
]);
$courier->setRequestEndpoint('packages', ['city' => 'Tangail']);
$response = $courier->send();
echo $response->getData();
</pre>


Expand Down
18 changes: 9 additions & 9 deletions src/Sender.php → src/Courier.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Xenon\MultiCourier\Handler\RequestException;
use Xenon\MultiCourier\Provider\AbstractProvider;

class Sender
class Courier
{
/**
* @var AbstractProvider
Expand Down Expand Up @@ -81,10 +81,10 @@ public function setMethod($method): void
* This implementation lets you subclass the Singleton class while keeping
* just one instance of each subclass around.
*/
public static function getInstance(): Sender
public static function getInstance(): Courier
{
if (!isset(self::$instance)) {
self::$instance = new Sender();
self::$instance = new Courier();
}

return self::$instance;
Expand All @@ -100,11 +100,11 @@ public function getConfig()

/**
* @param mixed $config
* @return Sender
* @return Courier
* @throws Exception
* @since v1.0.0
*/
public function setConfig($config): Sender
public function setConfig($config): Courier
{
$this->config = $config;
return $this;
Expand Down Expand Up @@ -183,10 +183,10 @@ public function getMessage()

/**
* @param mixed $message
* @return Sender
* @return Courier
* @since v1.0.0
*/
public function setMessage($message = ''): Sender
public function setMessage($message = ''): Courier
{

$this->message = $message;
Expand All @@ -206,11 +206,11 @@ public function getProvider()
* Return this class object
* @param $ProviderClass
* @param string|null $environment
* @return Sender
* @return Courier
* @throws RenderException
* @since v1.0.0
*/
public function setProvider($ProviderClass, string $environment = null): Sender
public function setProvider($ProviderClass, string $environment = null): Courier
{

try {
Expand Down
2 changes: 1 addition & 1 deletion src/MultiCourierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function register()

$provider = config('sms.default_provider');

$sender = Sender::getInstance();
$sender = Courier::getInstance();
$sender->setProvider($provider);
$sender->setConfig(config('sms.providers')[$provider]);
return new SMS($sender);
Expand Down
6 changes: 3 additions & 3 deletions src/Provider/ECourier.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Xenon\MultiCourier\Handler\RenderException;
use Xenon\MultiCourier\Handler\RequestException;
use Xenon\MultiCourier\Request;
use Xenon\MultiCourier\Sender;
use Xenon\MultiCourier\Courier;

class ECourier extends AbstractProvider
{
Expand All @@ -31,10 +31,10 @@ class ECourier extends AbstractProvider

/**
* ECourier constructor.
* @param Sender $sender
* @param Courier $sender
* @param string $environment
*/
public function __construct(Sender $sender, string $environment = 'local')
public function __construct(Courier $sender, string $environment = 'local')
{
$this->senderObject = $sender;

Expand Down
6 changes: 3 additions & 3 deletions src/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

class SMS
{
/** @var Sender */
/** @var Courier */
private $sender;

/**
* @param Sender $sender
* @param Courier $sender
* @version v1.0.32
* @since v1.0.31
*/
public function __construct(Sender $sender)
public function __construct(Courier $sender)
{
$this->sender = $sender;
}
Expand Down

0 comments on commit 614aa8b

Please sign in to comment.