class Task extends Prompt

Traits

Track bounded incremental output owned by a Task operation.

Constants

protected OUTPUT_CONTEXT_KEY

Context key for the output instance override.

protected VALIDATE_USING_CONTEXT_KEY

Context key for the custom validation callback override.

protected LOGGER_WRITE_TIMEOUT_SECONDS

How long a Logger write may make no progress.

This must remain well above the public render interval.

protected RENDERER_SETTLEMENT_MARGIN_MILLISECONDS

Scheduling margin added to one complete renderer frame interval.

Reset can arrive while the renderer is sleeping between frames.

protected RENDERER_ACKNOWLEDGEMENT

The raw reverse-channel acknowledgement byte.

Parent-to-renderer messages use TaskFrame; this single byte travels in the opposite direction only after the renderer has settled completely.

Properties

static protected bool $cursorHidden

Indicates if the cursor has been hidden.

from  Cursor
protected Closure>> $listeners

The registered event listeners.

from  Events
static protected bool $shouldFallback

Whether to fallback to a custom implementation.

from  Fallback
static protected array<class-string, Closure(static): mixed> $fallbacks

The fallback implementations.

from  Fallback
static protected bool|null $interactive

Whether to render the prompt interactively.

from  Interactivity
static protected string $theme

The name of the active theme.

from  Themes
static protected Prompt>, class-string<callable&object>>> $themes

The available themes.

from  Themes
string $state

The current state of the prompt.

from  Prompt
string $error

The error message from the validator.

from  Prompt
string $cancelMessage

The cancel message displayed when this prompt is cancelled.

from  Prompt
protected string $prevFrame

The previously rendered frame.

from  Prompt
protected int $newLinesWritten

How many new lines were written by the last output.

from  Prompt
bool|string $required

Whether user input is required.

from  Prompt
Closure|null $transform

The transformation callback.

from  Prompt
mixed $validate

The validator callback or rules.

from  Prompt
static protected Closure|null $cancelUsing

The cancellation callback.

from  Prompt
protected bool $validated

Indicates if the prompt has been validated.

from  Prompt
protected bool $terminalStateRestored

Indicates whether this prompt's terminal state has been restored.

from  Prompt
static protected Closure|null $validateUsing

The custom validation callback.

from  Prompt
static protected Closure|null $revertUsing

The revert handler from the StepBuilder.

from  Prompt
static protected OutputInterface|null $output

The output instance.

from  Prompt
static protected Terminal|null $terminal

The terminal instance.

from  Prompt
protected int|null $partialStartIndex

The log index where the current partial started, or null if not streaming.

from  TracksTaskOutput
protected int $minWidth

The minimum width for the longest line calculation.

int $interval

How long to wait between rendering each frame.

int $count

The number of times the task has been rendered.

bool $static

Whether the task can only be rendered once.

protected int|null $pid

The process ID after forking.

protected null|resource $socket

The socket for IPC communication.

protected mixed $originalSignalHandler

The signal handler replaced by the process renderer.

protected bool|null $originalAsync

The async-signal mode replaced by the process renderer.

array<int, string> $logs

Pre-wrapped log lines for the scrolling output area.

list<array{type: string, message: string}> $stableMessages

Stable status messages (success, warning, error).

int $maxStableMessages

The maximum number of stable messages to display.

string $identifier

The identifier retained for Laravel-compatible Task and Logger extension state.

bool $finished

Whether the task has finished.

Methods

string
reset(string $text)

Reset all colors and styles.

from  Colors
string
bold(string $text)

Make the text bold.

from  Colors
string
dim(string $text)

Make the text dim.

from  Colors
string
italic(string $text)

Make the text italic.

from  Colors
string
underline(string $text)

Underline the text.

from  Colors
string
inverse(string $text)

Invert the text and background colors.

from  Colors
string
hidden(string $text)

Hide the text.

from  Colors
string
strikethrough(string $text)

Strike through the text.

from  Colors
string
black(string $text)

Set the text color to black.

from  Colors
string
red(string $text)

Set the text color to red.

from  Colors
string
green(string $text)

