getKey method

Method getKey() allowed to get any stored value to session.

Example

Here is the example usage for getKey() method and setKey() method.

class Home extends SENE_Controller{
  public function __construct(){
    parent::__construct();
  }
  private funtion __init(){
    	$data = array();
    	$sess = $this->getKey();
    	if(!isset($sess->user_login)) $sess->user_login = 0;
    	if(!isset($sess->user)) $sess->user = new stdClass();
    	if(isset($sess->user->id)) $sess->user_login = 1;
    	$this->setKey($sess);
    	$data['sess'] = $sess;
    	return $data;
  }
  public function index(){
    	$data = $this->__init();
  }
  public function set_logged_in(){
    	$sess = $this->getKey();
    	if(!isset($sess->user_login)) $sess->user_login = 1;
    	if(!isset($sess->user)) $sess->user = new stdClass();
    	if(!isset($sess->user->id)) $sess->user->id = 1000;
    	$this->setKey($sess);
  }
  public function set_logged_out(){
    	$sess = $this->getKey();
    	if(!isset($sess->user_login)) $sess->user_login = 0;
    	if(!isset($sess->user)) $sess->user = new stdClass();
    	if(!isset($sess->user->id)) $sess->user->id = 1000;
    	unset($sess->user->id);
    	$this->setKey($sess);
  }
}