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.
Merge pull request #1 from Stijn-Flipper/master

fixed incorrect scoping