本文整理匯總了PHP中DreamFactory\Library\Utility\ArrayUtils::isInList方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayUtils::isInList方法的具體用法?PHP ArrayUtils::isInList怎麽用?PHP ArrayUtils::isInList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DreamFactory\Library\Utility\ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils::isInList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: compareByOperator
/**
* @param $operator
* @param $left_found
* @param $left
* @param $right
*
* @return bool
* @throws InternalServerErrorException
*/
public static function compareByOperator($operator, $left_found, $left, $right)
{
switch ($operator) {
case DbFilterOperators::EQ:
return $left == $right;
case DbFilterOperators::NE:
return $left != $right;
case DbFilterOperators::GT:
return $left > $right;
case DbFilterOperators::LT:
return $left < $right;
case DbFilterOperators::GE:
return $left >= $right;
case DbFilterOperators::LE:
return $left <= $right;
case DbFilterOperators::STARTS_WITH:
return static::startsWith($left, $right);
case DbFilterOperators::ENDS_WITH:
return static::endswith($left, $right);
case DbFilterOperators::CONTAINS:
return false !== strpos($left, $right);
case DbFilterOperators::IN:
return ArrayUtils::isInList($right, $left);
case DbFilterOperators::NOT_IN:
return !ArrayUtils::isInList($right, $left);
case DbFilterOperators::IS_NULL:
return is_null($left);
case DbFilterOperators::IS_NOT_NULL:
return !is_null($left);
case DbFilterOperators::DOES_EXIST:
return $left_found;
case DbFilterOperators::DOES_NOT_EXIST:
return !$left_found;
default:
throw new InternalServerErrorException('Invalid server configuration detected.');
}
}