Skip to content

Commit 10c3f18

Browse files
Cleaned up setup method
1 parent 29701e5 commit 10c3f18

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/Backup/Source/Mongodump.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,12 @@ class Mongodump extends Cli implements Source
118118
public function setup(array $conf = array())
119119
{
120120
$this->setupSourceData($conf);
121+
$this->setupCredentials($conf);
121122

122-
// environment settings
123+
// environment settings, config & validation
123124
$this->pathToMongodump = Util\Arr::getValue($conf, 'pathToMongodump');
124-
125-
// credentials
126-
$this->host = Util\Arr::getValue($conf, 'host');
127-
$this->user = Util\Arr::getValue($conf, 'user');
128-
$this->password = Util\Arr::getValue($conf, 'password');
129-
$this->authenticationDatabase = Util\Arr::getValue($conf, 'authenticationDatabase');
130-
131-
// config & validation
132-
$this->useIPv6 = Util\Str::toBoolean(Util\Arr::getValue($conf, 'ipv6', ''), false);
133-
$this->showStdErr = Util\Str::toBoolean(Util\Arr::getValue($conf, 'showStdErr', ''), false);
125+
$this->useIPv6 = Util\Str::toBoolean(Util\Arr::getValue($conf, 'ipv6', ''), false);
126+
$this->showStdErr = Util\Str::toBoolean(Util\Arr::getValue($conf, 'showStdErr', ''), false);
134127
}
135128

136129
/**
@@ -146,6 +139,19 @@ protected function setupSourceData(array $conf)
146139
$this->excludeCollectionsWithPrefix = Util\Str::toList(Util\Arr::getValue($conf, 'excludeCollectionsWithPrefix'));
147140
}
148141

142+
/**
143+
* Fetch credential settings.
144+
*
145+
* @param array $conf
146+
*/
147+
protected function setupCredentials(array $conf)
148+
{
149+
$this->host = Util\Arr::getValue($conf, 'host');
150+
$this->user = Util\Arr::getValue($conf, 'user');
151+
$this->password = Util\Arr::getValue($conf, 'password');
152+
$this->authenticationDatabase = Util\Arr::getValue($conf, 'authenticationDatabase');
153+
}
154+
149155
/**
150156
* (non-PHPDoc)
151157
*

0 commit comments

Comments
 (0)