Completed
Push — master ( 11f4d7...02dbf7 )
by Todd
01:44
created

DefaultReference::setClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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 15
    public function __construct($class) {
26 15
        $this->setClass($class);
27 15
    }
28
29
    /**
30
     * Get the name of the reference.
31
     *
32
     * @return string Returns the name of the reference.
33
     */
34 5
    public function getClass() {
35 5
        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 15
    public function setClass($class) {
44 15
        $this->class = $class;
45 15
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 7
    public function resolve(Container $container, $_ = null) {
0 ignored issues
show
Coding Style Naming introduced by
The parameter $_ is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
51 7
        return $container->get($this->class);
52
    }
53
}
54