| @@ 200-215 (lines=16) @@ | ||
| 197 | * @param int|float $value |
|
| 198 | * @return $this |
|
| 199 | */ |
|
| 200 | public function like($attribute, $value) |
|
| 201 | { |
|
| 202 | $this->callbacks[] = function(array $data) use ($attribute, $value) { |
|
| 203 | if (!array_key_exists($attribute, $data)) { |
|
| 204 | return false; |
|
| 205 | } |
|
| 206 | ||
| 207 | if (strpos($data[$attribute], $value) !== false) { |
|
| 208 | return true; |
|
| 209 | } |
|
| 210 | ||
| 211 | return false; |
|
| 212 | }; |
|
| 213 | ||
| 214 | return $this; |
|
| 215 | } |
|
| 216 | ||
| 217 | /** |
|
| 218 | * @param string $attribute |
|
| @@ 264-279 (lines=16) @@ | ||
| 261 | * @param array $values |
|
| 262 | * @return $this |
|
| 263 | */ |
|
| 264 | public function in($attribute, array $values) |
|
| 265 | { |
|
| 266 | $this->callbacks[] = function(array $data) use ($attribute, $values) { |
|
| 267 | if (!array_key_exists($attribute, $data)) { |
|
| 268 | return false; |
|
| 269 | } |
|
| 270 | ||
| 271 | if (in_array($data[$attribute], $values)) { |
|
| 272 | return true; |
|
| 273 | } |
|
| 274 | ||
| 275 | return false; |
|
| 276 | }; |
|
| 277 | ||
| 278 | return $this; |
|
| 279 | } |
|
| 280 | ||
| 281 | /** |
|
| 282 | * @param string $attribute |
|