Result   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 38
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A push() 0 3 1
A has() 0 3 1
A get() 0 3 2
A all() 0 3 1
1
<?php
2
3
/*
4
* (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
*
6
* For the full copyright and license information, please view the LICENSE
7
* file that was distributed with this source code.
8
*/
9
10
namespace Hal\Application\Score;
11
12
use Hal\Component\Score\ScoreInterface;
13
14
/**
15
 * Score
16
 *
17
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
18
 */
19
class Result implements ScoreInterface{
20
21
    /**
22
     * @var array
23
     */
24
    private $scores = array();
25
26
    /**
27
     * @param $name
28
     * @param $score
29
     */
30
    public function push($name, $score) {
31
        $this->scores[$name] = $score;
32
    }
33
34
    /**
35
     * @param $name
36
     * @return bool
37
     */
38
    public function has($name) {
39
        return isset($this->scores[$name]);
40
    }
41
42
    /**
43
     * @param $name
44
     * @return float|null
45
     */
46
    public function get($name) {
47
        return $this->has($name) ? $this->scores[$name] : null;
48
    }
49
50
    /**
51
     * @return array
52
     */
53
    public function all() {
54
        return $this->scores;
55
    }
56
}