4 class Config extends \Consolidation\Config\Config implements GlobalOptionDefaultValuesInterface
6 const PROGRESS_BAR_AUTO_DISPLAY_INTERVAL = 'options.progress-delay';
7 const DEFAULT_PROGRESS_DELAY = 2;
8 const SIMULATE = 'options.simulate';
10 // Read-only configuration properties; changing these has no effect.
11 const INTERACTIVE = 'options.interactive';
12 const DECORATED = 'options.decorated';
15 * Create a new configuration object, and initialize it with
16 * the provided nested array containing configuration data.
18 public function __construct(array $data = null)
20 parent::__construct($data);
21 $this->defaults = $this->getGlobalOptionDefaultValues();
25 * Return an associative array containing all of the global configuration
26 * options and their default values.
30 public function getGlobalOptionDefaultValues()
34 self::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL => self::DEFAULT_PROGRESS_DELAY,
35 self::SIMULATE => false,
37 return $this->trimPrefixFromGlobalOptions($globalOptions);
41 * Remove the 'options.' prefix from the global options list.
43 protected function trimPrefixFromGlobalOptions($globalOptions)
46 foreach ($globalOptions as $option => $value) {
47 $option = str_replace('options.', '', $option);
48 $result[$option] = $value;
54 * @deprecated Use $config->get(Config::SIMULATE)
58 public function isSimulated()
60 return $this->get(self::SIMULATE);
64 * @deprecated Use $config->set(Config::SIMULATE, true)
66 * @param bool $simulated
70 public function setSimulated($simulated = true)
72 return $this->set(self::SIMULATE, $simulated);
76 * @deprecated Use $config->get(Config::INTERACTIVE)
80 public function isInteractive()
82 return $this->get(self::INTERACTIVE);
86 * @deprecated Use $config->set(Config::INTERACTIVE, true)
88 * @param bool $interactive
92 public function setInteractive($interactive = true)
94 return $this->set(self::INTERACTIVE, $interactive);
98 * @deprecated Use $config->get(Config::DECORATED)
102 public function isDecorated()
104 return $this->get(self::DECORATED);
108 * @deprecated Use $config->set(Config::DECORATED, true)
110 * @param bool $decorated
114 public function setDecorated($decorated = true)
116 return $this->set(self::DECORATED, $decorated);
120 * @deprecated Use $config->set(Config::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL, $interval)
122 * @param int $interval
126 public function setProgressBarAutoDisplayInterval($interval)
128 return $this->set(self::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL, $interval);