-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e02933d
commit 197ad60
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php namespace Arcanedev\Support; | ||
|
||
use Illuminate\Support\Manager as IlluminateManager; | ||
use Illuminate\Support\Str; | ||
use InvalidArgumentException; | ||
|
||
/** | ||
* Class Manager | ||
* | ||
* @package Arcanedev\Support | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
abstract class Manager extends IlluminateManager | ||
{ | ||
/** | ||
* Create a new driver instance. | ||
* | ||
* @param string $driver | ||
* | ||
* @return mixed | ||
*/ | ||
protected function createDriver($driver) | ||
{ | ||
$method = 'create'.Str::studly($driver).'Driver'; | ||
|
||
// We'll check to see if a creator method exists for the given driver. If not we | ||
// will check for a custom driver creator, which allows developers to create | ||
// drivers using their own customized driver creator Closure to create it. | ||
if (isset($this->customCreators[$driver])) | ||
return $this->callCustomCreator($driver); | ||
elseif (method_exists($this, $method)) | ||
return $this->$method(); | ||
|
||
throw new InvalidArgumentException("Driver [$driver] not supported."); | ||
} | ||
} |