| @@ 829-844 (lines=16) @@ | ||
| 826 | * @param array $values |
|
| 827 | * @param bool $exclude |
|
| 828 | */ |
|
| 829 | public function setFilter($attribute, array $values, $exclude = false) |
|
| 830 | { |
|
| 831 | assert(is_string($attribute)); |
|
| 832 | assert(count($values)); |
|
| 833 | ||
| 834 | foreach ($values as $value) { |
|
| 835 | assert(is_numeric($value)); |
|
| 836 | } |
|
| 837 | ||
| 838 | $this->filters[] = array( |
|
| 839 | 'type' => self::FILTER_VALUES, |
|
| 840 | 'attr' => $attribute, |
|
| 841 | 'exclude' => $exclude, |
|
| 842 | 'values' => $values |
|
| 843 | ); |
|
| 844 | } |
|
| 845 | ||
| 846 | /** |
|
| 847 | * Set string filter |
|
| @@ 875-889 (lines=15) @@ | ||
| 872 | * @param int $max |
|
| 873 | * @param bool $exclude |
|
| 874 | */ |
|
| 875 | public function setFilterRange($attribute, $min, $max, $exclude = false) |
|
| 876 | { |
|
| 877 | assert(is_string($attribute)); |
|
| 878 | assert(is_numeric($min)); |
|
| 879 | assert(is_numeric($max)); |
|
| 880 | assert($min <= $max); |
|
| 881 | ||
| 882 | $this->filters[] = array( |
|
| 883 | 'type' => self::FILTER_RANGE, |
|
| 884 | 'attr' => $attribute, |
|
| 885 | 'exclude' => $exclude, |
|
| 886 | 'min' => $min, |
|
| 887 | 'max' => $max |
|
| 888 | ); |
|
| 889 | } |
|
| 890 | ||
| 891 | /** |
|
| 892 | * Set float range filter |
|
| @@ 900-914 (lines=15) @@ | ||
| 897 | * @param int $max |
|
| 898 | * @param bool $exclude |
|
| 899 | */ |
|
| 900 | public function setFilterFloatRange($attribute, $min, $max, $exclude = false) |
|
| 901 | { |
|
| 902 | assert(is_string($attribute)); |
|
| 903 | assert(is_float($min)); |
|
| 904 | assert(is_float($max)); |
|
| 905 | assert($min <= $max); |
|
| 906 | ||
| 907 | $this->filters[] = array( |
|
| 908 | 'type' => self::FILTER_FLOAT_RANGE, |
|
| 909 | 'attr' => $attribute, |
|
| 910 | 'exclude' => $exclude, |
|
| 911 | 'min' => $min, |
|
| 912 | 'max' => $max |
|
| 913 | ); |
|
| 914 | } |
|
| 915 | ||
| 916 | /** |
|
| 917 | * Setup anchor point for geosphere distance calculations |
|