Skip to content

Commit 21a8311

Browse files
committed
Improved service provider
1 parent 72a0b2e commit 21a8311

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.2.2 (released 2016-01-30)
4+
5+
- Improved service provider
6+
37
## 2.2.1 (released 2016-01-17)
48

59
- Lumen 5.2 support

src/PusherServiceProvider.php

+13-19
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Vinkla\Pusher;
1313

14-
use Illuminate\Contracts\Container\Container as Application;
14+
use Illuminate\Contracts\Container\Container;
1515
use Illuminate\Foundation\Application as LaravelApplication;
1616
use Illuminate\Support\ServiceProvider;
1717
use Laravel\Lumen\Application as LumenApplication;
@@ -59,62 +59,56 @@ protected function setupConfig()
5959
*/
6060
public function register()
6161
{
62-
$this->registerFactory($this->app);
63-
$this->registerManager($this->app);
64-
$this->registerBindings($this->app);
62+
$this->registerFactory();
63+
$this->registerManager();
64+
$this->registerBindings();
6565
}
6666

6767
/**
6868
* Register the factory class.
6969
*
70-
* @param \Illuminate\Contracts\Container\Container $app
71-
*
7270
* @return void
7371
*/
74-
protected function registerFactory(Application $app)
72+
protected function registerFactory()
7573
{
76-
$app->singleton('pusher.factory', function () {
74+
$this->app->singleton('pusher.factory', function () {
7775
return new PusherFactory();
7876
});
7977

80-
$app->alias('pusher.factory', PusherFactory::class);
78+
$this->app->alias('pusher.factory', PusherFactory::class);
8179
}
8280

8381
/**
8482
* Register the manager class.
8583
*
86-
* @param \Illuminate\Contracts\Container\Container $app
87-
*
8884
* @return void
8985
*/
90-
protected function registerManager(Application $app)
86+
protected function registerManager()
9187
{
92-
$app->singleton('pusher', function ($app) {
88+
$this->app->singleton('pusher', function (Container $app) {
9389
$config = $app['config'];
9490
$factory = $app['pusher.factory'];
9591

9692
return new PusherManager($config, $factory);
9793
});
9894

99-
$app->alias('pusher', PusherManager::class);
95+
$this->app->alias('pusher', PusherManager::class);
10096
}
10197

10298
/**
10399
* Register the bindings.
104100
*
105-
* @param \Illuminate\Contracts\Container\Container $app
106-
*
107101
* @return void
108102
*/
109-
protected function registerBindings(Application $app)
103+
protected function registerBindings()
110104
{
111-
$app->bind('pusher.connection', function ($app) {
105+
$this->app->bind('pusher.connection', function (Container $app) {
112106
$manager = $app['pusher'];
113107

114108
return $manager->connection();
115109
});
116110

117-
$app->alias('pusher.connection', Pusher::class);
111+
$this->app->alias('pusher.connection', Pusher::class);
118112
}
119113

120114
/**

0 commit comments

Comments
 (0)