The WebAbility® Network Developers - Documentation
WebAbility Site
Debug and Core tools
DomCore comes with a set of basic classes that helps the easy debug and knowledge of what is going on in the memory and in your code, keeping trace of any created instances of your classes.

\core\WADebug is a generic semi-static class that permits you to know almost anything about any subclass that extends it directly or indirectly:
  • Quantity of instances of this class,
  • Total quantity of instances of any classes,
  • Assign a unique id to the instance,
  • Name of the superclass,
  • Méthods to debug and track the use log of the class,
  • Explain the class in memory and all the attributes.

To be able to use those capabilities, any class in your applications, except throwables, must be directly or indirectly extended from \core\WADebug.

\core\WAObject is a generic class that permits you to check the integrity of your extended class:
  • Forbids to use a variable not declared in the class header as private, protected or public (like java or C/C++),
  • Last access to any global class variable in read or write mode,
  • Explain the class structure and attributes
  • Integrate the use of a global application object (that should be a \patterns\Singleton, \patterns\Factory or anything you need)

\core\WAClass is a generic class that permits you to serialize/unserialize the instances of your classes.

\core\WALanguage is a static class that permits to parse an XML language table and get a ready-to-use language object.

\core\WATemplate is a static class that permits to create code based on a template with keywords to replace.

\core\WAMessage is a static class that permits internationalization (I18n) of system messages and errors.

Reference of the classes:
\core\WADebug: base debug class
\core\WAObject: base object class
\core\WAClass: base serializable class
\core\WALanguage: Language XML Parser class
\core\WATemplate: Templates system
\core\WAMessage: base Internationalization (I18n) class

You can easily extend from \core\WADebug, \core\WAObject and \core\WAClass all your application since it uses almost no CPU time nor memory, but helps a lot into debugging and understanding your code. The debug mode can be disconnected on production site and uses even less resources.

The debug control is made through static properties that are set at the beginning of your code. Any class can enter or exit the debugging mode in any moment of your choice.

To start a debug session, you need the following steps::
  • Define where are you going to log the debug messages: screen (html/cli) or file.
  • Define which debug level you need: all the system messages, informative messages or only programmer messages.
  • Start the session.
  • Execute the code.
  • Stop the session.


Examples:

The examples of using \core\WADebug are here:

http://domcore.demo.webability.info

and are distributed into any download of the source code.