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

DefaultReference   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0

4 Methods

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