public function isFilterable($state, $target)
    {
        // Empty string
        if ($state === true && empty($target) && $target !== '0') {
            return false;
        }

        // Pure wildcards must be treated as empty values
        if ($state == true && ($target == '%%' || $target == '%')) {
            return false;
        }

        // Start checking from very common usage case
        if ($state == true && $target == '0') {
            return true;
        }

        // If empty array supplied
        if (is_array($target) && empty($target)) {
            return false;
        }

        $result = false;

        if ($state === false) {
            $result = true;
        } else {

            if (is_string($target) && $target != '0' && !empty($target)) {
                $result = true;
            }

            if (is_array($target)) {
                // If empty array is passed, that means it's time to stop right here
                if (empty($target)) {
                    $result = false;
                } else {
                    // Otherwise go on
                    $count = 0;

                    foreach ($target as $value) {
                        if (!empty($value)) {
                            $count++;
                        }
                    }

                    // All values must not be empty
                    if ($count == count($target)) {
                        $result = true;
                    }
                }
            }
        }

        return $result;
    }
public function isFilterable($state, $target)
    {
        // Empty string
        if ($state === true && empty($target) && $target !== '0') {
            return false;
        }

        // Pure wildcards must be treated as empty values
        if ($state == true && ($target == '%%' || $target == '%')) {
            return false;
        }

        // Start checking from very common usage case
        if ($state == true && $target == '0') {
            return true;
        }

        // If empty array supplied
        if (is_array($target) && empty($target)) {
            return false;
        }

        $result = false;

        if ($state === false) {
            $result = true;
        } else {

            if (is_string($target) && $target != '0' && !empty($target)) {
                $result = true;
            }

            if (is_array($target)) {
                // If empty array is passed, that means it's time to stop right here
                if (empty($target)) {
                    $result = false;
                } else {
                    // Otherwise go on
                    $count = 0;

                    foreach ($target as $value) {
                        if (!empty($value)) {
                            $count++;
                        }
                    }

                    // All values must not be empty
                    if ($count == count($target)) {
                        $result = true;
                    }
                }
            }
        }

        return $result;
    }
public function isFilterable ( $ state , $ target ) { // Empty string if ( $ state === true && empty ( $ target ) && $ target !== '0' ) { return false ; } // Pure wildcards must be treated as empty values if ( $ state == true && ( $ target == '%%' || $ target == '%' ) ) { return false ; } // Start checking from very common usage case if ( $ state == true && $ target == '0' ) { return true ; } // If empty array supplied if ( is_array ( $ target ) && empty ( $ target ) ) { return false ; } $ result = false ; if ( $ state === false ) { $ result = true ; } else { if ( is_string ( $ target ) && $ target != '0' && ! empty ( $ target ) ) { $ result = true ; } if ( is_array ( $ target ) ) { // If empty array is passed, that means it's time to stop right here if ( empty ( $ target ) ) { $ result = false ; } else { // Otherwise go on $ count = 0 ; foreach ( $ target as $ value ) { if ( ! empty ( $ value ) ) { $ count ++ ; } } // All values must not be empty if ( $ count == count ( $ target ) ) { $ result = true ; } } } } return $ result ; }
Checks whether it's worth filtering

@param boolean $state
@param string|array $target
@return boolean
Checks whether it s worth filtering