本文整理汇总了PHP中Zend_Validate_Between::setMin方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_Between::setMin方法的具体用法?PHP Zend_Validate_Between::setMin怎么用?PHP Zend_Validate_Between::setMin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Validate_Between
的用法示例。
在下文中一共展示了Zend_Validate_Between::setMin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validateWebSearch
/**
* Validate Web Search Options
*
* @param array $options
* @return void
* @throws Zend_Service_Exception
*/
protected function _validateWebSearch(array $options)
{
$validOptions = array('appid', 'query', 'results', 'start', 'language', 'type', 'format', 'adult_ok', 'similar_ok', 'country', 'site', 'subscription', 'license', 'region');
$this->_compareOptions($options, $validOptions);
/**
* @see Zend_Validate_Between
*/
//require_once 'Zend/Validate/Between.php';
$between = new Zend_Validate_Between(1, 100, true);
if (isset($options['results']) && !$between->setMin(1)->setMax(100)->isValid($options['results'])) {
/**
* @see Zend_Service_Exception
*/
//require_once 'Zend/Service/Exception.php';
throw new Zend_Service_Exception("Invalid value for option 'results': {$options['results']}");
}
if (isset($options['start']) && !$between->setMin(1)->setMax(1000)->isValid($options['start'])) {
/**
* @see Zend_Service_Exception
*/
//require_once 'Zend/Service/Exception.php';
throw new Zend_Service_Exception("Invalid value for option 'start': {$options['start']}");
}
if (isset($options['language'])) {
$this->_validateLanguage($options['language']);
}
$this->_validateInArray('type', $options['type'], array('all', 'any', 'phrase'));
$this->_validateInArray('format', $options['format'], array('any', 'html', 'msword', 'pdf', 'ppt', 'rss', 'txt', 'xls'));
if (isset($options['license'])) {
$this->_validateInArray('license', $options['license'], array('any', 'cc_any', 'cc_commercial', 'cc_modifiable'));
}
if (isset($options['region'])) {
$this->_validateInArray('region', $options['region'], array('ar', 'au', 'at', 'br', 'ca', 'ct', 'dk', 'fi', 'fr', 'de', 'in', 'id', 'it', 'my', 'mx', 'nl', 'no', 'ph', 'ru', 'sg', 'es', 'se', 'ch', 'th', 'uk', 'us'));
}
}
示例2: _validateWebSearch
/**
* Validate Web Search Options
*
* @param array $options
*/
protected function _validateWebSearch($options)
{
$valid_options = array('appid', 'query', 'results', 'start', 'language', 'type', 'format', 'adult_ok', 'similar_ok', 'country', 'site', 'subscription', 'license');
if (!is_array($options)) {
return;
}
$this->_compareOptions($options, $valid_options);
/**
* @see Zend_Validate_Between
*/
require_once 'Zend/Validate/Between.php';
$between = new Zend_Validate_Between(1, 20, true);
if (isset($options['results'])) {
if (!$between->setMin(1)->setMax(20)->isValid($options['results'])) {
throw new Zend_Service_Exception($options['results'] . ' is not valid for the "results" option.');
}
}
if (isset($options['start'])) {
if (!$between->setMin(1)->setMax(1000)->isValid($options['start'])) {
throw new Zend_Service_Exception($options['start'] . ' is not valid for the "start" option.');
}
}
$this->_validateLanguage($options['language']);
$this->_validateInArray('query type', $options['type'], array('all', 'any', 'phrase'));
$this->_validateInArray('format', $options['format'], array('any', 'html', 'msword', 'pdf', 'ppt', 'rss', 'txt', 'xls'));
$this->_validateInArray('license', $options['license'], array('any', 'cc_any', 'cc_commercial', 'cc_modifiable'));
}