Completed
Push — develop ( 68a985...a1f82e )
by Adam
10s
created

Tone::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace IBM\Watson\ToneAnalyzer\Model;
4
5
use IBM\Watson\Common\Model\ApiResponseInterface;
6
7
class Tone implements ApiResponseInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $toneId;
13
14
    /**
15
     * @var string
16
     */
17
    private $name;
18
19
    /**
20
     * @var double
21
     */
22
    private $score;
23
24
    /**
25
     * Tone constructor.
26
     *
27
     * @param string $toneId
28
     * @param string $name
29
     * @param double $score
30
     */
31 6
    public function __construct($toneId, $name, $score)
32
    {
33 6
        $this->toneId = $toneId;
34 6
        $this->name = $name;
35 6
        $this->score = $score;
36 6
    }
37
38
    /**
39
     * Create tone
40
     *
41
     * @param array $data
42
     *
43
     * @return \IBM\Watson\ToneAnalyzer\Model\Tone
44
     */
45 6
    public static function create(array $data)
46
    {
47 6
        return new self($data['tone_id'], $data['tone_name'], $data['score']);
48
    }
49
50
    /**
51
     * Get tone id
52
     *
53
     * @return string
54
     */
55 3
    public function getId()
56
    {
57 3
        return $this->toneId;
58
    }
59
60
    /**
61
     * Get tone name
62
     *
63
     * @return string
64
     */
65 3
    public function getName()
66
    {
67 3
        return $this->name;
68
    }
69
70
    /**
71
     * Get tone score
72
     *
73
     * @return float
74
     */
75 3
    public function getScore()
76
    {
77 3
        return $this->score;
78
    }
79
}
80