Completed
Pull Request — master (#3)
by Todd
01:29
created

DefaultReference   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 81.82%

Importance

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

4 Methods

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