1 | <?php |
||
17 | class AnalyzeToneRequest extends AbstractRequest |
||
18 | { |
||
19 | /** |
||
20 | * Tone analyzer API url |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $endpoint = 'https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone'; |
||
25 | |||
26 | /** |
||
27 | * Get API endpoint |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | public function getEndpoint() |
||
35 | |||
36 | /** |
||
37 | * Get data to be sent with the request |
||
38 | * |
||
39 | * @return array required request data |
||
40 | */ |
||
41 | public function getData() |
||
50 | |||
51 | /** |
||
52 | * Send request with data |
||
53 | * |
||
54 | * @param mixed $data |
||
55 | * @throws AuthException |
||
56 | * @throws \Exception |
||
57 | * |
||
58 | * @return \IBM\Watson\Service\ToneAnalyzer\Message\AnalyzeToneResponse |
||
59 | */ |
||
60 | public function sendData($data) |
||
90 | |||
91 | /** |
||
92 | * Set API version |
||
93 | * |
||
94 | * @param $value |
||
95 | * @return AbstractRequest |
||
96 | */ |
||
97 | public function setVersion($value) |
||
101 | |||
102 | /** |
||
103 | * Set API version |
||
104 | * |
||
105 | * @return mixed |
||
106 | */ |
||
107 | public function getVersion() |
||
111 | |||
112 | /** |
||
113 | * Set text to analyze |
||
114 | * |
||
115 | * @param $value |
||
116 | * @return AbstractRequest |
||
117 | */ |
||
118 | public function setText($value) |
||
122 | |||
123 | /** |
||
124 | * Get text to analyze |
||
125 | * |
||
126 | * @return mixed |
||
127 | */ |
||
128 | public function getText() |
||
132 | } |
||
133 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.