fixed incorrect scoping

PHP versions == 5.3.* will complain about `using $this when not in object
context`. This is due to the closed scope of (lambda) function. This commit
fixes that by passing the class member function as parameter.