68 if(!isset($array[
"mode"]) || ($array[
"mode"] !==
"whitelist" && $array[
"mode"] !==
"blacklist")){
69 throw new \InvalidArgumentException(
"\"mode\" must be set");
71 $isWhitelist = match($array[
"mode"]){
76 if(isset($array[
"plugins"])){
77 if(!is_array($array[
"plugins"])){
78 throw new \InvalidArgumentException(
"\"plugins\" must be an array");
80 foreach($array[
"plugins"] as $k => $v){
81 if(!is_string($v) && !is_int($v) && !is_float($v)){
82 throw new \InvalidArgumentException(
"\"plugins\" contains invalid element at position $k");
84 $plugins[] = (string) $v;
87 return new PluginGraylist($plugins, $isWhitelist);