MCPcopy Index your code
hub / github.com/php/frankenphp / generateGoCall

Method generateGoCall

internal/extgen/phpfunc.go:38–59  ·  view source on GitHub ↗
(fn phpFunction)

Source from the content-addressed store, hash-verified

36}
37
38func (pfg *PHPFuncGenerator) generateGoCall(fn phpFunction) string {
39 callParams := pfg.paramParser.generateGoCallParams(fn.Params)
40 goFuncName := "go_" + fn.Name
41
42 if fn.ReturnType == phpVoid {
43 return fmt.Sprintf(" %s(%s);", goFuncName, callParams)
44 }
45
46 if fn.ReturnType == phpString {
47 return fmt.Sprintf(" zend_string *result = %s(%s);", goFuncName, callParams)
48 }
49
50 if fn.ReturnType == phpArray {
51 return fmt.Sprintf(" zend_array *result = %s(%s);", goFuncName, callParams)
52 }
53
54 if fn.ReturnType == phpMixed {
55 return fmt.Sprintf(" zval *result = %s(%s);", goFuncName, callParams)
56 }
57
58 return fmt.Sprintf(" %s result = %s(%s);", pfg.getCReturnType(fn.ReturnType), goFuncName, callParams)
59}
60
61func (pfg *PHPFuncGenerator) getCReturnType(returnType phpType) string {
62 switch returnType {

Callers 1

generateMethod · 0.95

Calls 2

getCReturnTypeMethod · 0.95
generateGoCallParamsMethod · 0.80

Tested by

no test coverage detected