本文整理汇总了PHP中Prado\TPropertyValue::ensureFloat方法的典型用法代码示例。如果您正苦于以下问题:PHP TPropertyValue::ensureFloat方法的具体用法?PHP TPropertyValue::ensureFloat怎么用?PHP TPropertyValue::ensureFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado\TPropertyValue
的用法示例。
在下文中一共展示了TPropertyValue::ensureFloat方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDecayRate
/**
* Sets the decay rate between callback. Default is 0;
* @param float decay rate between callbacks.
*/
public function setDecayRate($value)
{
$decay = TPropertyValue::ensureFloat($value);
if ($decay < 0) {
throw new TConfigurationException('callback_decay_be_not_negative', $this->getID());
}
$this->setViewState('Decay', $decay);
}
示例2: setInterval
/**
* @param float seconds between callback requests, must be a positive number, default is 1 second.
*/
public function setInterval($value)
{
$interval = TPropertyValue::ensureFloat($value);
if ($interval <= 0) {
throw new TConfigurationException('callback_interval_be_positive', $this->getID());
}
if ($this->getInterval() === $value) {
return;
}
$this->setViewState('Interval', $interval, 1);
if ($this->getActiveControl()->canUpdateClientSide()) {
$client = $this->getPage()->getCallbackClient();
$client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setTimerInterval', array($this, $interval));
}
}
示例3: remove
/**
* Removes an item from the map by its key. If no priority, or false, is specified
* then priority is irrelevant. If null is used as a parameter for priority, then
* the priority will be the default priority. If a priority is specified, or
* the default priority is specified, only key-value pairs in that priority
* will be affected.
* @param mixed the key of the item to be removed
* @param numeric|false|null priority. False is any priority, null is the
* default priority, and numeric is a specific priority
* @return mixed the removed value, null if no such key exists.
* @throws TInvalidOperationException if the map is read-only
*/
public function remove($key, $priority = false)
{
if (!$this->_r) {
if ($priority === null) {
$priority = $this->getDefaultPriority();
}
if ($priority === false) {
$this->sortPriorities();
foreach ($this->_d as $priority => $items) {
if (array_key_exists($key, $items)) {
$value = $this->_d[$priority][$key];
unset($this->_d[$priority][$key]);
$this->_c--;
if (count($this->_d[$priority]) === 0) {
unset($this->_d[$priority]);
$this->_o = false;
}
$this->_fd = null;
return $value;
}
}
return null;
} else {
$priority = (string) round(TPropertyValue::ensureFloat($priority), $this->_p);
if (isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority]))) {
$value = $this->_d[$priority][$key];
unset($this->_d[$priority][$key]);
$this->_c--;
if (count($this->_d[$priority]) === 0) {
unset($this->_d[$priority]);
$this->_o = false;
}
$this->_fd = null;
return $value;
} else {
return null;
}
}
} else {
throw new TInvalidOperationException('map_readonly', get_class($this));
}
}
示例4: fadeTo
/**
* Set the opacity on a html element or control.
* This effect doesn't need jQueryUI.
* @param TControl control element or element id
* @param float opacity value between 1 and 0
*/
public function fadeTo($element, $value, $duration = 500)
{
$value = TPropertyValue::ensureFloat($value);
$this->visualEffect('fadeTo', $element, array($duration, $value));
}
示例5: setRating
/**
* @param float rating value, also sets the selected Index
*/
public function setRating($value)
{
$value = TPropertyValue::ensureFloat($value);
$this->setViewState('Rating', $value, null);
$index = $this->getRatingIndex($value);
parent::setSelectedIndex($index);
}
示例6: setFrequency
/**
* @param float maximum delay (in seconds) before requesting a suggestion.
* Default is 0.4.
*/
public function setFrequency($value)
{
$this->setViewState('frequency', TPropertyValue::ensureFloat($value), '');
}
示例7: setTimeStamp
/**
* Sets the date for the date picker using timestamp.
* @param float time stamp for the date picker
*/
public function setTimeStamp($value)
{
if ($value === null || is_string($value) && trim($value) === '') {
$this->setText('');
} else {
$date = TPropertyValue::ensureFloat($value);
$formatter = new TSimpleDateFormatter($this->getDateFormat());
$this->setText($formatter->format($date));
}
}
示例8: removeAtIndexInPriority
/**
* Removes the item at a specific index within a priority. Override
* and call this method to insert your own functionality.
* @param integer index of item to remove within the priority.
* @param numeric priority of the item to remove, defaults to null, or left blank, it is then set to the default priority
* @return mixed the removed item.
* @throws TInvalidDataValueException If the item does not exist
*/
public function removeAtIndexInPriority($index, $priority = null)
{
if ($this->getReadOnly()) {
throw new TInvalidOperationException('list_readonly', get_class($this));
}
if ($priority === null) {
$priority = $this->getDefaultPriority();
}
$priority = (string) round(TPropertyValue::ensureFloat($priority), $this->_p);
if (!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority])) {
throw new TInvalidDataValueException('list_item_inexistent');
}
// $value is an array of elements removed, only one
$value = array_splice($this->_d[$priority], $index, 1);
$value = $value[0];
if (!count($this->_d[$priority])) {
unset($this->_d[$priority]);
}
$this->_c--;
$this->_fd = null;
return $value;
}
示例9: setValue
/**
* @param float current value of slider
*/
public function setValue($value)
{
$this->setViewState('Value', TPropertyValue::ensureFloat($value), 0.0);
}
示例10: setMinSavings
/**
* @param float minimum amount of savings to actually store the value compressed
* @throws TInvalidOperationException if the module is already initialized
*/
public function setMinSavings($value)
{
if ($this->_initialized) {
throw new TInvalidOperationException('memcache_min_savings_unchangeable');
} else {
$this->_minSavings = TPropertyValue::ensureFloat($value);
}
}