本文整理汇总了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.');
}
}