4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
14 use Psy\Exception\DeprecatedException;
15 use Psy\Exception\RuntimeException;
16 use Psy\ExecutionLoop\ForkingLoop;
17 use Psy\ExecutionLoop\Loop;
18 use Psy\Output\OutputPager;
19 use Psy\Output\ShellOutput;
20 use Psy\Readline\GNUReadline;
21 use Psy\Readline\HoaConsole;
22 use Psy\Readline\Libedit;
23 use Psy\Readline\Readline;
24 use Psy\Readline\Transient;
25 use Psy\TabCompletion\AutoCompleter;
26 use Psy\VarDumper\Presenter;
27 use Psy\VersionUpdater\Checker;
28 use Psy\VersionUpdater\GitHubChecker;
29 use Psy\VersionUpdater\IntervalChecker;
30 use Psy\VersionUpdater\NoopChecker;
34 * The Psy Shell configuration.
38 const COLOR_MODE_AUTO = 'auto';
39 const COLOR_MODE_FORCED = 'forced';
40 const COLOR_MODE_DISABLED = 'disabled';
42 private static $AVAILABLE_OPTIONS = array(
65 'warnOnMultipleConfigs',
68 private $defaultIncludes;
73 /** @var string|false */
76 private $eraseDuplicates;
77 private $manualDbFile;
80 private $useBracketedPaste;
83 private $newCommands = array();
84 private $requireSemicolons = false;
86 private $tabCompletion;
87 private $tabCompletionMatchers = array();
88 private $errorLoggingLevel = E_ALL;
89 private $warnOnMultipleConfigs = false;
92 private $startupMessage;
93 private $forceArrayIndexes = false;
109 * Construct a Configuration instance.
111 * Optionally, supply an array of configuration values to load.
113 * @param array $config Optional array of configuration values
115 public function __construct(array $config = array())
117 $this->setColorMode(self::COLOR_MODE_AUTO);
119 // explicit configFile option
120 if (isset($config['configFile'])) {
121 $this->configFile = $config['configFile'];
122 } elseif ($configFile = getenv('PSYSH_CONFIG')) {
123 $this->configFile = $configFile;
126 // legacy baseDir option
127 if (isset($config['baseDir'])) {
128 $msg = "The 'baseDir' configuration option is deprecated. " .
129 "Please specify 'configDir' and 'dataDir' options instead.";
130 throw new DeprecatedException($msg);
133 unset($config['configFile'], $config['baseDir']);
135 // go go gadget, config!
136 $this->loadConfig($config);
141 * Initialize the configuration.
143 * This checks for the presence of Readline and Pcntl extensions.
145 * If a config file is available, it will be loaded and merged with the current config.
147 * If no custom config file was specified and a local project config file
148 * is available, it will be loaded and merged with the current config.
150 public function init()
153 $this->hasReadline = function_exists('readline');
154 $this->hasPcntl = function_exists('pcntl_signal') && function_exists('posix_getpid');
156 if ($configFile = $this->getConfigFile()) {
157 $this->loadConfigFile($configFile);
160 if (!$this->configFile && $localConfig = $this->getLocalConfigFile()) {
161 $this->loadConfigFile($localConfig);
166 * Get the current PsySH config file.
168 * If a `configFile` option was passed to the Configuration constructor,
169 * this file will be returned. If not, all possible config directories will
170 * be searched, and the first `config.php` or `rc.php` file which exists
173 * If you're trying to decide where to put your config file, pick
175 * ~/.config/psysh/config.php
179 public function getConfigFile()
181 if (isset($this->configFile)) {
182 return $this->configFile;
185 $files = ConfigPaths::getConfigFiles(array('config.php', 'rc.php'), $this->configDir);
187 if (!empty($files)) {
188 if ($this->warnOnMultipleConfigs && count($files) > 1) {
189 $msg = sprintf('Multiple configuration files found: %s. Using %s', implode($files, ', '), $files[0]);
190 trigger_error($msg, E_USER_NOTICE);
198 * Get the local PsySH config file.
200 * Searches for a project specific config file `.psysh.php` in the current
205 public function getLocalConfigFile()
207 $localConfig = getcwd() . '/.psysh.php';
209 if (@is_file($localConfig)) {
215 * Load configuration values from an array of options.
217 * @param array $options
219 public function loadConfig(array $options)
221 foreach (self::$AVAILABLE_OPTIONS as $option) {
222 if (isset($options[$option])) {
223 $method = 'set' . ucfirst($option);
224 $this->$method($options[$option]);
228 foreach (array('commands', 'tabCompletionMatchers', 'casters') as $option) {
229 if (isset($options[$option])) {
230 $method = 'add' . ucfirst($option);
231 $this->$method($options[$option]);
237 * Load a configuration file (default: `$HOME/.config/psysh/config.php`).
239 * This configuration instance will be available to the config file as $config.
240 * The config file may directly manipulate the configuration, or may return
241 * an array of options which will be merged with the current configuration.
243 * @throws \InvalidArgumentException if the config file returns a non-array result
245 * @param string $file
247 public function loadConfigFile($file)
249 $__psysh_config_file__ = $file;
250 $load = function ($config) use ($__psysh_config_file__) {
251 $result = require $__psysh_config_file__;
256 $result = $load($this);
258 if (!empty($result)) {
259 if (is_array($result)) {
260 $this->loadConfig($result);
262 throw new \InvalidArgumentException('Psy Shell configuration must return an array of options');
268 * Set files to be included by default at the start of each shell session.
270 * @param array $includes
272 public function setDefaultIncludes(array $includes = array())
274 $this->defaultIncludes = $includes;
278 * Get files to be included by default at the start of each shell session.
282 public function getDefaultIncludes()
284 return $this->defaultIncludes ?: array();
288 * Set the shell's config directory location.
292 public function setConfigDir($dir)
294 $this->configDir = (string) $dir;
298 * Get the current configuration directory, if any is explicitly set.
302 public function getConfigDir()
304 return $this->configDir;
308 * Set the shell's data directory location.
312 public function setDataDir($dir)
314 $this->dataDir = (string) $dir;
318 * Get the current data directory, if any is explicitly set.
322 public function getDataDir()
324 return $this->dataDir;
328 * Set the shell's temporary directory location.
332 public function setRuntimeDir($dir)
334 $this->runtimeDir = (string) $dir;
338 * Get the shell's temporary directory location.
340 * Defaults to `/psysh` inside the system's temp dir unless explicitly
345 public function getRuntimeDir()
347 if (!isset($this->runtimeDir)) {
348 $this->runtimeDir = ConfigPaths::getRuntimeDir();
351 if (!is_dir($this->runtimeDir)) {
352 mkdir($this->runtimeDir, 0700, true);
355 return $this->runtimeDir;
359 * Set the readline history file path.
361 * @param string $file
363 public function setHistoryFile($file)
365 $this->historyFile = ConfigPaths::touchFileWithMkdir($file);
369 * Get the readline history file path.
371 * Defaults to `/history` inside the shell's base config dir unless
372 * explicitly overridden.
376 public function getHistoryFile()
378 if (isset($this->historyFile)) {
379 return $this->historyFile;
382 // Deprecation warning for incorrect psysh_history path.
383 // @todo remove this before v0.9.0
385 $oldHistory = $xdg->getHomeConfigDir() . '/psysh_history';
386 if (@is_file($oldHistory)) {
387 $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir();
388 $newHistory = $dir . '/psysh_history';
391 "PsySH history file found at '%s'. Please delete it or move it to '%s'.",
392 strtr($oldHistory, '\\', '/'),
395 @trigger_error($msg, E_USER_DEPRECATED);
396 $this->setHistoryFile($oldHistory);
398 return $this->historyFile;
401 $files = ConfigPaths::getConfigFiles(array('psysh_history', 'history'), $this->configDir);
403 if (!empty($files)) {
404 if ($this->warnOnMultipleConfigs && count($files) > 1) {
405 $msg = sprintf('Multiple history files found: %s. Using %s', implode($files, ', '), $files[0]);
406 trigger_error($msg, E_USER_NOTICE);
409 $this->setHistoryFile($files[0]);
411 // fallback: create our own history file
412 $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir();
413 $this->setHistoryFile($dir . '/psysh_history');
416 return $this->historyFile;
420 * Set the readline max history size.
424 public function setHistorySize($value)
426 $this->historySize = (int) $value;
430 * Get the readline max history size.
434 public function getHistorySize()
436 return $this->historySize;
440 * Sets whether readline erases old duplicate history entries.
444 public function setEraseDuplicates($value)
446 $this->eraseDuplicates = (bool) $value;
450 * Get whether readline erases old duplicate history entries.
454 public function getEraseDuplicates()
456 return $this->eraseDuplicates;
460 * Get a temporary file of type $type for process $pid.
462 * The file will be created inside the current temporary directory.
464 * @see self::getRuntimeDir
466 * @param string $type
469 * @return string Temporary file name
471 public function getTempFile($type, $pid)
473 return tempnam($this->getRuntimeDir(), $type . '_' . $pid . '_');
477 * Get a filename suitable for a FIFO pipe of $type for process $pid.
479 * The pipe will be created inside the current temporary directory.
481 * @param string $type
484 * @return string Pipe name
486 public function getPipe($type, $pid)
488 return sprintf('%s/%s_%s', $this->getRuntimeDir(), $type, $pid);
492 * Check whether this PHP instance has Readline available.
494 * @return bool True if Readline is available
496 public function hasReadline()
498 return $this->hasReadline;
502 * Enable or disable Readline usage.
504 * @param bool $useReadline
506 public function setUseReadline($useReadline)
508 $this->useReadline = (bool) $useReadline;
512 * Check whether to use Readline.
514 * If `setUseReadline` as been set to true, but Readline is not actually
515 * available, this will return false.
517 * @return bool True if the current Shell should use Readline
519 public function useReadline()
521 return isset($this->useReadline) ? ($this->hasReadline && $this->useReadline) : $this->hasReadline;
525 * Set the Psy Shell readline service.
527 * @param Readline $readline
529 public function setReadline(Readline $readline)
531 $this->readline = $readline;
535 * Get the Psy Shell readline service.
537 * By default, this service uses (in order of preference):
541 * * A transient array-based readline emulation.
545 public function getReadline()
547 if (!isset($this->readline)) {
548 $className = $this->getReadlineClass();
549 $this->readline = new $className(
550 $this->getHistoryFile(),
551 $this->getHistorySize(),
552 $this->getEraseDuplicates()
556 return $this->readline;
560 * Get the appropriate Readline implementation class name.
562 * @see self::getReadline
566 private function getReadlineClass()
568 if ($this->useReadline()) {
569 if (GNUReadline::isSupported()) {
570 return 'Psy\Readline\GNUReadline';
571 } elseif (Libedit::isSupported()) {
572 return 'Psy\Readline\Libedit';
573 } elseif (HoaConsole::isSupported()) {
574 return 'Psy\Readline\HoaConsole';
578 return 'Psy\Readline\Transient';
582 * Enable or disable bracketed paste.
584 * Note that this only works with readline (not libedit) integration for now.
586 * @param bool $useBracketedPaste
588 public function setUseBracketedPaste($useBracketedPaste)
590 $this->useBracketedPaste = (bool) $useBracketedPaste;
594 * Check whether to use bracketed paste with readline.
596 * When this works, it's magical. Tabs in pastes don't try to autcomplete.
597 * Newlines in paste don't execute code until you get to the end. It makes
598 * readline act like you'd expect when pasting.
600 * But it often (usually?) does not work. And when it doesn't, it just spews
601 * escape codes all over the place and generally makes things ugly :(
603 * If `useBracketedPaste` has been set to true, but the current readline
604 * implementation is anything besides GNU readline, this will return false.
606 * @return bool True if the shell should use bracketed paste
608 public function useBracketedPaste()
610 // For now, only the GNU readline implementation supports bracketed paste.
611 $supported = ($this->getReadlineClass() === 'Psy\Readline\GNUReadline');
613 return $supported && $this->useBracketedPaste;
615 // @todo mebbe turn this on by default some day?
616 // return isset($this->useBracketedPaste) ? ($supported && $this->useBracketedPaste) : $supported;
620 * Check whether this PHP instance has Pcntl available.
622 * @return bool True if Pcntl is available
624 public function hasPcntl()
626 return $this->hasPcntl;
630 * Enable or disable Pcntl usage.
632 * @param bool $usePcntl
634 public function setUsePcntl($usePcntl)
636 $this->usePcntl = (bool) $usePcntl;
640 * Check whether to use Pcntl.
642 * If `setUsePcntl` has been set to true, but Pcntl is not actually
643 * available, this will return false.
645 * @return bool True if the current Shell should use Pcntl
647 public function usePcntl()
649 return isset($this->usePcntl) ? ($this->hasPcntl && $this->usePcntl) : $this->hasPcntl;
653 * Enable or disable strict requirement of semicolons.
655 * @see self::requireSemicolons()
657 * @param bool $requireSemicolons
659 public function setRequireSemicolons($requireSemicolons)
661 $this->requireSemicolons = (bool) $requireSemicolons;
665 * Check whether to require semicolons on all statements.
667 * By default, PsySH will automatically insert semicolons at the end of
668 * statements if they're missing. To strictly require semicolons, set
669 * `requireSemicolons` to true.
673 public function requireSemicolons()
675 return $this->requireSemicolons;
679 * Enable or disable Unicode in PsySH specific output.
681 * Note that this does not disable Unicode output in general, it just makes
682 * it so PsySH won't output any itself.
684 * @param bool $useUnicode
686 public function setUseUnicode($useUnicode)
688 $this->useUnicode = (bool) $useUnicode;
692 * Check whether to use Unicode in PsySH specific output.
694 * Note that this does not disable Unicode output in general, it just makes
695 * it so PsySH won't output any itself.
699 public function useUnicode()
701 if (isset($this->useUnicode)) {
702 return $this->useUnicode;
705 // @todo detect `chsh` != 65001 on Windows and return false
710 * Set the error logging level.
712 * @see self::errorLoggingLevel
714 * @param bool $errorLoggingLevel
716 public function setErrorLoggingLevel($errorLoggingLevel)
718 $this->errorLoggingLevel = (E_ALL | E_STRICT) & $errorLoggingLevel;
722 * Get the current error logging level.
724 * By default, PsySH will automatically log all errors, regardless of the
725 * current `error_reporting` level. Additionally, if the `error_reporting`
726 * level warrants, an ErrorException will be thrown.
728 * Set `errorLoggingLevel` to 0 to prevent logging non-thrown errors. Set it
729 * to any valid error_reporting value to log only errors which match that
732 * http://php.net/manual/en/function.error-reporting.php
736 public function errorLoggingLevel()
738 return $this->errorLoggingLevel;
742 * Set a CodeCleaner service instance.
744 * @param CodeCleaner $cleaner
746 public function setCodeCleaner(CodeCleaner $cleaner)
748 $this->cleaner = $cleaner;
752 * Get a CodeCleaner service instance.
754 * If none has been explicitly defined, this will create a new instance.
756 * @return CodeCleaner
758 public function getCodeCleaner()
760 if (!isset($this->cleaner)) {
761 $this->cleaner = new CodeCleaner();
764 return $this->cleaner;
768 * Enable or disable tab completion.
770 * @param bool $tabCompletion
772 public function setTabCompletion($tabCompletion)
774 $this->tabCompletion = (bool) $tabCompletion;
778 * Check whether to use tab completion.
780 * If `setTabCompletion` has been set to true, but readline is not actually
781 * available, this will return false.
783 * @return bool True if the current Shell should use tab completion
785 public function getTabCompletion()
787 return isset($this->tabCompletion) ? ($this->hasReadline && $this->tabCompletion) : $this->hasReadline;
791 * Set the Shell Output service.
793 * @param ShellOutput $output
795 public function setOutput(ShellOutput $output)
797 $this->output = $output;
801 * Get a Shell Output service instance.
803 * If none has been explicitly provided, this will create a new instance
804 * with VERBOSITY_NORMAL and the output page supplied by self::getPager
806 * @see self::getPager
808 * @return ShellOutput
810 public function getOutput()
812 if (!isset($this->output)) {
813 $this->output = new ShellOutput(
814 ShellOutput::VERBOSITY_NORMAL,
815 $this->getOutputDecorated(),
821 return $this->output;
825 * Get the decoration (i.e. color) setting for the Shell Output service.
827 * @return null|bool 3-state boolean corresponding to the current color mode
829 public function getOutputDecorated()
831 if ($this->colorMode() === self::COLOR_MODE_AUTO) {
833 } elseif ($this->colorMode() === self::COLOR_MODE_FORCED) {
835 } elseif ($this->colorMode() === self::COLOR_MODE_DISABLED) {
841 * Set the OutputPager service.
843 * If a string is supplied, a ProcOutputPager will be used which shells out
844 * to the specified command.
846 * @throws \InvalidArgumentException if $pager is not a string or OutputPager instance
848 * @param string|OutputPager $pager
850 public function setPager($pager)
852 if ($pager && !is_string($pager) && !$pager instanceof OutputPager) {
853 throw new \InvalidArgumentException('Unexpected pager instance.');
856 $this->pager = $pager;
860 * Get an OutputPager instance or a command for an external Proc pager.
862 * If no Pager has been explicitly provided, and Pcntl is available, this
863 * will default to `cli.pager` ini value, falling back to `which less`.
865 * @return string|OutputPager
867 public function getPager()
869 if (!isset($this->pager) && $this->usePcntl()) {
870 if ($pager = ini_get('cli.pager')) {
871 // use the default pager (5.4+)
872 $this->pager = $pager;
873 } elseif ($less = exec('which less 2>/dev/null')) {
874 // check for the presence of less...
875 $this->pager = $less . ' -R -S -F -X';
883 * Set the Shell evaluation Loop service.
887 public function setLoop(Loop $loop)
893 * Get a Shell evaluation Loop service instance.
895 * If none has been explicitly defined, this will create a new instance.
896 * If Pcntl is available and enabled, the new instance will be a ForkingLoop.
900 public function getLoop()
902 if (!isset($this->loop)) {
903 if ($this->usePcntl()) {
904 $this->loop = new ForkingLoop($this);
906 $this->loop = new Loop($this);
914 * Set the Shell autocompleter service.
916 * @param AutoCompleter $completer
918 public function setAutoCompleter(AutoCompleter $completer)
920 $this->completer = $completer;
924 * Get an AutoCompleter service instance.
926 * @return AutoCompleter
928 public function getAutoCompleter()
930 if (!isset($this->completer)) {
931 $this->completer = new AutoCompleter();
934 return $this->completer;
938 * Get user specified tab completion matchers for the AutoCompleter.
942 public function getTabCompletionMatchers()
944 return $this->tabCompletionMatchers;
948 * Add additional tab completion matchers to the AutoCompleter.
950 * @param array $matchers
952 public function addTabCompletionMatchers(array $matchers)
954 $this->tabCompletionMatchers = array_merge($this->tabCompletionMatchers, $matchers);
955 if (isset($this->shell)) {
956 $this->shell->addTabCompletionMatchers($this->tabCompletionMatchers);
961 * Add commands to the Shell.
963 * This will buffer new commands in the event that the Shell has not yet
964 * been instantiated. This allows the user to specify commands in their
965 * config rc file, despite the fact that their file is needed in the Shell
968 * @param array $commands
970 public function addCommands(array $commands)
972 $this->newCommands = array_merge($this->newCommands, $commands);
973 if (isset($this->shell)) {
974 $this->doAddCommands();
979 * Internal method for adding commands. This will set any new commands once
980 * a Shell is available.
982 private function doAddCommands()
984 if (!empty($this->newCommands)) {
985 $this->shell->addCommands($this->newCommands);
986 $this->newCommands = array();
991 * Set the Shell backreference and add any new commands to the Shell.
993 * @param Shell $shell
995 public function setShell(Shell $shell)
997 $this->shell = $shell;
998 $this->doAddCommands();
1002 * Set the PHP manual database file.
1004 * This file should be an SQLite database generated from the phpdoc source
1005 * with the `bin/build_manual` script.
1007 * @param string $filename
1009 public function setManualDbFile($filename)
1011 $this->manualDbFile = (string) $filename;
1015 * Get the current PHP manual database file.
1017 * @return string Default: '~/.local/share/psysh/php_manual.sqlite'
1019 public function getManualDbFile()
1021 if (isset($this->manualDbFile)) {
1022 return $this->manualDbFile;
1025 $files = ConfigPaths::getDataFiles(array('php_manual.sqlite'), $this->dataDir);
1026 if (!empty($files)) {
1027 if ($this->warnOnMultipleConfigs && count($files) > 1) {
1028 $msg = sprintf('Multiple manual database files found: %s. Using %s', implode($files, ', '), $files[0]);
1029 trigger_error($msg, E_USER_NOTICE);
1032 return $this->manualDbFile = $files[0];
1037 * Get a PHP manual database connection.
1041 public function getManualDb()
1043 if (!isset($this->manualDb)) {
1044 $dbFile = $this->getManualDbFile();
1045 if (is_file($dbFile)) {
1047 $this->manualDb = new \PDO('sqlite:' . $dbFile);
1048 } catch (\PDOException $e) {
1049 if ($e->getMessage() === 'could not find driver') {
1050 throw new RuntimeException('SQLite PDO driver not found', 0, $e);
1058 return $this->manualDb;
1062 * Add an array of casters definitions.
1064 * @param array $casters
1066 public function addCasters(array $casters)
1068 $this->getPresenter()->addCasters($casters);
1072 * Get the Presenter service.
1076 public function getPresenter()
1078 if (!isset($this->presenter)) {
1079 $this->presenter = new Presenter($this->getOutput()->getFormatter(), $this->forceArrayIndexes());
1082 return $this->presenter;
1086 * Enable or disable warnings on multiple configuration or data files.
1088 * @see self::warnOnMultipleConfigs()
1090 * @param bool $warnOnMultipleConfigs
1092 public function setWarnOnMultipleConfigs($warnOnMultipleConfigs)
1094 $this->warnOnMultipleConfigs = (bool) $warnOnMultipleConfigs;
1098 * Check whether to warn on multiple configuration or data files.
1100 * By default, PsySH will use the file with highest precedence, and will
1101 * silently ignore all others. With this enabled, a warning will be emitted
1102 * (but not an exception thrown) if multiple configuration or data files
1105 * This will default to true in a future release, but is false for now.
1109 public function warnOnMultipleConfigs()
1111 return $this->warnOnMultipleConfigs;
1115 * Set the current color mode.
1117 * @param string $colorMode
1119 public function setColorMode($colorMode)
1121 $validColorModes = array(
1122 self::COLOR_MODE_AUTO,
1123 self::COLOR_MODE_FORCED,
1124 self::COLOR_MODE_DISABLED,
1127 if (in_array($colorMode, $validColorModes)) {
1128 $this->colorMode = $colorMode;
1130 throw new \InvalidArgumentException('invalid color mode: ' . $colorMode);
1135 * Get the current color mode.
1139 public function colorMode()
1141 return $this->colorMode;
1145 * Set an update checker service instance.
1147 * @param Checker $checker
1149 public function setChecker(Checker $checker)
1151 $this->checker = $checker;
1155 * Get an update checker service instance.
1157 * If none has been explicitly defined, this will create a new instance.
1161 public function getChecker()
1163 if (!isset($this->checker)) {
1164 $interval = $this->getUpdateCheck();
1165 switch ($interval) {
1166 case Checker::ALWAYS:
1167 $this->checker = new GitHubChecker();
1170 case Checker::DAILY:
1171 case Checker::WEEKLY:
1172 case Checker::MONTHLY:
1173 $checkFile = $this->getUpdateCheckCacheFile();
1174 if ($checkFile === false) {
1175 $this->checker = new NoopChecker();
1177 $this->checker = new IntervalChecker($checkFile, $interval);
1181 case Checker::NEVER:
1182 $this->checker = new NoopChecker();
1187 return $this->checker;
1191 * Get the current update check interval.
1193 * One of 'always', 'daily', 'weekly', 'monthly' or 'never'. If none is
1194 * explicitly set, default to 'weekly'.
1198 public function getUpdateCheck()
1200 return isset($this->updateCheck) ? $this->updateCheck : Checker::WEEKLY;
1204 * Set the update check interval.
1206 * @throws \InvalidArgumentDescription if the update check interval is unknown
1208 * @param string $interval
1210 public function setUpdateCheck($interval)
1212 $validIntervals = array(
1220 if (!in_array($interval, $validIntervals)) {
1221 throw new \InvalidArgumentException('invalid update check interval: ' . $interval);
1224 $this->updateCheck = $interval;
1228 * Get a cache file path for the update checker.
1230 * @return string|false Return false if config file/directory is not writable
1232 public function getUpdateCheckCacheFile()
1234 $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir();
1236 return ConfigPaths::touchFileWithMkdir($dir . '/update_check.json');
1240 * Set the startup message.
1242 * @param string $message
1244 public function setStartupMessage($message)
1246 $this->startupMessage = $message;
1250 * Get the startup message.
1252 * @return string|null
1254 public function getStartupMessage()
1256 return $this->startupMessage;
1262 * @param string $prompt
1264 public function setPrompt($prompt)
1266 $this->prompt = $prompt;
1274 public function getPrompt()
1276 return $this->prompt;
1280 * Get the force array indexes.
1284 public function forceArrayIndexes()
1286 return $this->forceArrayIndexes;
1290 * Set the force array indexes.
1292 * @param bool $forceArrayIndexes
1294 public function setForceArrayIndexes($forceArrayIndexes)
1296 $this->forceArrayIndexes = $forceArrayIndexes;