class TableFormatter implements FormatterInterface, ValidDataTypesInterface, RenderDataInterface, MetadataFormatterInterface, HumanReadableFormat (View source)

Display a table of data with the Symfony Table class.

This formatter takes data of either the RowsOfFields or PropertyList data type. Tables can be rendered with the rows running either vertically (the normal orientation) or horizontally. By default, associative lists will be displayed as two columns, with the key in the first column and the value in the second column.

Traits

Provides a default implementation of isValidDataType.

Properties

protected $fieldLabels
protected $defaultFields

Methods

validDataTypes()

Return the list of data types acceptable to this formatter

isValidDataType(ReflectionClass $dataType)

Return the list of data types acceptable to this formatter

renderData($originalData, $restructuredData, FormatterOptions $options)

No description

renderEachCell($originalData, $restructuredData, FormatterOptions $options)

No description

writeMetadata(OutputInterface $output, $structuredOutput, FormatterOptions $options)

No description

__construct()

No description

mixed
validate(mixed $structuredData)

No description

write(OutputInterface $output, $tableTransformer, FormatterOptions $options)

No description

array
wrap($headers, array $data, TableStyle $tableStyle, FormatterOptions $options)

Wrap the table data

static 
addCustomTableStyles($table)

Add our custom table style(s) to the table.

Details

ReflectionClass[] validDataTypes()

Return the list of data types acceptable to this formatter

Return Value

ReflectionClass[]

isValidDataType(ReflectionClass $dataType)

Return the list of data types acceptable to this formatter

Parameters

ReflectionClass $dataType

renderData($originalData, $restructuredData, FormatterOptions $options)

No description

Parameters

$originalData
$restructuredData
FormatterOptions $options

protected renderEachCell($originalData, $restructuredData, FormatterOptions $options)

No description

Parameters

$originalData
$restructuredData
FormatterOptions $options

writeMetadata(OutputInterface $output, $structuredOutput, FormatterOptions $options)

No description

Parameters

OutputInterface $output
$structuredOutput
FormatterOptions $options

__construct()

No description

mixed validate(mixed $structuredData)

No description

Parameters

mixed $structuredData

Data to validate

Return Value

mixed

write(OutputInterface $output, $tableTransformer, FormatterOptions $options)

No description

Parameters

OutputInterface $output
$tableTransformer
FormatterOptions $options

protected array wrap($headers, array $data, TableStyle $tableStyle, FormatterOptions $options)

Wrap the table data

Parameters

$headers
array $data
TableStyle $tableStyle
FormatterOptions $options

Return Value

array

static protected addCustomTableStyles($table)

Add our custom table style(s) to the table.

Parameters

$table