Changeset View
Changeset View
Standalone View
Standalone View
src/config/option/ArcanistConfigOption.php
| Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | abstract class ArcanistConfigOption | ||||
| public function getDefaultValue() { | public function getDefaultValue() { | ||||
| return $this->defaultValue; | return $this->defaultValue; | ||||
| } | } | ||||
| abstract public function getType(); | abstract public function getType(); | ||||
| abstract public function getValueFromStorageValueList(array $list); | abstract public function getValueFromStorageValueList(array $list); | ||||
| abstract public function getStorageValueFromStringValue($value); | |||||
| abstract public function getValueFromStorageValue($value); | abstract public function getValueFromStorageValue($value); | ||||
| abstract public function getDisplayValueFromValue($value); | abstract public function getDisplayValueFromValue($value); | ||||
| abstract public function getStorageValueFromValue($value); | |||||
| public function getStorageValueFromStringValue($value) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'This configuration option ("%s") does not support runtime definition '. | |||||
| 'with "--config".', | |||||
| $this->getKey())); | |||||
| } | |||||
| protected function getStorageValueFromSourceValue( | protected function getStorageValueFromSourceValue( | ||||
| ArcanistConfigurationSourceValue $source_value) { | ArcanistConfigurationSourceValue $source_value) { | ||||
| $value = $source_value->getValue(); | $value = $source_value->getValue(); | ||||
| $source = $source_value->getConfigurationSource(); | $source = $source_value->getConfigurationSource(); | ||||
| if ($source->isStringSource()) { | if ($source->isStringSource()) { | ||||
| $value = $this->getStorageValueFromStringValue($value); | $value = $this->getStorageValueFromStringValue($value); | ||||
| } | } | ||||
| return $value; | return $value; | ||||
| } | } | ||||
| public function writeValue(ArcanistConfigurationSource $source, $value) { | |||||
| $value = $this->getStorageValueFromValue($value); | |||||
| $source->setStorageValueForKey($this->getKey(), $value); | |||||
| } | |||||
| } | } | ||||