Skip to content

Commit

Permalink
Fixed #167
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Mar 25, 2019
1 parent b57b9fa commit b1d1815
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/EasySms.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ protected function makeGateway($gateway, $config)
*/
protected function formatGatewayClassName($name)
{
if (\class_exists($name) && \in_array(GatewayInterface::class, \class_implements($name))) {
return $name;
}

$name = \ucfirst(\str_replace(['-', '_', ''], '', $name));

return __NAMESPACE__."\\Gateways\\{$name}Gateway";
Expand Down
2 changes: 1 addition & 1 deletion tests/EasySmsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testGatewayWithDefaultSetting()
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
sprintf(
'Class "%s" is a invalid easy-sms gateway.',
'Class "Overtrue\EasySms\Gateways\%sGateway" is a invalid easy-sms gateway.',
DummyInvalidGatewayForTest::class
)
);
Expand Down

0 comments on commit b1d1815

Please sign in to comment.