/** * Treat the "menu keys list" option. * * @param mixed $menuKeysList * @return void * @throws Exception */ protected function _treatMenuKeysListOption($menuKeysList = null) { if (null === $menuKeysList) { throw new Exception(sprintf('Required option "%s" not provided', self::OPT_MENU_KEYS_LIST)); } if (!is_array($menuKeysList)) { throw new Exception(sprintf('Invalid value provided for "%s" option', self::OPT_MENU_KEYS_LIST)); } $menuKeysList = array_map('strval', $menuKeysList); $intersection = array_intersect($menuKeysList, Streamwide_Engine_Dtmf_Handler::getAllDtmfsList()); if (count($intersection) !== count($menuKeysList)) { throw new Exception(sprintf('Invalid keys provided in the keys list for "%s" option', self::OPT_MENU_KEYS_LIST)); } $this->_options[self::OPT_MENU_KEYS_LIST] = $menuKeysList; }
/** * Treat the "end reading key" option. This option represents the key that will stop the reading process. * This option doesn't have to be provided (OPTIONAL). If not provided it defaults to the "#" (pound) key. * Must be provided as a string of length equal to 1 and must be a valid key on the dial pad of a phone. * An invalid value or datatype will cause the default value to be used. * * @param mixed $endReadingKey * @return string */ protected function _treatEndReadingKeyOption($endReadingKey = null) { if (null === $endReadingKey) { // exit and use the default value return null; } $valid = is_string($endReadingKey) && strlen($endReadingKey) === 1 && in_array($endReadingKey, Streamwide_Engine_Dtmf_Handler::getAllDtmfsList()); if ($valid) { $this->_options[self::OPT_END_READING_KEY] = $endReadingKey; } else { trigger_error(sprintf('Option "%s" was provided with an invalid value. Using default value', self::OPT_END_READING_KEY)); } }