Source for file Session.class.php

Documentation is available at Session.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 Session
  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.  * Session Class
  22.  * 
  23.  * This class is a place holder for the Session instance the program uses.  This
  24.  * is the common access class for the program.  If the program switches from
  25.  * Session_Basic to Session_Encrypt, this class will hold the proper object.  The
  26.  * program uses this class to access the active Session class.  The basic Session
  27.  * class is used by default.
  28.  * 
  29.  * <pre>
  30.  * Session::load (new Session_Basic ());
  31.  * Session::instance ()->method (); // uses Session_Basic instance
  32.  * 
  33.  * Session::load (new Session_Encrypt ());
  34.  * // any method calls will use Session_Encrypt instance
  35.  * Session::instance ()->method (); // use Session_Encrypt
  36.  * </pre>
  37.  *
  38.  * @category Gumbo
  39.  * @package Session
  40.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  41.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  42.  * @author Michael Luster <mluster79@yahoo.com>
  43.  * @link http://sourceforge.net/projects/phpgumbo
  44.  * @desc Session Class
  45.  * @version 0.0.1
  46.  */
  47.  
  48. gumbo_load ("Interface_Singleton");
  49.  
  50. abstract class Gumbo_Session implements Gumbo_Interface_Singleton {
  51.     
  52.     /** @var Gumbo_Interface_Session $_instance */
  53.     private static $_instance null;
  54.     
  55.     
  56.     
  57.     /**
  58.      * Singleton Method
  59.      * @return Gumbo_Interface_Session 
  60.      */
  61.     public static function instance ({
  62.         if (self::$_instance == null{
  63.             gumbo_load ("Session_Basic");
  64.             self::$_instance new Gumbo_Session_Basic ();
  65.         }
  66.         return self::$_instance;
  67.     }
  68.     
  69.     
  70.     
  71.     /** STATIC METHODS **/
  72.     /**
  73.      * Sets the Active Session Instance
  74.      * @param Gumbo_Interface_Session $sess 
  75.      */
  76.     public static function load (Gumbo_Interface_Session $sess{
  77.         self::$_instance $sess;
  78.     }
  79.     
  80. }
  81.  
  82. ?>