本文整理匯總了PHP中ValidatorMap::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP ValidatorMap::getValue方法的具體用法?PHP ValidatorMap::getValue怎麽用?PHP ValidatorMap::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ValidatorMap
的用法示例。
在下文中一共展示了ValidatorMap::getValue方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isValid
/**
* @see BasicValidator::isValid()
*/
public function isValid(ValidatorMap $map, $value)
{
if (is_null($value) == false && is_numeric($value)) {
return intval($value) >= intval($map->getValue());
}
return false;
}
示例2: isValid
public function isValid(ValidatorMap $map, $str)
{
$value = $map->getValue();
$con = Propel::getConnection(RecipePeer::DATABASE_NAME);
$sql = "SELECT id FROM " . $value . " WHERE id = :id";
$stmt = $con->prepare($sql);
$stmt->execute(array(':id' => $str));
$result = $stmt->fetchAll();
return count($result) > 0;
}
示例3: isValid
/**
* @see BasicValidator::isValid()
*
* @param ValidatorMap $map
* @param mixed $value
*
* @return boolean
*/
public function isValid(ValidatorMap $map, $value)
{
switch ($map->getValue()) {
case 'array':
return is_array($value);
break;
case 'bool':
case 'boolean':
return is_bool($value);
break;
case 'float':
return is_float($value);
break;
case 'int':
case 'integer':
return is_int($value);
break;
case 'numeric':
return is_numeric($value);
break;
case 'object':
return is_object($value);
break;
case 'resource':
return is_resource($value);
break;
case 'scalar':
return is_scalar($value);
break;
case 'string':
return is_string($value);
break;
case 'function':
return function_exists($value);
break;
default:
throw new PropelException('Unkonwn type ' . $map->getValue());
break;
}
}
示例4: isValid
/**
* @see BasicValidator::isValid()
*/
public function isValid(ValidatorMap $map, $str)
{
return strlen($str) >= intval($map->getValue());
}
示例5: isValid
public function isValid(ValidatorMap $map, $value)
{
return gettype($value) == $map->getValue();
}
示例6: isValid
public function isValid(ValidatorMap $map, $str)
{
return in_array($str, explode("|", $map->getValue()));
}
示例7: isValid
/**
* Whether the passed string matches regular expression.
*/
public function isValid(ValidatorMap $map, $str)
{
return preg_match($this->prepareRegexp($map->getValue()), $str) != 0;
}
示例8: isValid
/**
* @see BasicValidator::isValid()
*
* @param ValidatorMap $map
* @param string $str
*
* @return boolean
*/
public function isValid(ValidatorMap $map, $str)
{
$len = function_exists('mb_strlen') ? mb_strlen($str) : strlen($str);
return $len >= intval($map->getValue());
}
示例9: isValid
/**
* @see BasicValidator::isValid()
*
* @param ValidatorMap $map
* @param string $str
*
* @return boolean
*/
public function isValid(ValidatorMap $map, $str)
{
return in_array($str, preg_split("/[|,]/", $map->getValue()));
}