本文整理匯總了PHP中Inspekt::isBetween方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inspekt::isBetween方法的具體用法?PHP Inspekt::isBetween怎麽用?PHP Inspekt::isBetween使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inspekt
的用法示例。
在下文中一共展示了Inspekt::isBetween方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testIsBetween4
/**
* Generated from @assert ('p', 'a', 'm', FALSE) === FALSE.
*/
public function testIsBetween4()
{
$this->assertSame(FALSE, Inspekt::isBetween('p', 'a', 'm', FALSE));
}
示例2: testBetween
/**
* Returns value if it is greater than or equal to $min and less
* than or equal to $max, FALSE otherwise. If $inc is set to
* FALSE, then the value must be strictly greater than $min and
* strictly less than $max.
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @param boolean $inc
* @return mixed
*
* @tag validator
*/
function testBetween($key, $min, $max, $inc = TRUE)
{
if (!$this->keyExists($key)) {
return false;
}
if (Inspekt::isBetween($this->_getValue($key), $min, $max, $inc)) {
return $this->_getValue($key);
}
return FALSE;
}
示例3: testBetween
/**
* Returns value if it is greater than or equal to $min and less
* than or equal to $max, FALSE otherwise. If $inc is set to
* FALSE, then the value must be strictly greater than $min and
* strictly less than $max.
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @param boolean $inc
* @return mixed
* @throws Exception
* @tag validator
*/
public function testBetween($key, $min, $max, $inc = true)
{
$value = $this->getValueOrNull($key);
if (!is_null($value) && Inspekt::isBetween($value, $min, $max, $inc)) {
return $value;
}
return false;
}