DefaultReference   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 38
ccs 10
cts 10
cp 1
rs 10
wmc 4

4 Methods

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