Skip to content

Commit

Permalink
feat(message): remove the unused message class
Browse files Browse the repository at this point in the history
  • Loading branch information
sudkumar committed Sep 29, 2020
1 parent 4ce6280 commit 4446f5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
17 changes: 0 additions & 17 deletions src/Msg91Message.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/OTP/OTPService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class OTPService extends Service
/**
* Create a new service instance
* @param \Craftsys\Msg91\Client $client
* @param int|string|\Craftsys\Msg91\OTP\Options|\Craftsys\Msg91\Msg91Message $payload
* @param int|string|\Craftsys\Msg91\Contracts\Options $payload
* @return void
*/
public function __construct(Client $client, $payload = null)
Expand Down
13 changes: 11 additions & 2 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Closure;
use Craftsys\Msg91\Contracts\Options as ContractsOptions;
use JsonSerializable;

abstract class Options implements ContractsOptions
abstract class Options implements ContractsOptions, JsonSerializable
{
/**
* Payload for the message
Expand Down Expand Up @@ -181,7 +182,6 @@ public function mergeWith($options = null)
$current_payload = $this->getPayload();
switch (true) {
case $options instanceof self:
case $options instanceof Msg91Message:
$this->payload = array_merge($current_payload, $options->getPayload());
break;
case is_array($options):
Expand All @@ -207,4 +207,13 @@ public function resolveConfig(Config $config)
{
$this->mergeWith($config->all());
}

/**
* Convert options to json
* @return array
*/
public function jsonSerialize()
{
return $this->toArray();
}
}
2 changes: 1 addition & 1 deletion src/SMS/SMSService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SMSService extends Service
/**
* Create a new service instance
* @param \Craftsys\Msg91\Client $client
* @param int|string|\Craftsys\Msg91\SMS\Options|\Craftsys\Msg91\Msg91Message $payload
* @param int|string|\Craftsys\Msg91\Contracts\Options $payload
* @return void
*/
public function __construct(Client $client, $payload = null)
Expand Down

0 comments on commit 4446f5a

Please sign in to comment.