Change scope in register function for $app

When running unit tests, the register fails since $this is not in object context
Merge pull request #4 from duellsy/patch-1

Change scope in register function for $app