public static function updateConfigOption($optionName,$optionValue, $force = false) {
		
		if (is_string($optionValue) && strpos($optionValue,"<prompt>") !== false) {
			
			// prompt for input using the supplied query
			$options = "";
			$default = "";
			$prompt  = str_replace("</prompt>","",str_replace("<prompt>","",$optionValue));
			if (strpos($prompt, "<default>") !== false) {
				$default = explode("<default>",$prompt);
				$default = explode("</default>",$default[1]);
				$default = $default[0];
			}
			
			$input = Console::promptInput($prompt,$options,$default,false);
			
			self::writeUpdateConfigOption($optionName,$input);
			Console::writeTag("ok","config option ".$optionName." updated...", false, true);
			
		} else if (!isset(self::$options[$optionName]) || (self::$options["overrideConfig"] == "a") || $force) {
			
			// if the option isn't set or the config is always to override update the config
			self::writeUpdateConfigOption($optionName,$optionValue);
			
		} else if (self::$options["overrideConfig"] == "q") {
			
			// standardize the values for comparison
			$currentOption      = self::getOption($optionName);
			$currentOptionValue = $currentOption;
			$newOptionValue     = $optionValue;
			$optionNameOutput   = $optionName;
			
			// dive into plugins to do a proper comparison to
			if ($optionName == "plugins") {
				
				// replace the data in anticipation of it being used
				$optionValue = array_replace_recursive($currentOption, $newOptionValue);
				
				// get the key of the plugin that is being added/updated
				reset($newOptionValue);
				$newOptionKey = key($newOptionValue);
				
				if (!array_key_exists($newOptionKey, $currentOptionValue)) {
					
					// if the key doesn't exist just write out the new config and move on
					self::writeUpdateConfigOption($optionName,$optionValue);
					return;
					
				} else {
					
					// see if the existing configs for the plugin exists. if so just return with no changes
					if ($newOptionValue[$newOptionKey] == $currentOptionValue[$newOptionKey]) {
						return;
					} else {
						$optionNameOutput   = $optionName.".".$newOptionKey;
					}
					
				}
				
			}
			
			if ($currentOptionValue != $newOptionValue) {
				
				// prompt for input
				if (is_array($currentOptionValue)) {
					$prompt  = "update the config option <desc>".$optionNameOutput."</desc> with the value from the package install?";
				} else {
					$prompt  = "update the config option <desc>".$optionNameOutput." (".$currentOptionValue.")</desc> with the value <desc>".$newOptionValue."</desc>?";
				}$options = "Y/n";
				$input   = Console::promptInput($prompt,$options,"Y");
				
				if ($input == "y") {
					
					// update the config option
					self::writeUpdateConfigOption($optionName,$optionValue);
					Console::writeInfo("config option ".$optionNameOutput." updated...", false, true);
					
				} else {
					Console::writeWarning("config option <desc>".$optionNameOutput."</desc> not  updated...", false, true);
				}
				
			}
			
		}
		
	}
public static function updateConfigOption($optionName,$optionValue, $force = false) {
		
		if (is_string($optionValue) && strpos($optionValue,"<prompt>") !== false) {
			
			// prompt for input using the supplied query
			$options = "";
			$default = "";
			$prompt  = str_replace("</prompt>","",str_replace("<prompt>","",$optionValue));
			if (strpos($prompt, "<default>") !== false) {
				$default = explode("<default>",$prompt);
				$default = explode("</default>",$default[1]);
				$default = $default[0];
			}
			
			$input = Console::promptInput($prompt,$options,$default,false);
			
			self::writeUpdateConfigOption($optionName,$input);
			Console::writeTag("ok","config option ".$optionName." updated...", false, true);
			
		} else if (!isset(self::$options[$optionName]) || (self::$options["overrideConfig"] == "a") || $force) {
			
			// if the option isn't set or the config is always to override update the config
			self::writeUpdateConfigOption($optionName,$optionValue);
			
		} else if (self::$options["overrideConfig"] == "q") {
			
			// standardize the values for comparison
			$currentOption      = self::getOption($optionName);
			$currentOptionValue = $currentOption;
			$newOptionValue     = $optionValue;
			$optionNameOutput   = $optionName;
			
			// dive into plugins to do a proper comparison to
			if ($optionName == "plugins") {
				
				// replace the data in anticipation of it being used
				$optionValue = array_replace_recursive($currentOption, $newOptionValue);
				
				// get the key of the plugin that is being added/updated
				reset($newOptionValue);
				$newOptionKey = key($newOptionValue);
				
				if (!array_key_exists($newOptionKey, $currentOptionValue)) {
					
					// if the key doesn't exist just write out the new config and move on
					self::writeUpdateConfigOption($optionName,$optionValue);
					return;
					
				} else {
					
					// see if the existing configs for the plugin exists. if so just return with no changes
					if ($newOptionValue[$newOptionKey] == $currentOptionValue[$newOptionKey]) {
						return;
					} else {
						$optionNameOutput   = $optionName.".".$newOptionKey;
					}
					
				}
				
			}
			
			if ($currentOptionValue != $newOptionValue) {
				
				// prompt for input
				if (is_array($currentOptionValue)) {
					$prompt  = "update the config option <desc>".$optionNameOutput."</desc> with the value from the package install?";
				} else {
					$prompt  = "update the config option <desc>".$optionNameOutput." (".$currentOptionValue.")</desc> with the value <desc>".$newOptionValue."</desc>?";
				}$options = "Y/n";
				$input   = Console::promptInput($prompt,$options,"Y");
				
				if ($input == "y") {
					
					// update the config option
					self::writeUpdateConfigOption($optionName,$optionValue);
					Console::writeInfo("config option ".$optionNameOutput." updated...", false, true);
					
				} else {
					Console::writeWarning("config option <desc>".$optionNameOutput."</desc> not  updated...", false, true);
				}
				
			}
			
		}
		
	}
