Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit b0e9978

Browse files
Apply fixes from StyleCI (#5)
1 parent 42f2202 commit b0e9978

File tree

8 files changed

+31
-22
lines changed

8 files changed

+31
-22
lines changed

config/pubsub.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

33
return [
4-
54
/*
65
|--------------------------------------------------------------------------
76
| Default
@@ -50,7 +49,7 @@
5049
'kafka' => [
5150
'driver' => 'kafka',
5251
'consumer_group_id' => 'php-pubsub',
53-
'brokers' => env('KAFKA_BROKERS', 'localhost')
52+
'brokers' => env('KAFKA_BROKERS', 'localhost'),
5453
],
5554

5655
'gcloud' => [

phpunit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php
22

3-
include __DIR__ . '/vendor/autoload.php';
3+
include __DIR__ . '/vendor/autoload.php';

src/PubSubConnectionFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct(Container $container)
3131
*
3232
* @param string $driver
3333
* @param array $config
34+
*
3435
* @return PubSubAdapterInterface
3536
*/
3637
public function make($driver, array $config = [])
@@ -55,6 +56,7 @@ public function make($driver, array $config = [])
5556
* Factory a RedisPubSubAdapter.
5657
*
5758
* @param array $config
59+
*
5860
* @return RedisPubSubAdapter
5961
*/
6062
protected function makeRedisAdapter(array $config)
@@ -72,6 +74,7 @@ protected function makeRedisAdapter(array $config)
7274
* Factory a KafkaPubSubAdapter.
7375
*
7476
* @param array $config
77+
*
7578
* @return KafkaPubSubAdapter
7679
*/
7780
protected function makeKafkaAdapter(array $config)
@@ -100,6 +103,7 @@ protected function makeKafkaAdapter(array $config)
100103
* Factory a GoogleCloudPubSubAdapter.
101104
*
102105
* @param array $config
106+
*
103107
* @return GoogleCloudPubSubAdapter
104108
*/
105109
protected function makeGoogleCloudAdapter(array $config)

src/PubSubManager.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct(Application $app, PubSubConnectionFactory $factory)
4242
* Return a pub-sub adapter instance.
4343
*
4444
* @param string $name
45+
*
4546
* @return PubSubAdapterInterface
4647
*/
4748
public function connection($name = null)
@@ -61,6 +62,7 @@ public function connection($name = null)
6162
* Make an instance of a pub-sub adapter interface.
6263
*
6364
* @param string $name
65+
*
6466
* @return PubSubAdapterInterface
6567
*/
6668
protected function makeConnection($name)
@@ -84,6 +86,7 @@ protected function makeConnection($name)
8486
* Return the pubsub config for the given connection.
8587
*
8688
* @param string $name
89+
*
8790
* @return array
8891
*/
8992
protected function getConnectionConfig($name)
@@ -105,7 +108,7 @@ protected function getConnectionConfig($name)
105108
*/
106109
protected function getConfig()
107110
{
108-
$config = $this->app->make('config'); /** @var \Illuminate\Contracts\Config\Repository $config */
111+
$config = $this->app->make('config'); /* @var \Illuminate\Contracts\Config\Repository $config */
109112
return $config->get('pubsub');
110113
}
111114

@@ -126,7 +129,7 @@ public function getDefaultConnection()
126129
*/
127130
public function setDefaultConnection($name)
128131
{
129-
$config = $this->app->make('config'); /** @var \Illuminate\Contracts\Config\Repository $config */
132+
$config = $this->app->make('config'); /* @var \Illuminate\Contracts\Config\Repository $config */
130133
$config->set('pubsub.default', $name);
131134
}
132135

@@ -166,6 +169,7 @@ public function getConnections()
166169
*
167170
* @param string $method
168171
* @param array $parameters
172+
*
169173
* @return mixed
170174
*/
171175
public function __call($method, $parameters)

src/PubSubServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function register()
3737
$this->app->bind('pubsub.connection', PubSubAdapterInterface::class);
3838

3939
$this->app->bind(PubSubAdapterInterface::class, function ($app) {
40-
$manager = $app['pubsub']; /** @var PubSubManager $manager */
40+
$manager = $app['pubsub']; /* @var PubSubManager $manager */
4141
return $manager->connection();
4242
});
4343

src/SubscriberMakeCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Superbalist\LaravelPubSub;
44

55
use Illuminate\Console\GeneratorCommand;
6-
use Symfony\Component\Console\Input\InputOption;
76
use Symfony\Component\Console\Input\InputArgument;
7+
use Symfony\Component\Console\Input\InputOption;
88

99
class SubscriberMakeCommand extends GeneratorCommand
1010
{
@@ -34,6 +34,7 @@ class SubscriberMakeCommand extends GeneratorCommand
3434
*
3535
* @param string $stub
3636
* @param string $name
37+
*
3738
* @return string
3839
*/
3940
protected function replaceClass($stub, $name)
@@ -57,11 +58,12 @@ protected function getStub()
5758
* Get the default namespace for the class.
5859
*
5960
* @param string $rootNamespace
61+
*
6062
* @return string
6163
*/
6264
protected function getDefaultNamespace($rootNamespace)
6365
{
64-
return $rootNamespace.'\Console\Commands';
66+
return $rootNamespace . '\Console\Commands';
6567
}
6668

6769
/**
@@ -89,7 +91,7 @@ protected function getOptions()
8991
null,
9092
InputOption::VALUE_OPTIONAL,
9193
'The terminal command that should be assigned.',
92-
'subscriber:name'
94+
'subscriber:name',
9395
],
9496
];
9597
}

tests/PubSubConnectionFactoryTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testMakeRedisAdapter()
5151
$container->shouldReceive('make')
5252
->withArgs([
5353
'pubsub.redis.redis_client',
54-
['config' => $config]
54+
['config' => $config],
5555
])
5656
->once()
5757
->andReturn(Mockery::mock(RedisClient::class));
@@ -97,25 +97,25 @@ public function testMakeKafkaAdapter()
9797
$conf->shouldReceive('set')
9898
->withArgs([
9999
'metadata.broker.list',
100-
'localhost'
100+
'localhost',
101101
])
102102
->once();
103103
$conf->shouldReceive('set')
104104
->withArgs([
105105
'group.id',
106-
'php-pubsub'
106+
'php-pubsub',
107107
])
108108
->once();
109109
$conf->shouldReceive('set')
110110
->withArgs([
111111
'enable.auto.commit',
112-
'false'
112+
'false',
113113
])
114114
->once();
115115
$conf->shouldReceive('set')
116116
->withArgs([
117117
'offset.store.method',
118-
'broker'
118+
'broker',
119119
])
120120
->once();
121121
$conf->shouldReceive('setDefaultTopicConf')
@@ -132,7 +132,7 @@ public function testMakeKafkaAdapter()
132132
$container->shouldReceive('make')
133133
->withArgs([
134134
'pubsub.kafka.consumer',
135-
['conf' => $conf]
135+
['conf' => $conf],
136136
])
137137
->once()
138138
->andReturn($consumer);
@@ -153,8 +153,8 @@ public function testMakeGoogleCloudAdapter()
153153
'config' => [
154154
'projectId' => 12345,
155155
'keyFilePath' => 'my_key_file.json',
156-
]
157-
]
156+
],
157+
],
158158
])
159159
->andReturn(Mockery::mock(GoogleCloudPubSubClient::class));
160160

@@ -169,7 +169,7 @@ public function testMakeGoogleCloudAdapter()
169169
$adapter = $factory->make('gcloud', $config);
170170
$this->assertInstanceOf(GoogleCloudPubSubAdapter::class, $adapter);
171171

172-
$adapter = $factory->make('gcloud', $config); /** @var GoogleCloudPubSubAdapter $adapter */
172+
$adapter = $factory->make('gcloud', $config); /* @var GoogleCloudPubSubAdapter $adapter */
173173
$this->assertInstanceOf(GoogleCloudPubSubAdapter::class, $adapter);
174174
$this->assertEquals('blah', $adapter->getClientIdentifier());
175175
$this->assertFalse($adapter->areTopicsAutoCreated());

tests/PubSubManagerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testConnectionWithNullNameReturnsDefaultConnection()
3131
$factory->shouldReceive('make')
3232
->withArgs([
3333
'/dev/null',
34-
[]
34+
[],
3535
])
3636
->once()
3737
->andReturn(PubSubAdapterInterface::class);
@@ -114,7 +114,7 @@ public function testConnectionWithNameReturnsSpecifiedConnection()
114114
[
115115
'consumer_group_id' => 'php-pubsub',
116116
'brokers' => 'localhost',
117-
]
117+
],
118118
])
119119
->once()
120120
->andReturn(PubSubAdapterInterface::class);
@@ -148,7 +148,7 @@ public function testConnectionWithExistingConnectionReturnsThatConnection()
148148
$factory->shouldReceive('make')
149149
->withArgs([
150150
'/dev/null',
151-
[]
151+
[],
152152
])
153153
->once()
154154
->andReturn($adapter);
@@ -228,7 +228,7 @@ public function testSetDefaultConnection()
228228
$config->shouldReceive('set')
229229
->withArgs([
230230
'pubsub.default',
231-
'/dev/null'
231+
'/dev/null',
232232
])
233233
->once();
234234

0 commit comments

Comments
 (0)