Skip to content

Commit

Permalink
Merge pull request #94 from zingimmick/improve-coding-standard-config
Browse files Browse the repository at this point in the history
Improve coding standard config
  • Loading branch information
kodiakhq[bot] authored Aug 21, 2020
2 parents 6ae8589 + b34151d commit 4231698
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
6 changes: 0 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\DeadCode\Rector\Function_\RemoveUnusedFunctionRector;
use Rector\PHPStan\Rector\Cast\RecastingRemovalRector;
use Rector\PHPUnit\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\Set\ValueObject\SetList;
use Rector\SOLID\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector;
use Rector\SOLID\Rector\Class_\FinalizeClassesWithoutChildrenRector;
use Rector\SOLID\Rector\Class_\RepeatedLiteralToClassConstantRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand All @@ -35,10 +32,7 @@
[
FinalizeClassesWithoutChildrenRector::class,
ChangeReadOnlyVariableWithDefaultValueToConstantRector::class,
RecastingRemovalRector::class,
RepeatedLiteralToClassConstantRector::class,
AddSeeTestAnnotationRector::class,
RemoveUnusedFunctionRector::class,
]
);
$parameters->set(
Expand Down
2 changes: 1 addition & 1 deletion src/Connectors/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function send($number, $message)
Event::dispatch(new SmsSending($number, $message));
Log::debug(sprintf('number: %s, message: "%s", template: "%s", data: %s, type: %s', $number, $message->getContent($this->driver), $message->getTemplate($this->driver), json_encode($message->getData($this->driver)), $message->getMessageType()));
$result = $this->driver->send($number, $message, $this->config);
Log::debug(sprintf('number: %s, message: "%s", template: "%s", data: %s, type: %s', $number, $message->getContent($this->driver), $message->getTemplate($this->driver), json_encode($message->getData($this->driver)), $message->getMessageType()), (array) $result);
Log::debug(sprintf('number: %s, message: "%s", template: "%s", data: %s, type: %s', $number, $message->getContent($this->driver), $message->getTemplate($this->driver), json_encode($message->getData($this->driver)), $message->getMessageType()), $result);
Event::dispatch(new SmsSent($number, $message, $result));

return $result;
Expand Down
12 changes: 7 additions & 5 deletions src/SmsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

class SmsServiceProvider extends ServiceProvider
{
private const SMS = 'sms';

public function boot(): void
{
if ($this->app->runningInConsole() && $this->app instanceof Laravel) {
Expand All @@ -34,20 +36,20 @@ public function register(): void
Notification::resolved(
function (ChannelManager $service): void {
$service->extend(
'sms',
self::SMS,
function (Container $app) {
return $app->make(SmsChannel::class);
}
);
}
);
$this->app->singleton(
'sms',
self::SMS,
function (Container $app) {
return $app->make(SmsManager::class);
}
);
$this->app->alias('sms', Sms::class);
$this->app->alias(self::SMS, Sms::class);
$this->registerCommands();
}

Expand All @@ -59,10 +61,10 @@ protected function getConfigPath(): string
protected function registerConfig(): void
{
if ($this->app instanceof Lumen) {
$this->app->configure('sms');
$this->app->configure(self::SMS);
}

$this->mergeConfigFrom($this->getConfigPath(), 'sms');
$this->mergeConfigFrom($this->getConfigPath(), self::SMS);
}

protected function registerCommands(): void
Expand Down
8 changes: 5 additions & 3 deletions tests/Laravel/LaravelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

abstract class LaravelTestCase extends TestCase
{
private const DRIVER = 'driver';

protected function getPackageProviders($app)
{
return [
Expand All @@ -33,13 +35,13 @@ protected function getEnvironmentSetUp($app): void
'default' => env('SMS_CONNECTION', 'log'),
'connections' => [
'log' => [
'driver' => LogGateway::class,
self::DRIVER => LogGateway::class,
],
'null' => [
'driver' => NullGateway::class,
self::DRIVER => NullGateway::class,
],
'yunpian' => [
'driver' => YunpianGateway::class,
self::DRIVER => YunpianGateway::class,
'api_key' => env('YUNPIAN_KEY'),
],
],
Expand Down
8 changes: 5 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

class TestCase extends BaseTestCase
{
private const DRIVER = 'driver';

public static function assertSameMessage($expected, $actual, string $message = ''): void
{
static::assertThat($actual, new IsEqual($expected), $message);
Expand All @@ -39,13 +41,13 @@ protected function getEnvironmentSetUp($app): void
'default' => env('SMS_CONNECTION', 'log'),
'connections' => [
'log' => [
'driver' => LogGateway::class,
self::DRIVER => LogGateway::class,
],
'null' => [
'driver' => NullGateway::class,
self::DRIVER => NullGateway::class,
],
'yunpian' => [
'driver' => YunpianGateway::class,
self::DRIVER => YunpianGateway::class,
'api_key' => env('YUNPIAN_KEY'),
],
],
Expand Down

0 comments on commit 4231698

Please sign in to comment.