75 if(!isset($array[
"mode"]) || ($array[
"mode"] !==
"whitelist" && $array[
"mode"] !==
"blacklist")){
76 throw new \InvalidArgumentException(
"\"mode\" must be set");
78 $isWhitelist = match($array[
"mode"]){
83 if(isset($array[
"plugins"])){
84 if(!is_array($array[
"plugins"])){
85 throw new \InvalidArgumentException(
"\"plugins\" must be an array");
87 foreach(Utils::promoteKeys($array[
"plugins"]) as $k => $v){
88 if(!is_string($v) && !is_int($v) && !is_float($v)){
89 throw new \InvalidArgumentException(
"\"plugins\" contains invalid element at position $k");
91 $plugins[] = (string) $v;
94 return new PluginGraylist($plugins, $isWhitelist);