Datastore/src/Connection/Grpc.php
private function convertFilterProps(array $filter)
    {
        if (isset($filter['propertyFilter'])) {
            $operator = $filter['propertyFilter']['op'];

            $constName = PropertyFilterOperator::class . '::' . $operator;
            if (!defined($constName)) {
                throw new \InvalidArgumentException('Invalid operator.');
            }

            $filter['propertyFilter']['op'] = constant($constName);
        }

        if (isset($filter['compositeFilter'])) {
            $filter['compositeFilter']['op'] = CompositeFilterOperator::PBAND;

            foreach ($filter['compositeFilter']['filters'] as &$nested) {
                $nested = $this->convertFilterProps($nested);
            }
        }

        return $filter;
    }
private function convertFilterProps(array $filter)
    {
        if (isset($filter['propertyFilter'])) {
            $operator = $filter['propertyFilter']['op'];

            $constName = PropertyFilterOperator::class . '::' . $operator;
            if (!defined($constName)) {
                throw new \InvalidArgumentException('Invalid operator.');
            }

            $filter['propertyFilter']['op'] = constant($constName);
        }

        if (isset($filter['compositeFilter'])) {
            $filter['compositeFilter']['op'] = CompositeFilterOperator::PBAND;

            foreach ($filter['compositeFilter']['filters'] as &$nested) {
                $nested = $this->convertFilterProps($nested);
            }
        }

        return $filter;
    }
private function convertFilterProps ( array $ filter ) { if ( isset ( $ filter [ 'propertyFilter' ] ) ) { $ operator = $ filter [ 'propertyFilter' ] [ 'op' ] ; $ constName = PropertyFilterOperator :: class . '::' . $ operator ; if ( ! defined ( $ constName ) ) { throw new \ InvalidArgumentException ( 'Invalid operator.' ) ; } $ filter [ 'propertyFilter' ] [ 'op' ] = constant ( $ constName ) ; } if ( isset ( $ filter [ 'compositeFilter' ] ) ) { $ filter [ 'compositeFilter' ] [ 'op' ] = CompositeFilterOperator :: PBAND ; foreach ( $ filter [ 'compositeFilter' ] [ 'filters' ] as & $ nested ) { $ nested = $ this -> convertFilterProps ( $ nested ) ; } } return $ filter ; }
Convert Query filters to an API-compatible value.

@param array $filter The input filter data
@return array
Convert Query filters to an API - compatible value .