Source for file Debug.class.php

Documentation is available at Debug.class.php

  1. <?php
  2. /**
  3.  * Gumbo Library Framework
  4.  *
  5.  * LICENSE
  6.  * This library is being released under the terms of the New BSD License.  A
  7.  * copy of the license is packaged with the software (LICENSE.txt).  If no
  8.  * copy is found, a copy of the license template can be found at:
  9.  * http://www.opensource.org/licenses/bsd-license.php
  10.  * 
  11.  * @category Gumbo
  12.  * @package Debug
  13.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  14.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  15.  * @author Michael Luster <mluster79@yahoo.com>
  16.  * @link http://sourceforge.net/projects/phpgumbo
  17.  * @version 0.0.1
  18.  */
  19.  
  20. /**
  21.  * Debug Interface
  22.  *
  23.  * @category Gumbo
  24.  * @package Debug
  25.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  26.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  27.  * @author Michael Luster <mluster79@yahoo.com>
  28.  * @link http://sourceforge.net/projects/phpgumbo
  29.  * @desc Debug Interface
  30.  * @version 0.0.1
  31.  */
  32.  
  33. interface Gumbo_Interface_Debug {
  34.     
  35.     /** ACTION METHODS **/
  36.     /**
  37.      * Creates a message and adds it to the Debugger
  38.      * @param string $mess message content
  39.      * @param string $file file name
  40.      * @param int $line line number
  41.      * @param string $func function/method name
  42.      * @param string $cls class name
  43.      */
  44.     public function add ($mess$file$line$func=null$cls=null);
  45.     
  46.     /**
  47.      * Adds a function to the restriction list
  48.      * @precondition function_exists ($func) or method_exists ($cls, $func)
  49.      * @precondition !isRestrictedFunction ($func, $cls)
  50.      * @param string $func function name
  51.      * @param string $cls class name
  52.      */
  53.     public function addRestrictedFunction ($func$cls=null);
  54.     
  55.     /**
  56.      * Adds a class to the restriction list
  57.      * @precondition is_class ($cls)
  58.      * @precondition !isRestrictedClass ($cls)
  59.      * @param string $cls class name
  60.      */
  61.     public function addRestrictedClass ($cls);
  62.     
  63.     /**
  64.      * Adds a file to the restriction list
  65.      * @precondition file_exists ($file)
  66.      * @precondition $start < $end
  67.      * @precondition !isRestrictedFile ($file, $start, $end)
  68.      * @param string $file file name
  69.      * @param int $start start line
  70.      * @param int $end end line
  71.      */
  72.     public function addRestrictedFile ($file$start=null$end=null);
  73.     
  74.     
  75.     
  76.     /**
  77.      * Resets all the restrictions
  78.      * @postcondition $_functions, $_classes, $_files = array ()
  79.      */
  80.     public function resetRestrictions ();
  81.     
  82.     /**
  83.      * Resets the Debug messages
  84.      * @postcondition setTime ()
  85.      * @postcondition $_messages = array ()
  86.      */
  87.     public function reset ();
  88.     
  89.     /**
  90.      * Activates the Debugger
  91.      * @postcondition $_active = true
  92.      */
  93.     public function activate ();
  94.     
  95.     /**
  96.      * Deactivates the Debugger
  97.      * @postcondition $_active = false
  98.      */
  99.     public function deactivate ();
  100.     
  101.     
  102.     
  103.     /** MUTATOR METHODS **/
  104.     /**
  105.      * Set the mode to Inclusive
  106.      * @postcondition $_inclusive = true
  107.      */
  108.     public function setInclusive ();
  109.     
  110.     /**
  111.      * Sets the mode to Exclusive
  112.      * @postcondition $_inclusive = false
  113.      */
  114.     public function setExclusive ();
  115.     
  116.     
  117.     
  118.     /** ACCESSOR METHODS **/
  119.     /**
  120.      * Returns all the messages of the Debugger
  121.      * @return array 
  122.      */
  123.     public function getAllMessages ();
  124.     
  125.     /**
  126.      * Returns the time stamp when the Debugger was started
  127.      * @return num 
  128.      */
  129.     public function getTime ();
  130.     
  131.     
  132.     
  133.     /**
  134.      * Returns if the Debug mode is active
  135.      * @return bool 
  136.      */
  137.     public function isActive ();
  138.     
  139.     /**
  140.      * Returns if the restrictions are inclusive
  141.      * @return bool 
  142.      */
  143.     public function isInclusive ();
  144.     
  145.     /**
  146.      * Returns if the function is restricted
  147.      * @param string $func function name
  148.      * @param string $cls class name
  149.      * @return bool 
  150.      */
  151.     public function isRestrictedFunction ($func$cls=null);
  152.     
  153.     /**
  154.      * Returns if the class is restricted
  155.      * @param string $cls class name
  156.      * @return bool 
  157.      */
  158.     public function isRestrictedClass ($cls);
  159.     
  160.     /**
  161.      * Returns if the file is restricted
  162.      * @param string $file file name
  163.      * @param int $line line number
  164.      * @return bool 
  165.      */
  166.     public function isRestrictedFile ($file$line=null);
  167.     
  168. }
  169.  
  170. ?>