Inspekt\Inspekt::makeCookieCage PHP Method

makeCookieCage() public static method

This utilizes a singleton pattern to get around scoping issues
public static makeCookieCage ( string $config_file = null, boolean $strict = true ) : Cage
$config_file string
$strict boolean whether or not to nullify the superglobal array
return Cage
    public static function makeCookieCage($config_file = null, $strict = true)
    {
        /**
         * @staticvar $_instance
         */
        static $_instance;
        if (!isset($_instance)) {
            $_instance = Cage::factory($_COOKIE, $config_file, '_COOKIE', $strict);
        }
        $GLOBALS['HTTP_COOKIE_VARS'] = null;
        return $_instance;
    }

Usage Example

Example #1
0
 /**
  *
  */
 public function testMakeCookieCage()
 {
     $cage = Inspekt::makeCookieCage();
     $this->assertTrue($cage instanceof Cage);
 }