protected function setFilterOptions(FilterOptionInterface $filter, array $options, array $validOptions)
    {
        foreach ($options as $option => $value) {
            if (!array_key_exists('setter', $validOptions[$option])) {
                throw new FilterOptionException(sprintf(
                    'Key "setter" is not present in option "%s" restrictions array (filter "%s").',
                    $option, get_class($filter)
                ));
            }

            $optionSetter = $validOptions[$option]['setter'];

            if (!method_exists($filter, $optionSetter)) {
                throw new FilterOptionException(sprintf(
                    'There is no such method "%s" in filter "%s".', $optionSetter, get_class($filter)
                ));
            }

            $filter->$optionSetter($value);
        }

        return $this;
    }
protected function setFilterOptions(FilterOptionInterface $filter, array $options, array $validOptions)
    {
        foreach ($options as $option => $value) {
            if (!array_key_exists('setter', $validOptions[$option])) {
                throw new FilterOptionException(sprintf(
                    'Key "setter" is not present in option "%s" restrictions array (filter "%s").',
                    $option, get_class($filter)
                ));
            }

            $optionSetter = $validOptions[$option]['setter'];

            if (!method_exists($filter, $optionSetter)) {
                throw new FilterOptionException(sprintf(
                    'There is no such method "%s" in filter "%s".', $optionSetter, get_class($filter)
                ));
            }

            $filter->$optionSetter($value);
        }

        return $this;
    }
protected function setFilterOptions ( FilterOptionInterface $ filter , array $ options , array $ validOptions ) { foreach ( $ options as $ option => $ value ) { if ( ! array_key_exists ( 'setter' , $ validOptions [ $ option ] ) ) { throw new FilterOptionException ( sprintf ( 'Key "setter" is not present in option "%s" restrictions array (filter "%s").' , $ option , get_class ( $ filter ) ) ) ; } $ optionSetter = $ validOptions [ $ option ] [ 'setter' ] ; if ( ! method_exists ( $ filter , $ optionSetter ) ) { throw new FilterOptionException ( sprintf ( 'There is no such method "%s" in filter "%s".' , $ optionSetter , get_class ( $ filter ) ) ) ; } $ filter -> $ optionSetter ( $ value ) ; } return $ this ; }
Sets filter options.
Options must be validated before setting them.

@param FilterOptionInterface $filter
@param array                 $options      User set options
@param array                 $validOptions FilterOptionInterface::getValidOptions()

@return static
@throws FilterOptionException On unexpected error (such as if setter method does not exist in filter class, etc)
Sets filter options . Options must be validated before setting them .