I would just assign wfMessage output to

$result['counterMessage']

no need for a variable I guess

also some spacing around