Registry::__construct PHP Method

__construct() private method

! Prohibit instantiation
private __construct ( )
    private function __construct()
    {
    }

Usage Example

Example #1
0
 public function __construct()
 {
     // must come before registry construction
     session_start();
     session_regenerate_id();
     // initialize registry
     parent::__construct($_SESSION);
     // session exists
     if ($this['generated']) {
         // session expired (x minutes) - start from scratch
         if (time() - $this['generated'] > 30 * 60) {
             unset($this['username']);
             unset($this['password']);
             $this['status'] = 2;
         }
     } else {
         // if no session is found
         if ($this['status'] === false) {
             $this['status'] = 6;
         }
     }
     $this['status_old'] = $this['status'];
     // reset session timeout
     $this['generated'] = time();
 }
All Usage Examples Of Registry::__construct