| @@ 191-206 (lines=16) @@ | ||
| 188 | * @param int|float $value |
|
| 189 | * @return $this |
|
| 190 | */ |
|
| 191 | public function like($attribute, $value) |
|
| 192 | { |
|
| 193 | $this->callbacks[] = function(array $data) use ($attribute, $value) { |
|
| 194 | if (!array_key_exists($attribute, $data)) { |
|
| 195 | return false; |
|
| 196 | } |
|
| 197 | ||
| 198 | if (strpos($data[$attribute], $value) !== false) { |
|
| 199 | return true; |
|
| 200 | } |
|
| 201 | ||
| 202 | return false; |
|
| 203 | }; |
|
| 204 | ||
| 205 | return $this; |
|
| 206 | } |
|
| 207 | ||
| 208 | /** |
|
| 209 | * @param string $attribute |
|
| @@ 255-270 (lines=16) @@ | ||
| 252 | * @param array $values |
|
| 253 | * @return $this |
|
| 254 | */ |
|
| 255 | public function in($attribute, array $values) |
|
| 256 | { |
|
| 257 | $this->callbacks[] = function(array $data) use ($attribute, $values) { |
|
| 258 | if (!array_key_exists($attribute, $data)) { |
|
| 259 | return false; |
|
| 260 | } |
|
| 261 | ||
| 262 | if (in_array($data[$attribute], $values)) { |
|
| 263 | return true; |
|
| 264 | } |
|
| 265 | ||
| 266 | return false; |
|
| 267 | }; |
|
| 268 | ||
| 269 | return $this; |
|
| 270 | } |
|
| 271 | ||
| 272 | /** |
|
| 273 | * @param string $attribute |
|