PHPLights/Documentation/Global objects

From Linuxnetworks
< PHPLights‎ | Documentation
Revision as of 15:44, 16 September 2007 by Nose (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Global objects

There are two objects which are available everywhere in the application: The context (LsContext) and the configuration (LsConfig). Both are classes with static methods and don't need to be instantiated to be usable.

The context stores references to created objects during bootstrapping. This does include:

  • logging
  • request object
  • response object
  • database manager
  • user object
  • timer

The request object provides access to the available parameters given by the server. It stores references to the GET, POST, REQUEST, ENV and SERVER variables. Using get() on the request object requires a regular expression which is used to check if the value which belongs to the key is what is expected by the application. Otherwise, a security exception is thrown.

The response object is the opposite of the request object and it saves the prepared views until the output is finally generated by the dispatcher.

Authentication and access controll mechanisms are provided by the user object.

Finally, the timer has invaluable information for performance optimizations. Each time the add() function is called, the time difference to the last call is stored and is available in the debug view.



Back to Overview