public static function updateConfigOption ( $ optionName , $ optionValue , $ force = false ) { if ( is_string ( $ optionValue ) && strpos ( $ optionValue , "<prompt>" ) !== false ) { // prompt for input using the supplied query $ options = "" ; $ default = "" ; $ prompt = str_replace ( "</prompt>" , "" , str_replace ( "<prompt>" , "" , $ optionValue ) ) ; if ( strpos ( $ prompt , "<default>" ) !== false ) { $ default = explode ( "<default>" , $ prompt ) ; $ default = explode ( "</default>" , $ default [ 1 ] ) ; $ default = $ default [ 0 ] ; } $ input = Console :: promptInput ( $ prompt , $ options , $ default , false ) ; self :: writeUpdateConfigOption ( $ optionName , $ input ) ; Console :: writeTag ( "ok" , "config option " . $ optionName . " updated..." , false , true ) ; } else if ( ! isset ( self :: $ options [ $ optionName ] ) || ( self :: $ options [ "overrideConfig" ] == "a" ) || $ force ) { // if the option isn't set or the config is always to override update the config self :: writeUpdateConfigOption ( $ optionName , $ optionValue ) ; } else if ( self :: $ options [ "overrideConfig" ] == "q" ) { // standardize the values for comparison $ currentOption = self :: getOption ( $ optionName ) ; $ currentOptionValue = $ currentOption ; $ newOptionValue = $ optionValue ; $ optionNameOutput = $ optionName ; // dive into plugins to do a proper comparison to if ( $ optionName == "plugins" ) { // replace the data in anticipation of it being used $ optionValue = array_replace_recursive ( $ currentOption , $ newOptionValue ) ; // get the key of the plugin that is being added/updated reset ( $ newOptionValue ) ; $ newOptionKey = key ( $ newOptionValue ) ; if ( ! array_key_exists ( $ newOptionKey , $ currentOptionValue ) ) { // if the key doesn't exist just write out the new config and move on self :: writeUpdateConfigOption ( $ optionName , $ optionValue ) ; return ; } else { // see if the existing configs for the plugin exists. if so just return with no changes if ( $ newOptionValue [ $ newOptionKey ] == $ currentOptionValue [ $ newOptionKey ] ) { return ; } else { $ optionNameOutput = $ optionName . "." . $ newOptionKey ; } } } if ( $ currentOptionValue != $ newOptionValue ) { // prompt for input if ( is_array ( $ currentOptionValue ) ) { $ prompt = "update the config option <desc>" . $ optionNameOutput . "</desc> with the value from the package install?" ; } else { $ prompt = "update the config option <desc>" . $ optionNameOutput . " (" . $ currentOptionValue . ")</desc> with the value <desc>" . $ newOptionValue . "</desc>?" ; } $ options = "Y/n" ; $ input = Console :: promptInput ( $ prompt , $ options , "Y" ) ; if ( $ input == "y" ) { // update the config option self :: writeUpdateConfigOption ( $ optionName , $ optionValue ) ; Console :: writeInfo ( "config option " . $ optionNameOutput . " updated..." , false , true ) ; } else { Console :: writeWarning ( "config option <desc>" . $ optionNameOutput . "</desc> not  updated..." , false , true ) ; } } } }
Update a single config option based on a change in composer.json
@param  {String}       the name of the option to be changed
@param  {String}       the new value of the option to be changed
@param  {Boolean}      whether to force the update of the option
Update a single config option based on a change in composer . json