69 if(!isset($array[
"mode"]) || ($array[
"mode"] !==
"whitelist" && $array[
"mode"] !==
"blacklist")){
70 throw new \InvalidArgumentException(
"\"mode\" must be set");
72 $isWhitelist = match($array[
"mode"]){
77 if(isset($array[
"plugins"])){
78 if(!is_array($array[
"plugins"])){
79 throw new \InvalidArgumentException(
"\"plugins\" must be an array");
81 foreach(Utils::promoteKeys($array[
"plugins"]) as $k => $v){
82 if(!is_string($v) && !is_int($v) && !is_float($v)){
83 throw new \InvalidArgumentException(
"\"plugins\" contains invalid element at position $k");
85 $plugins[] = (string) $v;
88 return new PluginGraylist($plugins, $isWhitelist);