protected function validateParamFilters(array $vProperties, array $filters, $test)
    {
        foreach ($filters as $filter) {
            $isDefined = false;
            foreach ($vProperties as $vProperty) {
                $isDefined = isset($vProperty[$filter['name']]);
                if ($isDefined) {
                    break;
                }
            }

            if ($filter['is-not-defined']) {
                if ($isDefined) {
                    $success = false;
                } else {
                    $success = true;
                }

                // If there's no text-match, we can just check for existence
            } elseif (!$filter['text-match'] || !$isDefined) {
                $success = $isDefined;
            } else {
                $success = false;
                foreach ($vProperties as $vProperty) {
                    // If we got all the way here, we'll need to validate the
                    // text-match filter.
                    $success = DAV\StringUtil::textMatch($vProperty[$filter['name']]->getValue(), $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
                    if ($success) {
                        break;
                    }
                }
                if ($filter['text-match']['negate-condition']) {
                    $success = !$success;
                }
            } // else

            // There are two conditions where we can already determine whether
            // or not this filter succeeds.
            if ('anyof' === $test && $success) {
                return true;
            }
            if ('allof' === $test && !$success) {
                return false;
            }
        }

        // If we got all the way here, it means we haven't been able to
        // determine early if the test failed or not.
        //
        // This implies for 'anyof' that the test failed, and for 'allof' that
        // we succeeded. Sounds weird, but makes sense.
        return 'allof' === $test;
    }
protected function validateParamFilters(array $vProperties, array $filters, $test)
    {
        foreach ($filters as $filter) {
            $isDefined = false;
            foreach ($vProperties as $vProperty) {
                $isDefined = isset($vProperty[$filter['name']]);
                if ($isDefined) {
                    break;
                }
            }

            if ($filter['is-not-defined']) {
                if ($isDefined) {
                    $success = false;
                } else {
                    $success = true;
                }

                // If there's no text-match, we can just check for existence
            } elseif (!$filter['text-match'] || !$isDefined) {
                $success = $isDefined;
            } else {
                $success = false;
                foreach ($vProperties as $vProperty) {
                    // If we got all the way here, we'll need to validate the
                    // text-match filter.
                    $success = DAV\StringUtil::textMatch($vProperty[$filter['name']]->getValue(), $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
                    if ($success) {
                        break;
                    }
                }
                if ($filter['text-match']['negate-condition']) {
                    $success = !$success;
                }
            } // else

            // There are two conditions where we can already determine whether
            // or not this filter succeeds.
            if ('anyof' === $test && $success) {
                return true;
            }
            if ('allof' === $test && !$success) {
                return false;
            }
        }

        // If we got all the way here, it means we haven't been able to
        // determine early if the test failed or not.
        //
        // This implies for 'anyof' that the test failed, and for 'allof' that
        // we succeeded. Sounds weird, but makes sense.
        return 'allof' === $test;
    }
protected function validateParamFilters ( array $ vProperties , array $ filters , $ test ) { foreach ( $ filters as $ filter ) { $ isDefined = false ; foreach ( $ vProperties as $ vProperty ) { $ isDefined = isset ( $ vProperty [ $ filter [ 'name' ] ] ) ; if ( $ isDefined ) { break ; } } if ( $ filter [ 'is-not-defined' ] ) { if ( $ isDefined ) { $ success = false ; } else { $ success = true ; } // If there's no text-match, we can just check for existence } elseif ( ! $ filter [ 'text-match' ] || ! $ isDefined ) { $ success = $ isDefined ; } else { $ success = false ; foreach ( $ vProperties as $ vProperty ) { // If we got all the way here, we'll need to validate the // text-match filter. $ success = DAV \ StringUtil :: textMatch ( $ vProperty [ $ filter [ 'name' ] ] -> getValue ( ) , $ filter [ 'text-match' ] [ 'value' ] , $ filter [ 'text-match' ] [ 'collation' ] , $ filter [ 'text-match' ] [ 'match-type' ] ) ; if ( $ success ) { break ; } } if ( $ filter [ 'text-match' ] [ 'negate-condition' ] ) { $ success = ! $ success ; } } // else // There are two conditions where we can already determine whether // or not this filter succeeds. if ( 'anyof' === $ test && $ success ) { return true ; } if ( 'allof' === $ test && ! $ success ) { return false ; } } // If we got all the way here, it means we haven't been able to // determine early if the test failed or not. // // This implies for 'anyof' that the test failed, and for 'allof' that // we succeeded. Sounds weird, but makes sense. return 'allof' === $ test ; }
Validates if a param-filter can be applied to a specific property.

@todo currently we're only validating the first parameter of the passed
property. Any subsequence parameters with the same name are
ignored.

@param array  $vProperties
@param array  $filters
@param string $test

@return bool
Validates if a param - filter can be applied to a specific property .