Skip to content
docsv0.3.0

JsonFileTuiStateManager

Session persistence backed by a single JSON file. Survives a restart of the program, not a crash mid-write: every save rewrites the whole document, and a failed write leaves the previous session intact rather than a partial one.

JsonFileTuiStateManager::__construct()

public function __construct(string $path):

Parameters

Parameters of __construct()
NameTypeDescription
$pathstring

JsonFileTuiStateManager::loadState()

public function loadState(): array|false

Reads the persisted session, or false when there is none or it is unreadable.

JsonFileTuiStateManager::saveState()

public function saveState(array $state): bool

Persists the session, returning whether the write succeeded.

Parameters

Parameters of saveState()
NameTypeDescription
$statearray

JsonFileTuiStateManager::clearSession()

public function clearSession(): void

Discards the persisted session, leaving no file behind.