Deployer\Server\Environment::get PHP Method

get() public method

public get ( string $name, boolean | integer | string | array $default = null ) : boolean | integer | string | array
$name string
$default boolean | integer | string | array
return boolean | integer | string | array
    public function get($name, $default = null)
    {
        if ($this->values->has($name)) {
            if ($this->isClosure($this->values[$name])) {
                $value = $this->values[$name] = call_user_func($this->values[$name]);
            } else {
                $value = $this->values[$name];
            }
        } else {
            $config = Deployer::get()->config;
            if (isset($config[$name])) {
                if ($this->isClosure($config[$name])) {
                    $value = $this->values[$name] = call_user_func($config[$name]);
                } else {
                    $value = $this->values[$name] = $config[$name];
                }
            } else {
                if (null === $default) {
                    throw new \RuntimeException("Configuration parameter `{$name}` does not exists.");
                } else {
                    $value = $default;
                }
            }
        }
        return $this->parse($value);
    }

Usage Example

 public function testDownloadDirectory()
 {
     $this->_server->expects($this->once())->method('download')->with($this->_env->get("local_path"), $this->_env->get("remote_path"));
     download('{{local_path}}', '{{remote_path}}');
 }