public function send($id, $parent_id, $name, array $data){
if(empty($id) || empty($parent_id) || empty($name)){
//Exception
}
//ok
}
set_error_handler(function ($severity, $message, $file, $line) {
if (!(error_reporting() & $severity)) {
return;
}
throw new ErrorException($message, 0, $severity, $file, $line);
});
try {
// do something
send($id, $parentId, $name, $data)
} catch (\Throwable $e) {
// handle error
};