Welcome Guest, Not a member yet? Register   Sign In
Preventing DRY in OOP
#11

[eluser]InsiteFX[/eluser]
Actually I have written a Registry Library for CI

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ------------------------------------------------------------------------
* Created by Php Designer 8.
* Date : 10/10/2013
* Time : 4:02:10 AM
* The Learn CodeIgniter Development Team.
* ------------------------------------------------------------------------
*
* Class Registry
*
* @package  Package  Application
* @subpackage Subpackage properties
* @category category properties
* @author  Raymond L King Sr.
* @copyright Copyright (c) 2009 - 2014, Custom Software Designers, LLC.
* @link  http://example.com
* ------------------------------------------------------------------------
* To change this template use File | Settings | File Templates.
* ------------------------------------------------------------------------
*/

/**
* SETUP:
*
* place this library in ./application/libraries/Registry.php
*
* Autoload: ./application/libraries/Registry.php
* Autoload: ./application/helpers/registry_helper.php
*
* TESTING:
*
* In your Controller index method add.
*
*   reg_set('1', 'test1', 'test1');
*   reg_set('1', 'test2', 'test1');
*   reg_set('1', 'test3', 'test1');
*
*   reg_set('2', 'test4', 'test2');
*   reg_set('2', 'test5', 'test2');
*   reg_set('2', 'test6', 'test2');
*
*   $result  = reg_get('1', 'test3');
*   $result1 = reg_get_index('2');
*   $exist   = reg_exists('2', 'test1');
*
*   $result2 = reg_delete('1', 'test3');
*
*   // Remove the remarks // to reset and clear out the reg array.
*   // reg_clear();
*
* DEBUGING:
*
*   var_dump($this->registry->debug_properties());
*
*   $this->registry->var_debug($this->registry->debug_registry(), $result, $result1, $exist, $result2);
*
* USAGE:
*
* set:   $this->registry->set('1', 'test1', 'test1');
* get:   $result = $this->registry->get('1', 'test3');
* get_index $result = $this->registry->get_index('2');
* exists:  $result = $this->registry->exists('2', 'test1');
* clear:  $this->registry->clear();
* delete:  $result2 = $this->registry->delete('1', 'test3');
*
*/

class Registry
{
/**
  * -----------------------------------------------------------------------
  * Class variables - public, private, protected and static.
  * -----------------------------------------------------------------------
  */

/**
  * array ( $index => array ( $key => $val ));
  */
private static $reg = array(array());

// -----------------------------------------------------------------------

/**
  * __construct()
  *
  * Constructor PHP 5+ NOTE: Not needed if not setting values!
  *
  * @access public
  * @return void
  */
public function __construct()
{
  log_message('debug', 'Registry Class Initialized');
}

Continued below


Messages In This Thread
Preventing DRY in OOP - by El Forum - 01-09-2014, 05:44 AM
Preventing DRY in OOP - by El Forum - 01-09-2014, 10:01 AM
Preventing DRY in OOP - by El Forum - 01-09-2014, 10:33 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 01:41 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 05:22 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 10:11 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 02:12 PM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:12 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:44 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:54 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:09 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:10 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:13 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:17 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:29 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:33 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:49 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:51 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:54 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 09:16 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 09:58 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:09 PM
Preventing DRY in OOP - by El Forum - 01-12-2014, 05:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB