本文整理汇总了PHP中Icinga\Data\Filter\Filter::isExpression方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::isExpression方法的具体用法?PHP Filter::isExpression怎么用?PHP Filter::isExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icinga\Data\Filter\Filter
的用法示例。
在下文中一共展示了Filter::isExpression方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateFilterColumns
protected function validateFilterColumns(Filter $filter)
{
if ($filter->isExpression()) {
$valid = false;
foreach ($this->allowedColumns as $column) {
if (is_callable($column)) {
if (call_user_func($column, $filter->getColumn())) {
$valid = true;
break;
}
} elseif ($filter->getColumn() === $column) {
$valid = true;
break;
}
}
if (!$valid) {
throw new QueryException('Invalid filter column provided: %s', $filter->getColumn());
}
} else {
foreach ($filter->filters() as $subFilter) {
$this->validateFilterColumns($subFilter);
}
}
}
示例2: renderFilter
/**
* Render and return a valid LDAP filter representation of the given filter
*
* @param Filter $filter
* @param int $level
*
* @return string
*/
public function renderFilter(Filter $filter, $level = 0)
{
if ($filter->isExpression()) {
/** @var $filter FilterExpression */
return $this->renderFilterExpression($filter);
}
/** @var $filter FilterChain */
$parts = array();
foreach ($filter->filters() as $filterPart) {
$part = $this->renderFilter($filterPart, $level + 1);
if ($part) {
$parts[] = $part;
}
}
if (empty($parts)) {
return '';
}
$format = '%1$s(%2$s)';
if (count($parts) === 1) {
$format = '%2$s';
}
if ($level === 0) {
$format = '(' . $format . ')';
}
return sprintf($format, $filter->getOperatorSymbol(), implode(')(', $parts));
}
示例3: resetSearchColumns
protected function resetSearchColumns(Filter &$filter)
{
if ($filter->isChain()) {
$filters =& $filter->filters();
if (!($empty = empty($filters))) {
foreach ($filters as $k => &$f) {
if (false === $this->resetSearchColumns($f)) {
unset($filters[$k]);
}
}
}
return $empty || !empty($filters);
}
return $filter->isExpression() ? !(in_array($filter->getColumn(), $this->searchColumns) && $filter->getSign() === '=') : true;
}
示例4: addFilter
public function addFilter(Filter $filter)
{
// TODO: This should be considered a quick fix only.
// Drop this entirely once support for Icinga\Data\Filter is available
if ($filter->isExpression()) {
$this->where($filter->getColumn(), $filter->getExpression());
} elseif ($filter->isChain()) {
foreach ($filter->filters() as $chainOrExpression) {
$this->addFilter($chainOrExpression);
}
}
}