DefaultReference::setClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
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 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Todd Burry <[email protected]>
4
 * @copyright 2009-2017 Vanilla Forums Inc.
5
 * @license MIT
6
 * @internal
7
 */
8
9
namespace Garden\Container;
10
11
/**
12
 * Used internally.
13
 */
14
class DefaultReference implements ReferenceInterface {
15
    /**
16
     * @var string
17
     */
18
    protected $class;
19
20
    /**
21
     * Construct a new instance of the {@link Reference} class.
22
     *
23
     * @param string $class The name of the reference.
24
     */
25 25
    public function __construct($class) {
26 25
        $this->setClass($class);
27 25
    }
28
29
    /**
30
     * Get the name of the reference.
31
     *
32
     * @return string Returns the name of the reference.
33
     */
34 10
    public function getClass() {
35 10
        return $this->class;
36
    }
37
38
    /**
39
     * Set the name of the reference.
40
     *
41
     * @param string $class The name of the reference.
42
     */
43 25
    public function setClass($class) {
44 25
        $this->class = $class;
45 25
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 15
    public function resolve(Container $container, $_ = null) {
51 15
        return $container->get($this->class);
52
    }
53
}
54