Set the text color to green.

from  Colors
string
yellow(string $text)

Set the text color to yellow.

from  Colors
string
blue(string $text)

Set the text color to blue.

from  Colors
string
magenta(string $text)

Set the text color to magenta.

from  Colors
string
cyan(string $text)

Set the text color to cyan.

from  Colors
string
white(string $text)

Set the text color to white.

from  Colors
string
bgBlack(string $text)

Set the text background to black.

from  Colors
string
bgRed(string $text)

Set the text background to red.

from  Colors
string
bgGreen(string $text)

Set the text background to green.

from  Colors
string
bgYellow(string $text)

Set the text background to yellow.

from  Colors
string
bgBlue(string $text)

Set the text background to blue.

from  Colors
string
bgMagenta(string $text)

Set the text background to magenta.

from  Colors
string
bgCyan(string $text)

Set the text background to cyan.

from  Colors
string
bgWhite(string $text)

Set the text background to white.

from  Colors
string
gray(string $text)

Set the text color to gray.

from  Colors
void
hideCursor()

Hide the cursor.

from  Cursor
void
showCursor()

Show the cursor.

from  Cursor
void
restoreCursor()

Restore the cursor if it was hidden.

from  Cursor
void
moveCursor(int $x, int $y = 0)

Move the cursor.

from  Cursor
void
moveCursorToColumn(int $column)

Move the cursor to the given column.

from  Cursor
void
moveCursorUp(int $lines)

Move the cursor up by the given number of lines.

from  Cursor
static void
resetCursor()

Reset cursor state to defaults.

from  Cursor
void
eraseLines(int $count)

Erase the given number of lines downwards from the cursor position.

from  Erase
void
eraseDown()

Erase from cursor until end of screen.

from  Erase
void
on(string $event, Closure $callback)

Register an event listener.

from  Events
void
emit(string $event, mixed ...$data)

Emit an event.

from  Events
void
clearListeners()

Clean the event listeners.

from  Events
static void
fake(array $keys = [])

Fake the terminal and queue key presses to be simulated.

static void
fakeKeyPresses(array $keys, callable $callable)

Implementation of the looping mechanism for simulating key presses.

static void
assertOutputContains(string $string)

Assert that the output contains the given string.

static void
assertOutputDoesntContain(string $string)

Assert that the output doesn't contain the given string.

static void
assertStrippedOutputContains(string $string)

Assert that the stripped output contains the given string.

static void
assertStrippedOutputDoesntContain(string $string)

Assert that the stripped output doesn't contain the given string.

static string
content()

Get the buffered console output.

static string
strippedContent()

Get the buffered console output, stripped of escape sequences.

static void
fallbackWhen(bool $condition)

Enable the fallback implementation.

from  Fallback
static bool
shouldFallback()

Whether the prompt should fallback to a custom implementation.

from  Fallback
static void
fallbackUsing(Closure $fallback)

Set the fallback implementation.

from  Fallback
mixed
fallback()

Call the registered fallback implementation.

from  Fallback
static void
resetFallback()

Reset fallback state to defaults.

from  Fallback
static void
interactive(bool $interactive = true)

Set interactive mode.

static bool|null
isInteractive()

Determine if the prompt is interactive.

static void
resetInteractivity()

Reset interactivity state to defaults.

mixed
default()

Return the default value if it passes validation.

static string
theme(string|null $name = null)

Get or set the active theme.

from  Themes
static void
addTheme(string $name, array $renderers)

Add a new theme.

from  Themes
callable
getRenderer()

Get the renderer for the current prompt.

from  Themes
string
renderTheme()

Render the prompt using the active theme.

from  Themes
static void
resetTheme()

Reset theme state to defaults.

from  Themes
mixed
value()

Get the current value of the prompt.

string|null
validateIntrinsic(mixed $value)

Validate rules intrinsic to the prompt type.

from  Prompt
mixed
prompt()

Disable prompting for input.

mixed
runLoop(callable $callable)

Implementation of the prompt looping mechanism.

from  Prompt
static void
cancelUsing(Closure|null $callback)

