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]);
|
||||
}
|
||||
|
||||
$booleanValidator = function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); };
|
||||
$booleanNormalizer = function ($val) { return $val !== 'false' && (bool) $val; };
|
||||
|
||||
// handle config values
|
||||
$uniqueConfigValues = array(
|
||||
'process-timeout' => array('is_numeric', 'intval'),
|
||||
'use-include-path' => array(
|
||||
function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); },
|
||||
function ($val) { return $val !== 'false' && (bool) $val; }
|
||||
$booleanValidator,
|
||||
$booleanNormalizer
|
||||
),
|
||||
'prefer-source' => array(
|
||||
function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); },
|
||||
function ($val) { return $val !== 'false' && (bool) $val; }
|
||||
$booleanValidator,
|
||||
$booleanNormalizer
|
||||
),
|
||||
'notify-on-install' => array(
|
||||
function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); },
|
||||
function ($val) { return $val !== 'false' && (bool) $val; }
|
||||
$booleanValidator,
|
||||
$booleanNormalizer
|
||||
),
|
||||
'vendor-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'bin-dir' => array('is_string', function ($val) { return $val; }),
|
||||
|
|
Loading…
Reference in New Issue