Result::has()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
}