flt_class now supports plain strings besides arrays
Publish PHP Package / docker (push) Successful in 7s
Details
Publish PHP Package / docker (push) Successful in 7s
Details
This commit is contained in:
parent
592ec1e07e
commit
1350bfaf0f
|
@ -89,9 +89,16 @@ function flt_class($val, $name, $struct, $args)
|
|||
$cce = \taskman\config_fetch_by_path($conf_path);
|
||||
|
||||
$conf_class = $cce->class;
|
||||
|
||||
$target_class = $args;
|
||||
if(is_array($target_class))
|
||||
$target_class = $target_class[0];
|
||||
|
||||
if(!class_exists($target_class))
|
||||
throw new Exception($val.". Target class \"".$target_class."\" is not valid");
|
||||
|
||||
if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0]))
|
||||
throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child");
|
||||
if($conf_class != $target_class && !is_subclass_of($conf_class, $target_class))
|
||||
throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$target_class."\" or it's child");
|
||||
}
|
||||
|
||||
return $val;
|
||||
|
|
Loading…
Reference in New Issue