src/Service/Criteria.php
private function validate(array $data) : void
    {
        $diff = array_diff(self::REQUIRED_PARAMS, array_keys($data));

        if (! empty($diff)) {
            throw new \InvalidArgumentException(
                sprintf('Search criteria is missing required parameter(s): %s', implode(', ', $diff))
            );
        }

        if (! is_string($data['field'])) {
            throw new \InvalidArgumentException('Field parameter must be a string');
        }

        if (! is_string($data['operator'])) {
            throw new \InvalidArgumentException('Operator parameter must be a string');
        }

        if (! is_scalar($data['value']) && ! is_array($data['value'])) {
            throw new \InvalidArgumentException(sprintf('Unsupported value type provided: %s', gettype($data['value'])));
        }
    }
private function validate(array $data) : void
    {
        $diff = array_diff(self::REQUIRED_PARAMS, array_keys($data));

        if (! empty($diff)) {
            throw new \InvalidArgumentException(
                sprintf('Search criteria is missing required parameter(s): %s', implode(', ', $diff))
            );
        }

        if (! is_string($data['field'])) {
            throw new \InvalidArgumentException('Field parameter must be a string');
        }

        if (! is_string($data['operator'])) {
            throw new \InvalidArgumentException('Operator parameter must be a string');
        }

        if (! is_scalar($data['value']) && ! is_array($data['value'])) {
            throw new \InvalidArgumentException(sprintf('Unsupported value type provided: %s', gettype($data['value'])));
        }
    }
private function validate ( array $ data ) : void { $ diff = array_diff ( self :: REQUIRED_PARAMS , array_keys ( $ data ) ) ; if ( ! empty ( $ diff ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Search criteria is missing required parameter(s): %s' , implode ( ', ' , $ diff ) ) ) ; } if ( ! is_string ( $ data [ 'field' ] ) ) { throw new \ InvalidArgumentException ( 'Field parameter must be a string' ) ; } if ( ! is_string ( $ data [ 'operator' ] ) ) { throw new \ InvalidArgumentException ( 'Operator parameter must be a string' ) ; } if ( ! is_scalar ( $ data [ 'value' ] ) && ! is_array ( $ data [ 'value' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unsupported value type provided: %s' , gettype ( $ data [ 'value' ] ) ) ) ; } }
Validates search criteria.

@param mixed[] $data Search criteria
@return void
@throws \InvalidArgumentException When invalid/incomplete data are provided
Validates search criteria .