Supplier::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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