Completed
Push — develop ( 9b1d71...66130e )
by Adam
03:07 queued 01:21
created

Utterance   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 58
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 4 1
A getText() 0 4 1
A getUser() 0 4 1
1
<?php
2
3
namespace IBM\Watson\ToneAnalyzer\Model;
4
5
use IBM\Watson\Common\Model\CreateableFromArray;
6
7
/**
8
 * Class Utterance
9
 */
10
class Utterance implements CreateableFromArray
11
{
12
    /**
13
     * @var string
14
     */
15
    const KEY_TEXT = 'text';
16
17
    /**
18
     * @var string
19
     */
20
    const KEY_USER = 'user';
21
22
    /**
23
     * @var string
24
     */
25
    private $text;
26
27
    /**
28
     * @var string
29
     */
30
    private $user;
31
32
    /**
33
     * @param string $text
34
     * @param string $user
35
     */
36
    public function __construct($text, $user)
37
    {
38
        $this->text = $text;
39
        $this->user = $user;
40
    }
41
42
    /**
43
     * @param array $data
44
     *
45
     * @return \IBM\Watson\ToneAnalyzer\Model\Engagement\Utterance
46
     */
47
    public static function create(array $data)
48
    {
49
        return new self($data[static::KEY_TEXT], $data[static::KEY_USER]);
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getText()
56
    {
57
        return $this->text;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getUser()
64
    {
65
        return $this->user;
66
    }
67
}
68