Supplier   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 27
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace Graphp\Util;
4
5
/**
6
 * Class Supplier
7
 *
8
 * @package Graphp\Util
9
 */
10
class Supplier implements SupplierInterface
11
{
12
    /**
13
     * Name of the class, whose instance will be provided
14
     *
15
     * @var string
16
     */
17
    private $className;
18
19
    /**
20
     * Construct a new supplier
21
     *
22
     * @param string $className - the class name
23
     */
24 44
    public function __construct(string $className)
25
    {
26 44
        $this->className = $className;
27 44
    }
28
29
    /**
30
     * Get the specified class instance
31
     *
32
     * @return mixed
33
     */
34 32
    public function get()
35
    {
36 32
        return new $this->className();
37
    }
38
}
39