@@ 125-135 (lines=11) @@ | ||
122 | * @param string $mode |
|
123 | * @throws InvalidArgument |
|
124 | */ |
|
125 | protected function assertMode($mode) |
|
126 | { |
|
127 | $validModes = [self::MODE_MIN, self::MODE_MAX, self::MODE_SUM, self::MODE_AVG, self::MODE_MEDIAN]; |
|
128 | if (!in_array($mode, $validModes)) { |
|
129 | throw new InvalidArgument(sprintf( |
|
130 | 'Sort `mode` must be one of "%s", "%s" given.', |
|
131 | implode(', ', $validModes), |
|
132 | $mode |
|
133 | )); |
|
134 | } |
|
135 | } |
|
136 | } |
|
137 |
@@ 85-101 (lines=17) @@ | ||
82 | * @param string $type |
|
83 | * @throws InvalidArgument |
|
84 | */ |
|
85 | protected function assertType($type) |
|
86 | { |
|
87 | $validTypes = [ |
|
88 | self::TYPE_BEST_FIELDS, |
|
89 | self::TYPE_MOST_FIELDS, |
|
90 | self::TYPE_CROSS_FIELDS, |
|
91 | self::TYPE_PHRASE, |
|
92 | self::TYPE_PHRASE_PREFIX |
|
93 | ]; |
|
94 | if (!in_array($type, $validTypes)) { |
|
95 | throw new InvalidArgument(sprintf( |
|
96 | 'MultiMatch Query `type` must be one of "%s", "%s" given.', |
|
97 | implode(', ', $validTypes), |
|
98 | $type |
|
99 | )); |
|
100 | } |
|
101 | } |
|
102 | ||
103 | ||
104 | /** |