Skip to content

Commit

Permalink
Improved service provider
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Jan 30, 2016
1 parent 7c75b14 commit 1e1b777
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 3.2.2 (released 2016-01-30)

- Improved service provider

## 3.2.1 (released 2016-01-17)

- Lumen 5.2 support
Expand Down
32 changes: 13 additions & 19 deletions src/VimeoServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Vinkla\Vimeo;

use Illuminate\Contracts\Container\Container as Application;
use Illuminate\Contracts\Container\Container;
use Illuminate\Foundation\Application as LaravelApplication;
use Illuminate\Support\ServiceProvider;
use Laravel\Lumen\Application as LumenApplication;
Expand Down Expand Up @@ -59,62 +59,56 @@ protected function setupConfig()
*/
public function register()
{
$this->registerFactory($this->app);
$this->registerManager($this->app);
$this->registerBindings($this->app);
$this->registerFactory();
$this->registerManager();
$this->registerBindings();
}

/**
* Register the factory class.
*
* @param \Illuminate\Contracts\Container\Container $app
*
* @return void
*/
protected function registerFactory(Application $app)
protected function registerFactory()
{
$app->singleton('vimeo.factory', function () {
$this->app->singleton('vimeo.factory', function () {
return new VimeoFactory();
});

$app->alias('vimeo.factory', VimeoFactory::class);
$this->app->alias('vimeo.factory', VimeoFactory::class);
}

/**
* Register the manager class.
*
* @param \Illuminate\Contracts\Container\Container $app
*
* @return void
*/
protected function registerManager(Application $app)
protected function registerManager()
{
$app->singleton('vimeo', function ($app) {
$this->app->singleton('vimeo', function (Container $app) {
$config = $app['config'];
$factory = $app['vimeo.factory'];

return new VimeoManager($config, $factory);
});

$app->alias('vimeo', VimeoManager::class);
$this->app->alias('vimeo', VimeoManager::class);
}

/**
* Register the bindings.
*
* @param \Illuminate\Contracts\Container\Container $app
*
* @return void
*/
protected function registerBindings(Application $app)
protected function registerBindings()
{
$app->bind('vimeo.connection', function ($app) {
$this->app->bind('vimeo.connection', function (Container $app) {
$manager = $app['vimeo'];

return $manager->connection();
});

$app->alias('vimeo.connection', Vimeo::class);
$this->app->alias('vimeo.connection', Vimeo::class);
}

/**
Expand Down

0 comments on commit 1e1b777

Please sign in to comment.