Register a callback to be invoked when a user cancels a prompt.

from  Prompt
int
newLinesWritten()

How many new lines were written by the last output.

from  Prompt
void
capturePreviousNewLines()

Capture the number of new lines written by the last output.

from  Prompt
static void
setOutput(OutputInterface $output)

Set the output instance.

from  Prompt
static OutputInterface
output()

Get the current output instance.

from  Prompt
static void
writeDirectly(string $message)

Write output directly, bypassing newline capture.

from  Prompt
static Terminal
terminal()

Get the terminal instance.

from  Prompt
void
restoreTerminalState()

Restore terminal state changed by the prompt operation.

from  Prompt
static void
validateUsing(Closure $callback)

Set the custom validation callback.

from  Prompt
static Closure|null
getValidateUsing()

Get the custom validation callback.

from  Prompt
static void
revertUsing(Closure $callback)

Revert the prompt using the given callback.

from  Prompt
static void
preventReverting()

Clear any previous revert callback.

from  Prompt
void
render()

Render the prompt.

from  Prompt
void
submit()

Submit the prompt.

from  Prompt
mixed
transformedValue()

Get the transformed value of the prompt.

from  Prompt
bool
isInvalidWhenRequired(mixed $value)

Determine whether the given value is invalid when the prompt is required.

from  Prompt
static void
flushState()

Flush all static state.

from  Prompt
__destruct()

Clean up after the task.

int
longest(array $lines, int $padding = 0)

Get the length of the longest line.

string
pad(string $text, int $length, string $char = ' ')

Pad text ignoring ANSI escape sequences.

string
replaceLastVisibleGrapheme(string $line, string $replacement)

Replace the last visible grapheme while preserving trailing formatting.

string
stripEscapeSequences(string $text)

Strip ANSI escape sequences from the given text.

string
mbWordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false)

Multi-byte version of wordwrap.

array
ansiWordwrap(string $text, int $width, bool $cutLongWords = false)

Word wrap text while preserving ANSI escape sequences.

array
parseAnsiText(string $text)

Parse text into segments with their associated ANSI codes.

void
updateSgrState(array $activeSgr, string $escape)

Update the bounded set of active SGR attributes.

void
addLogLines(string $line)

Add a complete logical log message.

void
replacePartialLines(string $text)

Replace the in-progress partial with a complete supplied prefix.

__construct(string $label = '', int $limit = 10, bool $keepSummary = false, string|null $subLabel = null)

Create a new Task instance.

mixed
run(Closure $callback)

Render the task and execute the callback.

void
receiveMessages(resource $socket)

Receive and process messages from the parent process.

void
applyMessage(string|null $type, string $payload)

Apply one decoded Task message.

void
recalculateMaxStableMessages()

Recompute the stable-message budget based on the current sub-label state.

void
trimStableMessages()

Trim stable messages to the current display budget.

void
resetOperationState()

Reset state owned by one task operation.

bool
shouldKeepSummary()

Determine whether the final task summary should remain visible.

void
finishRendering(bool $renderFinalFrame = false, bool $success = true)

Finish rendering the task and clear it unless the summary should remain.

void
resetTerminal(bool $originalAsync, bool $success = true)

Reset the terminal after process rendering.

void
printCompletionLine()

Print a single-line completion indicator after the task has finished.

mixed
renderInProcess(Closure $callback)

Render the task using a child process for the animation loop.

array|false
createSocketPair()

Create the process renderer socket pair.

int
forkProcess()

Fork the process renderer.

never
runRendererProcess(resource $socket)

Run the child process renderer.

void
captureSignalState()

Capture and replace the process renderer's signal state.

void
restoreSignalState()

Restore signal state replaced by the process renderer.

bool
awaitRendererClosure()

Wait for the child renderer to close its socket.

void
closeSocket()

Close the parent process socket.

void
terminateRenderer()

Terminate the owned child renderer.

reapRenderer(bool $requireSuccess, bool $acknowledged = false)

Reap the owned child renderer.

mixed
renderStatically(Closure $callback)

Render a static version of the task.

mixed
renderInCoroutine(Closure $callback)

