Destructor not needed.
Style, phpdoc.
Fix syntax and style.
Run the application handlers for notifications separately.

Listing applications and running API methods might reach code that tries to
call the global $notification object that we are still instantiating. This
happens for example if using transparent authentication and getting to the
setView() code.