Memory Helper

This helper will streamline memory storage using key-value multidimensional array. It is used primarily to build, store and run an in-memory queue of commands and its output messages.

Model Helper is "macroable", which allows you to add additional methods to the MemoryHelper class at run time.

Get

/**
 * Collect global storage array by key
 * @param string $key
 * @return Collection
 */

MemoryHelper::get(): void

Update

/**
 * Update in-memory array
 * @return Memory
 */

MemoryHelper::update(): void

Set

/**
 * Replace all data in keyed array
 * @param string $key
 * @param string|array $data
 * @return Memory
 */

MemoryHelper::set(): void

Push

/**
 * Push data to keyed array
 * @param string $key
 * @param string|array $data
 * @return Memory
 */

MemoryHelper::push(): void

Put

/**
 * Put data in keyed array using name as a second-level key
 * @param string $key
 * @param string $name
 * @param string|array $data
 * @return Memory
 */

MemoryHelper::put(): void

Add Message

/**
 * Add message to in-memory storage of messages
 * @param string $message
 * @param string $type
 * @return Memory
 */

MemoryHelper::addMessage(): void

Add Command

/**
 * Add command to in-memory queue of commands
 * @param string $command
 * @param array $arguments
 * @return Memory
 */

MemoryHelper::addCommand(): void

Run Commands

/**
 * Run all commands that are in in-memory queue
 */

MemoryHelper::runCommands(): void

Delete

/**
 * Remove keyed array from in-memory storage
 * @param string $key
 * @return Memory
 */

MemoryHelper::delete(): void

Delete All

/**
 * Delete all data from in-memory storage, emptying all storage
 * @return Memory
 */

MemoryHelper::deleteAll(): void

Start a Chain

/**
 * Start an in-memory chain or add item to it
 * @param string $uuid
 */

MemoryHelper::startChain(): void

End a Chain

/**
 * End in-memory chain of commands, if uuid is the same that started a chain.
 * Run all commands from queue and return collection of messages.
 * @param string $uuid
 * @return bool|Collection
 */

MemoryHelper::endChain(): void