Factory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
wmc 3
eloc 6
c 2
b 2
f 0
dl 0
loc 14
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A make() 0 7 2
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