lithium\console\Request::env PHP Method

env() public method

Get environment variables.
public env ( string $key = null ) : mixed
$key string
return mixed Returns the environment key related to the `$key` argument. If `$key` is equal to null the result will be the entire environment array. If `$key` is set but not available, `null` will be returned.
    public function env($key = null)
    {
        if (!empty($this->_env[$key])) {
            return $this->_env[$key];
        }
        if ($key === null) {
            return $this->_env;
        }
        return null;
    }

Usage Example

Example #1
0
 public function testConstructWithEnv()
 {
     $base = Libraries::get(true, 'resources') . '/tmp/tests';
     $this->skipIf(!is_readable($base), "Path `{$base}` is not readable.");
     chdir(Libraries::get(true, 'resources') . '/tmp');
     $request = new Request(array('env' => array('working' => '/some/other/path')));
     $expected = '/some/other/path';
     $result = $request->env('working');
     $this->assertEqual($expected, $result);
 }
All Usage Examples Of lithium\console\Request::env