Changeset View
Changeset View
Standalone View
Standalone View
src/config/ArcanistConfigurationSourceList.php
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | final class ArcanistConfigurationSourceList | ||||
public function getConfigOptions() { | public function getConfigOptions() { | ||||
if ($this->configOptions === null) { | if ($this->configOptions === null) { | ||||
throw new PhutilInvalidStateException('setConfigOptions'); | throw new PhutilInvalidStateException('setConfigOptions'); | ||||
} | } | ||||
return $this->configOptions; | return $this->configOptions; | ||||
} | } | ||||
public function validateConfiguration() { | public function validateConfiguration(ArcanistRuntime $runtime) { | ||||
$options = $this->getConfigOptions(); | $options = $this->getConfigOptions(); | ||||
$aliases = array(); | $aliases = array(); | ||||
foreach ($options as $key => $option) { | foreach ($options as $key => $option) { | ||||
foreach ($option->getAliases() as $alias) { | foreach ($option->getAliases() as $alias) { | ||||
$aliases[$alias] = $key; | $aliases[$alias] = $key; | ||||
} | } | ||||
} | } | ||||
Show All 10 Lines | foreach ($this->getSources() as $source) { | ||||
$resolved_key = idx($aliases, $key, $key); | $resolved_key = idx($aliases, $key, $key); | ||||
$option = idx($options, $resolved_key); | $option = idx($options, $resolved_key); | ||||
// If there's no option object for this config, this value is | // If there's no option object for this config, this value is | ||||
// unrecognized. Sources are free to handle this however they want: | // unrecognized. Sources are free to handle this however they want: | ||||
// for config files we emit a warning; for "--config" we fatal. | // for config files we emit a warning; for "--config" we fatal. | ||||
if (!$option) { | if (!$option) { | ||||
$source->didReadUnknownOption($key); | $source->didReadUnknownOption($runtime, $key); | ||||
continue; | continue; | ||||
} | } | ||||
$raw_value = $source->getValueForKey($key); | $raw_value = $source->getValueForKey($key); | ||||
// Make sure we can convert whatever value the configuration source is | // Make sure we can convert whatever value the configuration source is | ||||
// providing into a legitimate runtime value. | // providing into a legitimate runtime value. | ||||
try { | try { | ||||
Show All 25 Lines | foreach ($value_lists as $key => $value_list) { | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |