Changeset View
Changeset View
Standalone View
Standalone View
src/config/option/ArcanistWildConfigOption.php
- This file was added.
| <?php | |||||
| /** | |||||
| * This option type makes it easier to manage unknown options with unknown | |||||
| * types. | |||||
| */ | |||||
| final class ArcanistWildConfigOption | |||||
| extends ArcanistConfigOption { | |||||
| public function getType() { | |||||
| return 'wild'; | |||||
| } | |||||
| public function getStorageValueFromStringValue($value) { | |||||
| return (string)$value; | |||||
| } | |||||
| public function getDisplayValueFromValue($value) { | |||||
| return json_encode($value); | |||||
| } | |||||
| public function getValueFromStorageValueList(array $list) { | |||||
| assert_instances_of($list, 'ArcanistConfigurationSourceValue'); | |||||
| $source_value = last($list); | |||||
| $storage_value = $this->getStorageValueFromSourceValue($source_value); | |||||
| return $this->getValueFromStorageValue($storage_value); | |||||
| } | |||||
amckinley: I'm not sure if there's more than one copy of this other than `ArcanistScalarConfigOption`, but… | |||||
Done Inline ActionsThis could be moved up, but since Wild isn't a Scalar I think they'd have to share some base class:
The SingleValue / Scalar distinction seemed confusing to me but maybe we'll have more stuff later on which drives adjustment here. This hierarchy wouldn't necessarily be bad, maybe Scalar is just not a great name. I'll keep an eye on it as it gets fleshed out more. epriestley: This could be moved up, but since `Wild` isn't a `Scalar` I think they'd have to share some… | |||||
| public function getValueFromStorageValue($value) { | |||||
| return $value; | |||||
| } | |||||
| } | |||||
I'm not sure if there's more than one copy of this other than ArcanistScalarConfigOption, but can this be moved up the class hierarchy?