protected function getFilterArray(FilterInterface $filter): array
    {
        $result = [];

        if ($filter instanceof Filter) {
            $result[$this->keyRepository->get('f')] = $filter->getField();
            if ($filter->getOperator() !== null) {
                $result[$this->keyRepository->get('o')] = $filter->getOperator();
            }
            if ($filter->getData() !== null) {
                $result[$this->keyRepository->get('d')] = $filter->getData();
            }
        }
        if ($filter instanceof GroupAndFilter) {
            $group = [];
            foreach ($filter as $subFilter) {
                $group[] = $this->getFilterArray($subFilter);
            }
            $result[$this->keyRepository->get('and')] = $group;
        }
        if ($filter instanceof GroupOrFilter) {
            $group = [];
            foreach ($filter as $subFilter) {
                $group[] = $this->getFilterArray($subFilter);
            }
            $result[$this->keyRepository->get('or')] = $group;
        }

        return $result;
    }
protected function getFilterArray(FilterInterface $filter): array
    {
        $result = [];

        if ($filter instanceof Filter) {
            $result[$this->keyRepository->get('f')] = $filter->getField();
            if ($filter->getOperator() !== null) {
                $result[$this->keyRepository->get('o')] = $filter->getOperator();
            }
            if ($filter->getData() !== null) {
                $result[$this->keyRepository->get('d')] = $filter->getData();
            }
        }
        if ($filter instanceof GroupAndFilter) {
            $group = [];
            foreach ($filter as $subFilter) {
                $group[] = $this->getFilterArray($subFilter);
            }
            $result[$this->keyRepository->get('and')] = $group;
        }
        if ($filter instanceof GroupOrFilter) {
            $group = [];
            foreach ($filter as $subFilter) {
                $group[] = $this->getFilterArray($subFilter);
            }
            $result[$this->keyRepository->get('or')] = $group;
        }

        return $result;
    }
protected function getFilterArray ( FilterInterface $ filter ) : array { $ result = [ ] ; if ( $ filter instanceof Filter ) { $ result [ $ this -> keyRepository -> get ( 'f' ) ] = $ filter -> getField ( ) ; if ( $ filter -> getOperator ( ) !== null ) { $ result [ $ this -> keyRepository -> get ( 'o' ) ] = $ filter -> getOperator ( ) ; } if ( $ filter -> getData ( ) !== null ) { $ result [ $ this -> keyRepository -> get ( 'd' ) ] = $ filter -> getData ( ) ; } } if ( $ filter instanceof GroupAndFilter ) { $ group = [ ] ; foreach ( $ filter as $ subFilter ) { $ group [ ] = $ this -> getFilterArray ( $ subFilter ) ; } $ result [ $ this -> keyRepository -> get ( 'and' ) ] = $ group ; } if ( $ filter instanceof GroupOrFilter ) { $ group = [ ] ; foreach ( $ filter as $ subFilter ) { $ group [ ] = $ this -> getFilterArray ( $ subFilter ) ; } $ result [ $ this -> keyRepository -> get ( 'or' ) ] = $ group ; } return $ result ; }
Get the filter part of the array.

@param FilterInterface $filter

@return array
Get the filter part of the array .