PHP_Shell
[ class tree: PHP_Shell ] [ index: PHP_Shell ] [ all elements ]

Source for file AutoloadDebug.php

Documentation is available at AutoloadDebug.php

  1. <?php
  2. /**
  3. * Autoload debugging
  4. *
  5. * The internal __autoload() function of the shell-wrapper has two hooks.
  6. * The first is called before the include is done, the second afterwards.
  7. *
  8. * we use it to track the order the includes are handled. That makes it
  9. * easier to find implicit dependency problems.
  10. *
  11. * :set autoloaddebug = on
  12. * :set autoloaddebug = off
  13. *
  14. * the depth functions track the recursive depth of the includes. The
  15. * wrapper uses it to print the dots at the beginning of the line.
  16. */
  17. class PHP_Shell_Extensions_AutoloadDebug implements PHP_Shell_Extension {
  18.     /**
  19.     * is the extenion enabled
  20.     *
  21.     * @var bool 
  22.     */
  23.     protected $autoload_debug = false;
  24.  
  25.     /**
  26.     * recursive depth of the includes
  27.     *
  28.     * @var int 
  29.     */
  30.     protected $autoload_depth = 0;
  31.  
  32.     public function register({
  33.         $opt = PHP_Shell_Options::getInstance();
  34.         $opt->registerOption('autoloaddebug'$this'optSetAutoloadDebug');
  35.     }
  36.  
  37.     /**
  38.     * handle the autoloaddebug flag
  39.     *
  40.     * @param string 
  41.     */
  42.     public function optSetAutoloadDebug($key$value{
  43.         switch ($value{
  44.         case "enable":
  45.         case "1":
  46.         case "on":
  47.             $this->autoload_debug = true;
  48.             break;
  49.         case "disable":
  50.         case "0":
  51.         case "off":
  52.             $this->autoload_debug = false;
  53.             break;
  54.         default:
  55.             printf(":set %s failed, unknown value. Use :set %s = (on|off)"$key$key);
  56.             return;
  57.         }
  58.  
  59.     }
  60.  
  61.     /**
  62.     * is the autoload-debug flag set ?
  63.     *
  64.     * @return bool true if debug is enabled
  65.     */
  66.     public function isAutoloadDebug({
  67.         return $this->autoload_debug;
  68.     }
  69.  
  70.     /**
  71.     * increment the depth counter
  72.     */
  73.     public function incAutoloadDepth({
  74.         return $this->autoload_depth++;
  75.     }
  76.     
  77.     /**
  78.     * decrement the depth counter
  79.     */
  80.     public function decAutoloadDepth({
  81.         return --$this->autoload_depth;
  82.     }
  83. }

Documentation generated on Mon, 11 Mar 2019 14:40:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.