当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter::isExpression方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:24,代码来源:FilterChain.php

示例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));
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:34,代码来源:LdapConnection.php

示例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;
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:15,代码来源:FilterEditor.php

示例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);
         }
     }
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:12,代码来源:LdapQuery.php


注:本文中的Icinga\Data\Filter\Filter::isExpression方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。