Variable HOST_HELPERS_PHPConst
HOST_HELPERS_PHP: "\n/**\n * Reads a capability the host installed on the Module.\n *\n * @param string $name\n * The capability the host installed on the Module.\n *\n * @return mixed\n * The host function, or NULL when there is no bridge.\n */\nfunction cfw_host($name)\n{\n\treturn function_exists('vrzno_env') ? vrzno_env($name) : null;\n}\n/**\n * Sends one request across the bridge and decodes the reply.\n *\n * @param callable $fn\n * The host function from cfw_host().\n * @param array<string, mixed> $payload\n * The request, run through the pw codec.\n *\n * @return array<string, mixed>\n * The decoded reply, or an `ok => false` refusal naming what went wrong.\n */\nfunction cfw_call($fn, array $payload)\n{\n\t$invoke = $fn;\n\t$reply = $invoke(json_encode(pw_encode($payload)));\n\tif (!is_string($reply)) {\n\t\treturn [\n\t\t\t'ok' => false,\n\t\t\t'error' =>\n\t\t\t\t'host returned ' . get_debug_type($reply) . ' where a JSON string was expected',\n\t\t];\n\t}\n\t$decoded = json_decode($reply, true);\n\tif (!is_array($decoded)) {\n\t\treturn ['ok' => false, 'error' => 'unparseable host reply: ' . substr($reply, 0, 200)];\n\t}\n\treturn pw_decode($decoded);\n}\n/**\n * Runs one SQL statement on the object's database.\n *\n * @param string $sql\n * One statement.\n * @param array<int|string, mixed> $params\n * Positional or named bindings.\n *\n * @return array<string, mixed>\n * The host reply: `ok`, and `rows` on a read.\n */\nfunction cfw_sql($sql, $params = [])\n{\n\treturn cfw_call(cfw_host('cfwSqlExec'), ['sql' => $sql, 'params' => $params]);\n}\n/**\n * Runs statements in one transaction, optionally reading inside it.\n *\n * @param array<int, array{sql: string, params: array<int|string, mixed>}> $statements\n * The statements to run in one transaction.\n * @param bool $commit\n * Whether to commit rather than roll back.\n * @param array{sql: string, params: array<int|string, mixed>}|null $read\n * A statement to run inside the transaction and report.\n *\n * @return array<string, mixed>\n * The host reply: `ok`, and `readResult` when a read was asked for.\n */\nfunction cfw_txn(array $statements, $commit = true, $read = null)\n{\n\treturn cfw_call(cfw_host('cfwSqlTxn'), [\n\t\t'statements' => array_values($statements),\n\t\t'commit' => $commit,\n\t\t'read' => $read,\n\t]);\n}\n"