|
1
|
|
|
<?php namespace Arcanedev\Support; |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Contracts\Foundation\Application; |
|
4
|
|
|
use Illuminate\Support\Manager as IlluminateManager; |
|
5
|
|
|
use Illuminate\Support\Str; |
|
6
|
|
|
use InvalidArgumentException; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class Manager |
|
10
|
|
|
* |
|
11
|
|
|
* @package Arcanedev\Support |
|
12
|
|
|
* @author ARCANEDEV <[email protected]> |
|
13
|
|
|
*/ |
|
14
|
|
|
abstract class Manager extends IlluminateManager |
|
15
|
|
|
{ |
|
16
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
17
|
|
|
| Constructor |
|
18
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
19
|
|
|
*/ |
|
20
|
|
|
/** |
|
21
|
|
|
* Manager constructor. |
|
22
|
|
|
* |
|
23
|
|
|
* @param \Illuminate\Contracts\Foundation\Application $app |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct(Application $app) |
|
26
|
|
|
{ |
|
27
|
|
|
parent::__construct($app); |
|
|
|
|
|
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
31
|
|
|
| Main Functions |
|
32
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
33
|
|
|
*/ |
|
34
|
|
|
/** |
|
35
|
|
|
* Create a new driver instance. |
|
36
|
|
|
* |
|
37
|
|
|
* @param string $driver |
|
38
|
|
|
* |
|
39
|
|
|
* @return mixed |
|
40
|
|
|
*/ |
|
41
|
|
|
protected function createDriver($driver) |
|
42
|
|
|
{ |
|
43
|
|
|
$method = 'create'.Str::studly($driver).'Driver'; |
|
44
|
|
|
|
|
45
|
|
|
// We'll check to see if a creator method exists for the given driver. If not we |
|
46
|
|
|
// will check for a custom driver creator, which allows developers to create |
|
47
|
|
|
// drivers using their own customized driver creator Closure to create it. |
|
48
|
|
|
if (isset($this->customCreators[$driver])) |
|
49
|
|
|
return $this->callCustomCreator($driver); |
|
50
|
|
|
elseif (method_exists($this, $method)) |
|
51
|
|
|
return $this->$method(); |
|
52
|
|
|
|
|
53
|
|
|
throw new InvalidArgumentException("Driver [$driver] not supported."); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: