-
Notifications
You must be signed in to change notification settings - Fork 28
Attribute DirectCall
Targets: Property, Method; AllowMultiple: false
ConfigModuleAttribute is used to decorate property or method with name of PHP method or PHP field that should be used instead of decorated c# property or c# method
Name contains destination method or field followed by attributes
- no attributes - procedural style PHP function will be used
-
->orinstance- instance method/field will be used -
::orstatic- static method/field will be used -
$orfield- field will be used instead of method
Map contains sequence of numbers and this separated by comma that can change original method arguments. Map parameter is mostly used for decorating methods. In case of decorating property only empty value or this is allowed.
If ->, :: or $ is used whitespace around are not necessary. Expressions ->$fieldName, -> $ fieldName or instace field fieldName have the same meaning.
###Example for instance property###
Assume original c# code int a = someObject.SomeProperty and SomeProperty is decorated by DirectCallAttribute
-
decoration
DirectCall("MethodName")gives translation$a = MethodName() -
decoration
DirectCall("->MethodName")gives translation$a = $someObject->MethodName() -
decoration
DirectCall("MethodName", "this")gives translation$a = MethodName($someObject).String.Lengthis decorated this way usingDirectCall("mb_strlen", "this") -
decoration
DirectCall("->$FieldName")gives translation$a = $someObject->FieldName
###For method###
Assume original c# code int result = someObject.someMethod(a, b, c)
-
decoration
DirectCall("somePhpFunction")gives translation$result = somePhpFunction($a, $b, $c) -
decoration
DirectCall("->somePhpFunction")gives translation$result = $someObject->somePhpFunction($a, $b, $c) -
decoration
DirectCall("somePhpFunction", "0,1,this,2")gives translation$result = somePhpFunction($a, $b, $someObject, $c)