Source for file Registry.php

Documentation is available at Registry.php

  1. <?php
  2. /**
  3.  *    LAIKA FRAMEWORK Release Notes:
  4.  *
  5.  *    @filesource     Registry.php
  6.  *
  7.  *    @version        0.1.0b
  8.  *    @package        Laika
  9.  *    @subpackage     core
  10.  *    @category
  11.  *    @date           2012-05-18 21:55:18 -0400 (Fri, 18 May 2012)
  12.  *
  13.  *    @author         Leonard M. Witzel <witzel@post.harvard.edu>
  14.  *    @copyright      Copyright (c) 2012  Laika Soft <{@link http://oafbot.com}>
  15.  *
  16.  */
  17. /**
  18.  * Laika_Registry class.
  19.  * 
  20.  * @extends Laika_Abstract_Registry
  21.  */
  22.  
  23. //-------------------------------------------------------------------
  24. //    VARIABLES
  25. //-------------------------------------------------------------------
  26.     protected static $instance;
  27.     private          $registry;
  28.  
  29.     /**
  30.      * init function.
  31.      * 
  32.      * @access public
  33.      * @static
  34.      * @return void 
  35.      */
  36.     public static function init()
  37.         ifempty(self::$instance) )       
  38.             ifisset($_SESSION[__CLASS__]&& !empty($_SESSION[__CLASS__]) )                   
  39.                 self::$instance self::unserialize_me();
  40.             else
  41.                 parent::init()
  42.         $_SESSION[__CLASS__self::$instance;       
  43.         return self::$instance;
  44.     }
  45.  
  46.     /**
  47.      * register function.
  48.      * 
  49.      * @access public
  50.      * @param mixed $index 
  51.      * @param mixed $reference 
  52.      * @return void 
  53.      */
  54.     public static function register($index,$reference){
  55.         self::init()->registry[$index$reference;
  56.         $db self::init()->registry[$index];
  57.         $_SESSION[__CLASS__self::$instance;
  58.     }
  59.     
  60.     /**
  61.      * unregister function.
  62.      * 
  63.      * @access public
  64.      * @param mixed $index 
  65.      * @return void 
  66.      */
  67.     public static function unregister($index){
  68.         self::init()->registry[$indexNULL;
  69.         $_SESSION[__CLASS__self::$instance;
  70.         return NULL;    
  71.     }
  72.     
  73.     /**
  74.      * get_record function.
  75.      * 
  76.      * @access public
  77.      * @param mixed $index 
  78.      * @return void 
  79.      */
  80.     public static function get_record($index){
  81.         return self::init()->registry[$index];   
  82.     }
  83.     
  84.     /**
  85.      * set_record function.
  86.      * 
  87.      * @access public
  88.      * @param mixed $index 
  89.      * @param mixed $reference 
  90.      * @return void 
  91.      */
  92.     public static function set_record($index,$reference){
  93.         self::init()->registry[$index$reference;
  94.         $_SESSION[__CLASS__self::$instance;    
  95.     }
  96.     
  97.     /**
  98.      * peek function.
  99.      * 
  100.      * @access public
  101.      * @static
  102.      * @param mixed $index 
  103.      * @return void 
  104.      */
  105.     public static function peek($index){
  106.         ifisset(self::init()->registry[$index]&& !empty(self::init()->registry[$index]) )
  107.             return true;
  108.         else
  109.             return false;
  110.     }
  111.         
  112.     /**
  113.      * __destruct function.
  114.      * 
  115.      * @access public
  116.      * @return void 
  117.      */
  118.     public function __destruct(){
  119.         self::serialize_me();
  120.     }
  121. }

Documentation generated on Sat, 19 May 2012 02:17:03 -0400 by phpDocumentor 1.4.4