ladybirdweb /
laravel-importer
| 1 | <?php |
||
| 2 | |||
| 3 | namespace LWS\Import; |
||
| 4 | |||
| 5 | class Factory |
||
| 6 | { |
||
| 7 | public function __construct() |
||
| 8 | { |
||
| 9 | $this->namespace = config('import.namespace'); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 10 | } |
||
| 11 | |||
| 12 | public function make($source) |
||
| 13 | { |
||
| 14 | $source = ucfirst(strtolower($source)); |
||
| 15 | $name = $this->namespace.'\\'.$source; |
||
| 16 | |||
| 17 | if (class_exists($name)) { |
||
| 18 | return new $name(); |
||
| 19 | } |
||
| 20 | } |
||
| 21 | } |
||
| 22 |