src/bbn/db.php
public function filter_filters(array $cfg, $field, $operator = null): ?array
  {
    if ( isset($cfg['filters']) ){
      $f = function($cond, &$res = []) use (&$f, $field, $operator){
        foreach ( $cond as $c ){
          if ( isset($c['conditions']) ){
            $f($c['conditions'], $res);
          }
          else if ( ($c['field'] === $field) && (!$operator || ($operator === $c['operator'])) ){
            $res[] = $c;
          }
        }
        return $res;
      };
      return isset($cfg['filters']['conditions']) ? $f($cfg['filters']['conditions']) : [];
    }
    return null;
  }
public function filter_filters(array $cfg, $field, $operator = null): ?array
  {
    if ( isset($cfg['filters']) ){
      $f = function($cond, &$res = []) use (&$f, $field, $operator){
        foreach ( $cond as $c ){
          if ( isset($c['conditions']) ){
            $f($c['conditions'], $res);
          }
          else if ( ($c['field'] === $field) && (!$operator || ($operator === $c['operator'])) ){
            $res[] = $c;
          }
        }
        return $res;
      };
      return isset($cfg['filters']['conditions']) ? $f($cfg['filters']['conditions']) : [];
    }
    return null;
  }
public function filter_filters ( array $ cfg , $ field , $ operator = null ) : ? array { if ( isset ( $ cfg [ 'filters' ] ) ) { $ f = function ( $ cond , & $ res = [ ] ) use ( & $ f , $ field , $ operator ) { foreach ( $ cond as $ c ) { if ( isset ( $ c [ 'conditions' ] ) ) { $ f ( $ c [ 'conditions' ] , $ res ) ; } else if ( ( $ c [ 'field' ] === $ field ) && ( ! $ operator || ( $ operator === $ c [ 'operator' ] ) ) ) { $ res [ ] = $ c ; } } return $ res ; } ; return isset ( $ cfg [ 'filters' ] [ 'conditions' ] ) ? $ f ( $ cfg [ 'filters' ] [ 'conditions' ] ) : [ ] ; } return null ; }
Retrieve an array of specific filters among the existing ones.

@param array $cfg
@param $field
@param null $operator
@return array|null
Retrieve an array of specific filters among the existing ones .