class OrderedList

Ordered list helper.

Properties

protected string $padding Padding.
protected Output $output Output instance.
protected FormatterInterface|null $formatter Formatter instance.

Methods

__construct(Output $output)

Constructor.

array
calculateWidth(array $items, string $marker)

Calculates the maximum width of a marker in a list.

string
buildListItem(string $item, string $marker, int $width, int $number, int $nestingLevel, int $parentWidth)

Builds a list item.

string
buildList(array $items, string $marker, int $nestingLevel = 0, int $parentWidth = 0)

Builds an ordered list.

string
render(array $items, string $marker = '%s.')

Renders an ordered list.

draw(array $items, string $marker = '%s.', int $writer = Output::STANDARD)

Draws an ordered list.

Details

at line 50
__construct(Output $output)

Constructor.

Parameters

Output $output Output instance

at line 64
protected array calculateWidth(array $items, string $marker)

Calculates the maximum width of a marker in a list.

Parameters

array $items Items
string $marker Item marker

Return Value

array

at line 94
protected string buildListItem(string $item, string $marker, int $width, int $number, int $nestingLevel, int $parentWidth)

Builds a list item.

Parameters

string $item Item
string $marker Item marker
int $width Item number width
int $number Item number
int $nestingLevel Nesting level
int $parentWidth Parent width

Return Value

string

at line 110
protected string buildList(array $items, string $marker, int $nestingLevel = 0, int $parentWidth = 0)

Builds an ordered list.

Parameters

array $items Items
string $marker Item marker
int $nestingLevel Nesting level
int $parentWidth Parent marker width

Return Value

string

at line 138
string render(array $items, string $marker = '%s.')

Renders an ordered list.

Parameters

array $items Items
string $marker Item marker

Return Value

string

at line 150
draw(array $items, string $marker = '%s.', int $writer = Output::STANDARD)

Draws an ordered list.

Parameters

array $items Items
string $marker Item marker
int $writer Output writer