Render the task using a coroutine for the animation loop.

void
eraseRenderedLines()

Clear the lines rendered by the task.

Details

in Colors at line 12
string reset(string $text)

Reset all colors and styles.

Parameters

string $text

Return Value

string

in Colors at line 20
string bold(string $text)

Make the text bold.

Parameters

string $text

Return Value

string

in Colors at line 28
string dim(string $text)

Make the text dim.

Parameters

string $text

Return Value

string

in Colors at line 36
string italic(string $text)

Make the text italic.

Parameters

string $text

Return Value

string

in Colors at line 44
string underline(string $text)

Underline the text.

Parameters

string $text

Return Value

string

in Colors at line 52
string inverse(string $text)

Invert the text and background colors.

Parameters

string $text

Return Value

string

in Colors at line 60
string hidden(string $text)

Hide the text.

Parameters

string $text

Return Value

string

in Colors at line 68
string strikethrough(string $text)

Strike through the text.

Parameters

string $text

Return Value

string

in Colors at line 76
string black(string $text)

Set the text color to black.

Parameters

string $text

Return Value

string

in Colors at line 84
string red(string $text)

Set the text color to red.

Parameters

string $text

Return Value

string

in Colors at line 92
string green(string $text)

Set the text color to green.

Parameters

string $text

Return Value

string

in Colors at line 100
string yellow(string $text)

Set the text color to yellow.

Parameters

string $text

Return Value

string

in Colors at line 108
string blue(string $text)

Set the text color to blue.

Parameters

string $text

Return Value

string

in Colors at line 116
string magenta(string $text)

Set the text color to magenta.

Parameters

string $text

Return Value

string

in Colors at line 124
string cyan(string $text)

Set the text color to cyan.

Parameters

string $text

Return Value

string

in Colors at line 132
string white(string $text)

Set the text color to white.

Parameters

string $text

Return Value

string

in Colors at line 140
string bgBlack(string $text)

Set the text background to black.

Parameters

string $text

Return Value

string

in Colors at line 148
string bgRed(string $text)

Set the text background to red.

Parameters

string $text

Return Value

string

in Colors at line 156
string bgGreen(string $text)

Set the text background to green.

Parameters

string $text

Return Value

string

in Colors at line 164
string bgYellow(string $text)

Set the text background to yellow.

Parameters

string $text

Return Value

string

in Colors at line 172
string bgBlue(string $text)

Set the text background to blue.

Parameters

string $text

Return Value

string

in Colors at line 180
string bgMagenta(string $text)

Set the text background to magenta.

Parameters

string $text

Return Value

string

in Colors at line 188
string bgCyan(string $text)

Set the text background to cyan.

Parameters

string $text

Return Value

string

in Colors at line 196
string bgWhite(string $text)

Set the text background to white.

Parameters

string $text

Return Value

string

in Colors at line 204
string gray(string $text)

Set the text color to gray.

Parameters

string $text

Return Value

string

in Cursor at line 17
void hideCursor()

Hide the cursor.

Return Value

void

in Cursor at line 33
void showCursor()

Show the cursor.

Return Value

void

in Cursor at line 49
void restoreCursor()

Restore the cursor if it was hidden.

Return Value

void

in Cursor at line 59
void moveCursor(int $x, int $y = 0)

Move the cursor.

Parameters

int $x
int $y

Return Value

void

in Cursor at line 85
void moveCursorToColumn(int $column)

Move the cursor to the given column.

Parameters

int $column

Return Value

void

in Cursor at line 97
void moveCursorUp(int $lines)

Move the cursor up by the given number of lines.

Parameters

int $lines

Return Value

void

in Cursor at line 113
static void resetCursor()

Reset cursor state to defaults.

Boot or tests only. Clears worker-wide cursor visibility tracking; concurrent prompts may restore cursor state differently depending on timing.

Return Value

void

in Erase at line 12
void eraseLines(int $count)

Erase the given number of lines downwards from the cursor position.

Parameters

int $count

Return Value

void

in Erase at line 31
void eraseDown()

Erase from cursor until end of screen.

Return Value

void

