| 1 | <?php |
||
| 10 | class UtteranceAnalysis implements CreateableFromArray |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | const KEY_ID = 'utterance_id'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | const KEY_TEXT = 'utterance_text'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | const KEY_TONES = 'tones'; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | const KEY_ERROR = 'error'; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var integer |
||
| 34 | */ |
||
| 35 | private $id; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var string |
||
| 39 | */ |
||
| 40 | private $text; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var array |
||
| 44 | */ |
||
| 45 | private $tones; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var null|string |
||
| 49 | */ |
||
| 50 | private $error; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param integer $id |
||
| 54 | * @param string $text |
||
| 55 | * @param array $tones |
||
| 56 | * @param null|string $error |
||
| 57 | */ |
||
| 58 | public function __construct($id, $text, array $tones, $error = null) |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param array $data |
||
| 68 | * |
||
| 69 | * @return \IBM\Watson\ToneAnalyzer\Model\UtteranceAnalysis |
||
| 70 | */ |
||
| 71 | public static function create(array $data) |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return integer |
||
| 88 | */ |
||
| 89 | public function getId() |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @return string |
||
| 96 | */ |
||
| 97 | public function getText() |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @return array |
||
| 104 | */ |
||
| 105 | public function getTones() |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @return null|string |
||
| 112 | */ |
||
| 113 | public function getError() |
||
| 117 | } |
||
| 118 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.