ObjectHooks.onCallMissingMethod
onCallMissingMethod($method, $arguments=[]) -> Result
Description
Add this method to your class to handle calling to methods that are not publicly defined.
Return Result.ok($value)
if the call was successful. Otherwise, return Result.fail()
to trigger an error.
class MyClass { fun onCallMissingMethod($methodName, $args) { if $methodName == 'getSecretNumber' { return Result.ok(42) } return Result.fail() } } $object = MyClass() $object.getSecretNumber() //= 42