Skip to content

Commit

Permalink
Move common method for a CapsuleManager to trait, this would reduce t…
Browse files Browse the repository at this point in the history
…he requirement to produce new CapsuleManager for other component in the future (e.g: laravel/framework#5032)

Also remove duplicate "require-dev" component (when already explicitly declare in "require").

Signed-off-by: crynobone <[email protected]>
  • Loading branch information
crynobone committed Jul 21, 2014
1 parent e5788d5 commit 8da6b3f
Showing 1 changed file with 2 additions and 54 deletions.
56 changes: 2 additions & 54 deletions Capsule/Manager.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<?php namespace Illuminate\Queue\Capsule;

use Illuminate\Support\Fluent;
use Illuminate\Queue\QueueManager;
use Illuminate\Container\Container;
use Illuminate\Queue\QueueServiceProvider;
use Illuminate\Support\Traits\CapsuleManagerTrait;

class Manager {

/**
* The current globally used instance.
*
* @var \Illuminate\Queue\Capsule\Manager
*/
protected static $instance;
use CapsuleManagerTrait;

/**
* The queue manager instance.
Expand Down Expand Up @@ -41,22 +36,6 @@ public function __construct(Container $container = null)
$this->registerConnectors();
}

/**
* Setup the IoC container instance.
*
* @param \Illuminate\Container\Container $container
* @return void
*/
protected function setupContainer($container)
{
$this->container = $container ?: new Container;

if ( ! $this->container->bound('config'))
{
$this->container->instance('config', new Fluent);
}
}

/**
* Setup the default queue configuration options.
*
Expand Down Expand Up @@ -166,16 +145,6 @@ public function addConnection(array $config, $name = 'default')
$this->container['config']["queue.connections.{$name}"] = $config;
}

/**
* Make this capsule instance available globally.
*
* @return void
*/
public function setAsGlobal()
{
static::$instance = $this;
}

/**
* Get the queue manager instance.
*
Expand All @@ -186,27 +155,6 @@ public function getQueueManager()
return $this->manager;
}

/**
* Get the IoC container instance.
*
* @return \Illuminate\Container\Container
*/
public function getContainer()
{
return $this->container;
}

/**
* Set the IoC container instance.
*
* @param \Illuminate\Container\Container $container
* @return void
*/
public function setContainer(Container $container)
{
$this->container = $container;
}

/**
* Pass dynamic instance methods to the manager.
*
Expand Down

0 comments on commit 8da6b3f

Please sign in to comment.