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

Commit 40aa953

Browse files
fix laravel 4 package config references
1 parent 7733190 commit 40aa953

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"php": ">=5.6.0",
1313
"superbalist/php-event-pubsub": "^1.0",
1414
"superbalist/laravel4-pubsub": "^2.0",
15-
"illuminate/support": "^4.0"
15+
"illuminate/support": "^4.0",
16+
"illuminate/config": "^4.0"
1617
},
1718
"autoload": {
1819
"psr-4": {

src/PubSubEventsServiceProvider.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ public function register()
4040
// we'll use the connection name configured in the 'default' config setting from the 'pubsub_events'
4141
// config
4242
// if this value isn't set, we'll default to that from the 'pubsub' package config
43-
$config = $app['config']['pubsub_events'];
43+
$config = $this->getConfig();
4444
$manager = $app['pubsub']; /** @var PubSubManager $manager */
4545
return $manager->connection($config['default']);
4646
});
4747

4848
$this->app->bind('pubsub.events.translator', MessageTranslatorInterface::class);
4949

5050
$this->app->bind(MessageTranslatorInterface::class, function ($app) {
51-
$config = $app['config']['pubsub_events'];
51+
$config = $this->getConfig();
5252
$binding = $config['translator'];
5353
return $app[$binding];
5454
});
5555

5656
$this->app->bind('pubsub.events.validator', EventValidatorInterface::class);
5757

5858
$this->app->bind(EventValidatorInterface::class, function ($app) {
59-
$config = $app['config']['pubsub_events'];
59+
$config = $this->getConfig();
6060
$binding = $config['validator'];
6161
// a validator is optional
6262
// if nothing is set, we don't try resolve it
@@ -98,7 +98,7 @@ protected function registerTranslators()
9898
protected function registerValidators()
9999
{
100100
$this->app->singleton('pubsub.events.validators.json_schema.loaders.array.schemas', function ($app) {
101-
$config = $app['config']['pubsub_events'];
101+
$config = $this->getConfig();
102102
$schemas = $config['validators']['json_schema']['loaders']['array']['schemas'];
103103
return collect($schemas);
104104
});
@@ -116,7 +116,7 @@ protected function registerValidators()
116116
$this->app->bind('pubsub.events.validators.json_schema.dereferencer', function ($app) {
117117
$dereferencer = new Dereferencer();
118118

119-
$config = $app['config']['pubsub_events'];
119+
$config = $this->getConfig();
120120

121121
foreach ($config['validators']['json_schema']['loaders'] as $name => $params) {
122122
$name = array_get($params, 'binding', $name);
@@ -133,6 +133,15 @@ protected function registerValidators()
133133
});
134134
}
135135

136+
/**
137+
* @return array
138+
*/
139+
protected function getConfig()
140+
{
141+
$config = $this->app->make('config'); /** @var \Illuminate\Config\Repository $config */
142+
return $config->get('laravel4-event-pubsub::config');
143+
}
144+
136145
/**
137146
* Get the services provided by the provider.
138147
*

0 commit comments

Comments
 (0)