RingBuffer

Playwright\Transport\RingBuffer

Fixed-size ring buffer for capturing recent stderr/stdout lines. Useful for debugging failed processes by keeping the most recent output.

Methods

__construct()

function __construct( private readonly int $max = 200, )

push()

void

Add a line to the buffer, automatically trimming old lines if needed.

function push(string $line): void

clear()

void

Clear all lines from the buffer.

function clear(): void

toString()

string

Get all lines as a single string.

function toString(string $separator = PHP_EOL): string

toArray()

array

Get all lines as an array.

function toArray(): array

count()

int

Get the number of lines in the buffer.

function count(): int

isEmpty()

bool

Check if the buffer is empty.

function isEmpty(): bool

getMaxSize()

int

Get the maximum capacity of the buffer.

function getMaxSize(): int