When using php exec you can pass it with a variable not previously defined like this :
exec('whoami', $result, $status);
and they will be populated with information afterwards or initialized in this function. Can you do something similar with a function inside a custom class?
I have tried to search for an answer but not sure on what to search for so i'm sorry if this has previously been mentioned here.