lithium\core\Environment::reset PHP Method

reset() public static method

Resets the Environment class to its default state, including unsetting the current environment, removing any environment-specific configurations, and removing the custom environment detector, if any has been specified.
public static reset ( $env = null )
$env If set, delete the defined environment only.
    public static function reset($env = null)
    {
        if ($env) {
            unset(static::$_configurations[$env]);
            return;
        }
        static::$_current = '';
        static::$_detector = null;
        static::$_configurations = array('production' => array(), 'development' => array(), 'test' => array());
    }

Usage Example

Beispiel #1
0
 /**
  * Tests resetting the `Environment` class to its default state.
  *
  * @return void
  */
 public function testReset()
 {
     Environment::set('test', array('foo' => 'bar'));
     Environment::set('test');
     $this->assertEqual('test', Environment::get());
     $this->assertEqual('bar', Environment::get('foo'));
     Environment::reset();
     $this->assertEqual('', Environment::get());
     $this->assertNull(Environment::get('foo'));
 }
All Usage Examples Of lithium\core\Environment::reset