Minor code reorg to reduce duplication
parent
0d81ab7f46
commit
9110c6413e
|
@ -248,20 +248,23 @@ EOT
|
||||||
return $this->configSource->addConfigSetting('github-oauth.'.$matches[1], $values[0]);
|
return $this->configSource->addConfigSetting('github-oauth.'.$matches[1], $values[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$booleanValidator = function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); };
|
||||||
|
$booleanNormalizer = function ($val) { return $val !== 'false' && (bool) $val; };
|
||||||
|
|
||||||
// handle config values
|
// handle config values
|
||||||
$uniqueConfigValues = array(
|
$uniqueConfigValues = array(
|
||||||
'process-timeout' => array('is_numeric', 'intval'),
|
'process-timeout' => array('is_numeric', 'intval'),
|
||||||
'use-include-path' => array(
|
'use-include-path' => array(
|
||||||
function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); },
|
$booleanValidator,
|
||||||
function ($val) { return $val !== 'false' && (bool) $val; }
|
$booleanNormalizer
|
||||||
),
|
),
|
||||||
'prefer-source' => array(
|
'prefer-source' => array(
|
||||||
function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); },
|
$booleanValidator,
|
||||||
function ($val) { return $val !== 'false' && (bool) $val; }
|
$booleanNormalizer
|
||||||
),
|
),
|
||||||
'notify-on-install' => array(
|
'notify-on-install' => array(
|
||||||
function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); },
|
$booleanValidator,
|
||||||
function ($val) { return $val !== 'false' && (bool) $val; }
|
$booleanNormalizer
|
||||||
),
|
),
|
||||||
'vendor-dir' => array('is_string', function ($val) { return $val; }),
|
'vendor-dir' => array('is_string', function ($val) { return $val; }),
|
||||||
'bin-dir' => array('is_string', function ($val) { return $val; }),
|
'bin-dir' => array('is_string', function ($val) { return $val; }),
|
||||||
|
|
Loading…
Reference in New Issue