Changeset View
Changeset View
Standalone View
Standalone View
src/config/ArcanistConfigurationEngine.php
| Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | public function newConfigOptionsMap() { | ||||
| return $map; | return $map; | ||||
| } | } | ||||
| private function validateConfigOptionKey( | private function validateConfigOptionKey( | ||||
| $key, | $key, | ||||
| ArcanistConfigurationEngineExtension $extension, | ArcanistConfigurationEngineExtension $extension, | ||||
| $is_alias_of = null) { | $is_alias_of = null) { | ||||
| $reserved = array( | |||||
| // The presence of this key is used to detect old "~/.arcrc" files, so | |||||
| // configuration options may not use it. | |||||
| 'config', | |||||
| ); | |||||
| $reserved = array_fuse($reserved); | |||||
| if (isset($reserved[$key])) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Extension ("%s") defines invalid configuration with key "%s". '. | |||||
| 'This key is reserved.', | |||||
| get_class($extension), | |||||
| $key)); | |||||
| } | |||||
| $is_ok = preg_match('(^[a-z][a-z0-9._-]{2,}\z)', $key); | $is_ok = preg_match('(^[a-z][a-z0-9._-]{2,}\z)', $key); | ||||
| if (!$is_ok) { | if (!$is_ok) { | ||||
| if ($is_alias_of === null) { | if ($is_alias_of === null) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Extension ("%s") defines invalid configuration with key "%s". '. | 'Extension ("%s") defines invalid configuration with key "%s". '. | ||||
| 'Configuration keys: may only contain lowercase letters, '. | 'Configuration keys: may only contain lowercase letters, '. | ||||
| 'numbers, hyphens, underscores, and periods; must start with a '. | 'numbers, hyphens, underscores, and periods; must start with a '. | ||||
| Show All 27 Lines | |||||