Issues (6)

src/Factory.php (1 issue)

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
The property namespace does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
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