2023-05-18 15:09:35 +03:00
|
|
|
<?php
|
|
|
|
namespace metagen_php;
|
|
|
|
use Exception;
|
|
|
|
|
|
|
|
function flt_bhl_ref($val, $name, $struct, $args)
|
|
|
|
{
|
|
|
|
if(!$val)
|
|
|
|
return $val;
|
|
|
|
|
|
|
|
if(!isset($val['module']))
|
|
|
|
throw new Exception("Missing 'module'");
|
|
|
|
|
2023-05-30 16:34:59 +03:00
|
|
|
$module_file = \taskman\bhl_map_module_to_file($val['module']);
|
|
|
|
if(!$module_file)
|
|
|
|
throw new Exception("Module not found '{$val['module']}");
|
|
|
|
|
2023-05-18 15:09:35 +03:00
|
|
|
if(!isset($val['fn']))
|
|
|
|
throw new Exception("Missing 'fn'");
|
|
|
|
|
|
|
|
$signature = explode(",", $args);
|
|
|
|
if(!$signature)
|
|
|
|
throw new Exception("Invalid signature: $args");
|
|
|
|
|
2023-05-30 16:34:59 +03:00
|
|
|
\taskman\bhl_validate_func_ref($module_file, $val['fn'], $signature);
|
2023-05-18 15:09:35 +03:00
|
|
|
|
|
|
|
return $val;
|
|
|
|
}
|
|
|
|
|