mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-17 13:28:35 +01:00
Improve filtering
Make filter work with multiple keys and wildcard search, eg. user/* or ip 10.0.*
This commit is contained in:
parent
12997a339d
commit
1663f3808b
@ -77,7 +77,7 @@ class FileStorage implements StorageInterface
|
||||
$data = $this->get($file['id']);
|
||||
$meta = $data['__meta'];
|
||||
unset($data);
|
||||
if (array_keys(array_intersect($meta, $filters)) == array_keys($filters)) {
|
||||
if ($this->filter($meta, $filters)) {
|
||||
$results[] = $meta;
|
||||
}
|
||||
if(count($results) >= ($max + $offset)){
|
||||
@ -88,6 +88,15 @@ class FileStorage implements StorageInterface
|
||||
return array_slice($results, $offset, $max);
|
||||
}
|
||||
|
||||
protected function filter($meta, $filters){
|
||||
foreach($filters as $key => $value){
|
||||
if(fnmatch ($value, $meta[$key]) === false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user