in Events at line 21
void on(string $event, Closure $callback)

Register an event listener.

Parameters

string $event
Closure $callback

Return Value

void

in Events at line 29
void emit(string $event, mixed ...$data)

Emit an event.

Parameters

string $event
mixed ...$data

Return Value

void

in Events at line 39
void clearListeners()

Clean the event listeners.

Return Value

void

in FakesInputOutput at line 25
static void fake(array $keys = [])

Fake the terminal and queue key presses to be simulated.

Tests only. Swaps prompt terminal and output state for the worker lifetime.

Parameters

array $keys

Return Value

void

in FakesInputOutput at line 62
static void fakeKeyPresses(array $keys, callable $callable)

Implementation of the looping mechanism for simulating key presses.

By ignoring the $callable parameter which contains the default logic for simulating fake key presses, we can use a custom implementation to emit key presses instead, allowing us to use different inputs.

Parameters

array $keys
callable $callable

Return Value

void

in FakesInputOutput at line 72
static void assertOutputContains(string $string)

Assert that the output contains the given string.

Parameters

string $string

Return Value

void

in FakesInputOutput at line 80
static void assertOutputDoesntContain(string $string)

Assert that the output doesn't contain the given string.

Parameters

string $string

Return Value

void

in FakesInputOutput at line 88
static void assertStrippedOutputContains(string $string)

Assert that the stripped output contains the given string.

Parameters

string $string

Return Value

void

in FakesInputOutput at line 96
static void assertStrippedOutputDoesntContain(string $string)

Assert that the stripped output doesn't contain the given string.

Parameters

string $string

Return Value

void

in FakesInputOutput at line 104
static string content()

Get the buffered console output.

Return Value

string

in FakesInputOutput at line 116
static string strippedContent()

Get the buffered console output, stripped of escape sequences.

Return Value

string

in Fallback at line 39
static void fallbackWhen(bool $condition)

Enable the fallback implementation.

Parameters

bool $condition

Return Value

void

in Fallback at line 52
static bool shouldFallback()

Whether the prompt should fallback to a custom implementation.

Return Value

bool

in Fallback at line 69
static void fallbackUsing(Closure $fallback)

Set the fallback implementation.

Parameters

Closure $fallback

Return Value

void

in Fallback at line 83
mixed fallback()

Call the registered fallback implementation.

Return Value

mixed

in Fallback at line 107
static void resetFallback()

Reset fallback state to defaults.

Boot or tests only. Clears worker-wide prompt fallback configuration; concurrent prompts may render with different fallback behavior depending on timing.

Return Value

void

in Interactivity at line 28
static void interactive(bool $interactive = true)

Set interactive mode.

Parameters

bool $interactive

Return Value

void

in Interactivity at line 40
static bool|null isInteractive()

Determine if the prompt is interactive.

Return Value

bool|null

in Interactivity at line 56
static void resetInteractivity()

Reset interactivity state to defaults.

Boot or tests only. Clears worker-wide prompt interactivity configuration; concurrent prompts may render with different interactivity depending on timing.

Return Value

void

in Interactivity at line 65
protected mixed default()

Return the default value if it passes validation.

Return Value

mixed

in Themes at line 117
static string theme(string|null $name = null)

Get or set the active theme.

Boot-only when setting. The active theme persists in a static property for the worker lifetime and applies to every subsequent prompt render.

Parameters

string|null $name

Return Value

string

Exceptions

InvalidArgumentException

in Themes at line 138
static void addTheme(string $name, array $renderers)

Add a new theme.

Boot-only. Themes persist in a static property for the worker lifetime and are available to every subsequent prompt render.

Parameters

string $name
array $renderers

Return Value

void

in Themes at line 150
protected callable getRenderer()

Get the renderer for the current prompt.

Return Value

callable

in Themes at line 165
protected string renderTheme()

Render the prompt using the active theme.

Return Value

string

in Themes at line 179
static void resetTheme()

Reset theme state to defaults.

Boot or tests only. Clears worker-wide prompt theme configuration; concurrent prompts may render with different themes depending on timing.

Return Value

void

