Location: PHPKode > scripts > Strategy based serializable object registry > strategy-based-serializable-object-registry/libraries/cobjectregistry.php
<?php
defined(ALLOW_EXEC) or die;

class CObjectRegistry{
    protected $mElements = array();
    public function set($key, $obj){
        if(($key != NULL)/*&& (is_object($obj)==true)*/) {
            //we assume types as object, if you dont want apply it, then uncomment it 
            $this->mElements[$key] = $obj; 
        }
    }
    public function get($keyValue){
        return $this->mElements[$keyValue];
    }
    public function getKeyValue($index){
        $temp= array_keys($this->mElements);
        return $temp[$index];
    }
    public function getByKeyIndex($index){
        return $this->get($this->getKeyValue($index));
    }
    public function size(){
        return sizeof($this->mElements);
    }
}; 
?>
Return current item: Strategy based serializable object registry