in src/Invoker.php [41:76]
public function __construct($target, ?string $signatureType = null)
{
if (is_string($target) && isset(self::$registeredFunctions[$target])) {
$this->function = self::$registeredFunctions[$target];
} else {
if (!is_callable($target)) {
throw new InvalidArgumentException(sprintf(
'Function target is not callable: "%s"',
$target
));
}
if ($signatureType === 'http') {
$this->function = new HttpFunctionWrapper($target);
} elseif (
$signatureType === 'event'
|| $signatureType === 'cloudevent'
) {
$this->function = new CloudEventFunctionWrapper($target, false);
} elseif ($signatureType === 'typed') {
$this->function = new TypedFunctionWrapper($target);
} else {
throw new InvalidArgumentException(sprintf(
'Invalid signature type: "%s"',
$signatureType
));
}
}
$this->errorLogFunc = function (string $error) {
fwrite(fopen('php://stderr', 'wb'), json_encode([
'message' => $error,
'severity' => 'error'
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
};
}