at line 835
mixed value()

Get the current value of the prompt.

Return Value

mixed

in Prompt at line 138
string|null validateIntrinsic(mixed $value)

Validate rules intrinsic to the prompt type.

Parameters

mixed $value

Return Value

string|null

at line 827
mixed prompt()

Disable prompting for input.

Return Value

mixed

Exceptions

RuntimeException

in Prompt at line 238
mixed runLoop(callable $callable)

Implementation of the prompt looping mechanism.

Parameters

callable $callable

Return Value

mixed

in Prompt at line 261
static void cancelUsing(Closure|null $callback)

Register a callback to be invoked when a user cancels a prompt.

Boot-only. The callback persists in a static property for the worker lifetime and runs on every subsequent prompt cancellation.

Parameters

Closure|null $callback

Return Value

void

in Prompt at line 269
int newLinesWritten()

How many new lines were written by the last output.

Return Value

int

in Prompt at line 277
protected void capturePreviousNewLines()

Capture the number of new lines written by the last output.

Return Value

void

in Prompt at line 287
static void setOutput(OutputInterface $output)

Set the output instance.

Parameters

OutputInterface $output

Return Value

void

in Prompt at line 299
static protected OutputInterface output()

Get the current output instance.

Return Value

OutputInterface

in Prompt at line 311
static protected void writeDirectly(string $message)

Write output directly, bypassing newline capture.

Parameters

string $message

Return Value

void

in Prompt at line 323
static Terminal terminal()

Get the terminal instance.

Return Value

Terminal

in Prompt at line 331
protected void restoreTerminalState()

Restore terminal state changed by the prompt operation.

Return Value

void

in Prompt at line 366
static void validateUsing(Closure $callback)

Set the custom validation callback.

Parameters

Closure $callback

Return Value

void

in Prompt at line 378
static protected Closure|null getValidateUsing()

Get the custom validation callback.

Return Value

Closure|null

in Prompt at line 392
static void revertUsing(Closure $callback)

internal  
 

Revert the prompt using the given callback.

Parameters

Closure $callback

Return Value

void

in Prompt at line 402
static void preventReverting()

internal  
 

Clear any previous revert callback.

Return Value

void

in Prompt at line 410
protected void render()

Render the prompt.

Return Value

void

in Prompt at line 444
protected void submit()

Submit the prompt.

Return Value

void

in Prompt at line 517
protected mixed transformedValue()

Get the transformed value of the prompt.

Return Value

mixed

in Prompt at line 565
protected bool isInvalidWhenRequired(mixed $value)

Determine whether the given value is invalid when the prompt is required.

Parameters

mixed $value

Return Value

bool

in Prompt at line 583
static void flushState()

Flush all static state.

Return Value

void

at line 853
__destruct()

Clean up after the task.

protected int longest(array $lines, int $padding = 0)

Get the length of the longest line.

Parameters

array $lines
int $padding

Return Value

int

protected string pad(string $text, int $length, string $char = ' ')

Pad text ignoring ANSI escape sequences.

Parameters

string $text
int $length
string $char

Return Value

string

protected string replaceLastVisibleGrapheme(string $line, string $replacement)

Replace the last visible grapheme while preserving trailing formatting.

Parameters

string $line
string $replacement

Return Value

string

protected string stripEscapeSequences(string $text)

Strip ANSI escape sequences from the given text.

Parameters

string $text

Return Value

string

protected string mbWordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false)

Multi-byte version of wordwrap.

Parameters

string $string
int $width
string $break
bool $cut_long_words

Return Value

string

in InteractsWithStrings at line 172
protected array ansiWordwrap(string $text, int $width, bool $cutLongWords = false)

Word wrap text while preserving ANSI escape sequences.

Parameters

string $text
int $width
bool $cutLongWords

Return Value

array

in InteractsWithStrings at line 267
protected array parseAnsiText(string $text)

Parse text into segments with their associated ANSI codes.

Parameters

string $text

Return Value

array

in InteractsWithStrings at line 379
protected void updateSgrState(array $activeSgr, string $escape)

Update the bounded set of active SGR attributes.

