AnalyzeToneResponse::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
/**
3
 * Analyze Tone Response
4
 */
5
namespace IBM\Watson\Service\ToneAnalyzer\Message;
6
7
use IBM\Watson\Common\Message\RequestInterface;
8
use IBM\Watson\Common\Message\Response;
9
10
/**
11
 * Analyze Tone Response
12
 *
13
 * @see \IBM\Watson\Common\Message\Response
14
 */
15
class AnalyzeToneResponse extends Response
16
{
17
    /**
18
     * Document level analysis from text
19
     *
20
     * @var array
21
     */
22
    protected $documentTones;
23
24
    /**
25
     * Sentence level analysis from text
26
     *
27
     * @var array
28
     */
29
    protected $sentenceTones;
30
31
    /**
32
     * Build response
33
     *
34
     * @param RequestInterface $request
35
     * @param mixed $data
36
     */
37
    public function __construct(RequestInterface $request, $data)
38
    {
39
        parent::__construct($request, $data);
40
41
        $this->documentTones = $this->data->document_tone;
42
        $this->sentenceTones = $this->data->sentences_tone;
43
    }
44
45
    /**
46
     * Get document level analysis
47
     *
48
     * @return array
49
     */
50
    public function getDocumentTones()
51
    {
52
        return $this->documentTones;
53
    }
54
55
    /**
56
     * Get sentence level analysis
57
     *
58
     * @return array
59
     */
60
    public function getSentenceTones()
61
    {
62
        return $this->sentenceTones;
63
    }
64
}
65