Use a local variable so that the closure works.
PHP < 5.4.0 doesnt support $this in anonymous functions.