Parameters

array $activeSgr
string $escape

Return Value

void

in TracksTaskOutput at line 94
protected void addLogLines(string $line)

Add a complete logical log message.

Parameters

string $line

Return Value

void

in TracksTaskOutput at line 109
protected void replacePartialLines(string $text)

Replace the in-progress partial with a complete supplied prefix.

Parameters

string $text

Return Value

void

at line 123
__construct(string $label = '', int $limit = 10, bool $keepSummary = false, string|null $subLabel = null)

Create a new Task instance.

Parameters

string $label
int $limit
bool $keepSummary
string|null $subLabel

at line 143
mixed run(Closure $callback)

Render the task and execute the callback.

Parameters

Closure $callback

Return Value

mixed

at line 189
protected void receiveMessages(resource $socket)

Receive and process messages from the parent process.

Parameters

resource $socket

Return Value

void

at line 209
void applyMessage(string|null $type, string $payload)

internal  
 

Apply one decoded Task message.

Parameters

string|null $type
string $payload

Return Value

void

at line 267
protected void recalculateMaxStableMessages()

Recompute the stable-message budget based on the current sub-label state.

Return Value

void

at line 277
protected void trimStableMessages()

Trim stable messages to the current display budget.

Return Value

void

at line 287
protected void resetOperationState()

Reset state owned by one task operation.

Return Value

void

at line 303
protected bool shouldKeepSummary()

Determine whether the final task summary should remain visible.

Return Value

bool

at line 311
protected void finishRendering(bool $renderFinalFrame = false, bool $success = true)

Finish rendering the task and clear it unless the summary should remain.

Parameters

bool $renderFinalFrame
bool $success

Return Value

void

at line 333
protected void resetTerminal(bool $originalAsync, bool $success = true)

Reset the terminal after process rendering.

Parameters

bool $originalAsync
bool $success

Return Value

void

at line 347
protected void printCompletionLine()

Print a single-line completion indicator after the task has finished.

Return Value

void

at line 362
protected mixed renderInProcess(Closure $callback)

Render the task using a child process for the animation loop.

Parameters

Closure $callback

Return Value

mixed

at line 488
protected array|false createSocketPair()

Create the process renderer socket pair.

Subclasses and tests override this seam to exercise socket setup failures without replacing the process-rendering lifecycle.

Return Value

array|false

at line 499
protected int forkProcess()

Fork the process renderer.

Subclasses and tests override this seam to exercise fork and reaping failures without injecting a process abstraction.

Return Value

int

at line 514
protected never runRendererProcess(resource $socket)

Run the child process renderer.

When the caller ignores SIGCHLD or sets SA_NOCLDWAIT, the parent cannot obtain an exit status. Subclasses that complete settlement must write static::RENDERER_ACKNOWLEDGEMENT before closing their socket or the renderer will be reported as failed in that configuration.

Parameters

resource $socket

Return Value

never

at line 556
protected void captureSignalState()

Capture and replace the process renderer's signal state.

Return Value

void

at line 569
protected void restoreSignalState()

Restore signal state replaced by the process renderer.

Return Value

void

at line 608
protected bool awaitRendererClosure()

Wait for the child renderer to close its socket.

Return Value

bool

at line 635
protected void closeSocket()

Close the parent process socket.

Return Value

void

at line 646
protected void terminateRenderer()

Terminate the owned child renderer.

Return Value

void

at line 656
protected RuntimeException|null reapRenderer(bool $requireSuccess, bool $acknowledged = false)

Reap the owned child renderer.

Parameters

bool $requireSuccess
bool $acknowledged

Return Value

RuntimeException|null

at line 706
protected mixed renderStatically(Closure $callback)

Render a static version of the task.

Parameters

Closure $callback

Return Value

mixed

at line 747
protected mixed renderInCoroutine(Closure $callback)

Render the task using a coroutine for the animation loop.

Uses the same in-process Task instance instead of socket IPC.

Parameters

Closure $callback

Return Value

mixed

at line 843
protected void eraseRenderedLines()

Clear the lines rendered by the task.

Return Value

void