本文整理汇总了PHP中Generic::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::setValue方法的具体用法?PHP Generic::setValue怎么用?PHP Generic::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generic
的用法示例。
在下文中一共展示了Generic::setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
/**
* Sets the value of this attribute
*
* @param integer $Value
*/
public function setValue($value){
$cleanValue = (string)$value;
if(!empty($this->maximumLength) && (strlen($cleanValue) > $this->maximumLength) ){
//throw validation exception
$cleanValue = substr($cleanValue, 0, $this->maximumLength);
}
parent::setValue($cleanValue);
}
示例2: setValue
/**
* Sets the value of this attribute
*
* @param mixed $value
* @return void
*/
public function setValue($value)
{
if (null === $value) {
return parent::setValue(null);
}
$cleanValue = (string) $value;
if (!empty($this->maximumLength) && $this->_getUnicodeValue('strlen', $cleanValue) > $this->maximumLength) {
$cleanValue = $this->_getUnicodeValue('substr', array($cleanValue, 0, $this->maximumLength));
}
parent::setValue($cleanValue);
}
示例3: setValue
/**
* Sets the value of this attribute
*
* @param integer $Value
*/
public function setValue($value){
$cleanValue = (int)$value;
if(!empty($this->minimum) && ($cleanValue < $this->minimum) ){
//throw validation exception
$cleanValue = $this->minimum;
}
if(!empty($this->maximum) && ($cleanValue > $this->maximum) ){
//throw validation exception
$cleanValue = $this->maximum;
}
parent::setValue($cleanValue);
}
示例4: setValue
/**
* Sets the value of this attribute
*
* @param string $value
*/
public function setValue($value)
{
parent::setValue(new \MongoRegex((string)$value));
}
示例5: setValue
/**
* Sets the value of this attribute
*
* @param boolean $Value
*/
public function setValue($value){
$cleanValue = (boolean)$value;
parent::setValue($cleanValue);
}
示例6: setValue
/**
* Overrides parent setValue to add enum value checking
*/
public function setValue($value)
{
if($this->isValidChoice($value)){
parent::setValue($value);
}
}