Drupal investigation

api.md 87KB

Table of contents


Class: \Consolidation\OutputFormatters\FormatterManager

Manage a collection of formatters; return one on request.

: \Consolidation\OutputFormatters\FormatterManager
Add a formatter : \Consolidation\OutputFormatters\FormatterManager
Add a simplifier
Visibility Function
public __construct() : void
public addDefaultFormatters() : void
public addDefaultSimplifiers() : void
public addFormatter(string $key, string/\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter)
public addSimplifier(\Consolidation\OutputFormatters\Transformations\SimplifyToArrayInterface $simplifier)
public automaticOptions(\Consolidation\OutputFormatters\Options\FormatterOptions $options, mixed $dataType) : \Symfony\Component\Console\Input\InputOption[]
Return a set of InputOption based on the annotations of a command. public getFormatter(string $format) : \Consolidation\OutputFormatters\Formatters\FormatterInterface
Fetch the requested formatter. public hasFormatter(mixed $format) : bool
Test to see if the stipulated format exists public isValidDataType(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, \ReflectionClass $dataType) : bool public isValidFormat(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $dataType) : bool public overrideOptions(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : \Consolidation\OutputFormatters\Options\FormatterOptions
Allow the formatter to mess with the configuration options before any transformations et. al. get underway. public overrideRestructure(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : mixed
Allow the formatter access to the raw structured data prior to restructuring. For example, the 'list' formatter may wish to display the row keys when provided table output. If this function returns a result that does not evaluate to 'false', then that result will be used as-is, and restructuring and validation will not occur. public renderData(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : mixed
Render the data as necessary (e.g. to select or reorder fields). public restructureData(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : mixed
Restructure the data as necessary (e.g. to select or reorder fields). public validFormats(mixed $dataType) : array
Return the identifiers for all valid data types that have been registered. public validateData(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : mixed
Determine if the provided data is compatible with the formatter being used. public write(\Symfony\Component\Console\Output\OutputInterface $output, string $format, mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void
Format and write output protected availableFieldsList(mixed $availableFields) : string[]
Given a list of available fields, return a list of field descriptions. protected canSimplifyToArray(\ReflectionClass $structuredOutput) : bool protected simplifyToArray(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void protected validateAndRestructure(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void

Class: \Consolidation\OutputFormatters\Exception\AbstractDataFormatException (abstract)

Contains some helper functions used by exceptions in this project.

: void : string
Return a description of the data type represented by the provided parameter. \ArrayObject is used as a proxy to mean an array primitive (or an ArrayObject).
Visibility Function
protected static describeAllowedTypes(mixed $allowedTypes)
protected static describeDataType(\ReflectionClass $data)
protected static describeListOfAllowedTypes(mixed $allowedTypes) : void

This class extends \Exception


Class: \Consolidation\OutputFormatters\Exception\IncompatibleDataException

Represents an incompatibility between the output data and selected formatter.

: void
Visibility Function
public __construct(\Consolidation\OutputFormatters\Formatters\FormatterInterface $formatter, mixed $data, mixed $allowedTypes)

This class extends \Consolidation\OutputFormatters\Exception\AbstractDataFormatException


Class: \Consolidation\OutputFormatters\Exception\InvalidFormatException

Represents an incompatibility between the output data and selected formatter.

: void
Visibility Function
public __construct(mixed $format, mixed $data, mixed $validFormats)

This class extends \Consolidation\OutputFormatters\Exception\AbstractDataFormatException


Class: \Consolidation\OutputFormatters\Exception\UnknownFieldException

Indicates that the requested format does not exist.

: void
Visibility Function
public __construct(mixed $field)

This class extends \Exception


Class: \Consolidation\OutputFormatters\Exception\UnknownFormatException

Indicates that the requested format does not exist.

: void
Visibility Function
public __construct(mixed $format)

This class extends \Exception


Class: \Consolidation\OutputFormatters\Formatters\CsvFormatter

Comma-separated value formatters Display the provided structured data in a comma-separated list. If there are multiple records provided, then they will be printed one per line. The primary data types accepted are RowsOfFields and PropertyList. The later behaves exactly like the former, save for the fact that it contains but a single row. This formmatter can also accept a PHP array; this is also interpreted as a single-row of data with no header.

: bool
Return the list of data types acceptable to this formatter : mixed
Convert the contents of the output data just before it is to be printed, prior to output but after restructuring and validation.
Visibility Function
public isValidDataType(\ReflectionClass $dataType)
public renderData(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public validDataTypes() : void public validate(mixed $structuredData) : void public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : string
Given structured data, apply appropriate formatting, and return a printable string. protected csvEscape(mixed $data, string $delimiter=',') : void protected getDefaultFormatterOptions() : array
Return default values for formatter options protected renderEachCell(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void protected writeOneLine(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, mixed $options) : void

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface, \Consolidation\OutputFormatters\Validate\ValidDataTypesInterface, \Consolidation\OutputFormatters\Validate\ValidationInterface, \Consolidation\OutputFormatters\Formatters\RenderDataInterface


Interface: \Consolidation\OutputFormatters\Formatters\FormatterInterface

: string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

Class: \Consolidation\OutputFormatters\Formatters\JsonFormatter

Json formatter Convert an array or ArrayObject into Json.

: string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface


Class: \Consolidation\OutputFormatters\Formatters\ListFormatter

Display the data in a simple list. This formatter prints a plain, unadorned list of data, with each data item appearing on a separate line. If you wish your list to contain headers, then use the table formatter, and wrap your data in an PropertyList.

: mixed
Select data to use directly from the structured output, before the restructure operation has been executed. : mixed
Convert the contents of the output data just before it is to be printed, prior to output but after restructuring and validation.
Visibility Function
public overrideRestructure(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public renderData(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : string
Given structured data, apply appropriate formatting, and return a printable string. protected renderEachCell(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface, \Consolidation\OutputFormatters\Transformations\OverrideRestructureInterface, \Consolidation\OutputFormatters\Formatters\RenderDataInterface


Class: \Consolidation\OutputFormatters\Formatters\PrintRFormatter

Print_r formatter Run provided date thruogh print_r.

: string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface


Interface: \Consolidation\OutputFormatters\Formatters\RenderDataInterface

: mixed
Convert the contents of the output data just before it is to be printed, prior to output but after restructuring and validation.
Visibility Function
public renderData(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

Class: \Consolidation\OutputFormatters\Formatters\SectionsFormatter

Display sections of data. This formatter takes data in the RowsOfFields data type. Each row represents one section; the data in each section is rendered in two columns, with the key in the first column and the value in the second column.

: bool
Return the list of data types acceptable to this formatter : mixed
Convert the contents of the output data just before it is to be printed, prior to output but after restructuring and validation.
Visibility Function
public isValidDataType(\ReflectionClass $dataType)
public renderData(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public validDataTypes() : void public validate(mixed $structuredData) : mixed
Throw an IncompatibleDataException if the provided data cannot be processed by this formatter. Return the source data if it is valid. The data may be encapsulated or converted if necessary. public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : string
Given structured data, apply appropriate formatting, and return a printable string. protected renderEachCell(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface, \Consolidation\OutputFormatters\Validate\ValidDataTypesInterface, \Consolidation\OutputFormatters\Validate\ValidationInterface, \Consolidation\OutputFormatters\Formatters\RenderDataInterface


Class: \Consolidation\OutputFormatters\Formatters\SerializeFormatter

Serialize formatter Run provided date thruogh serialize.

: string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface


Class: \Consolidation\OutputFormatters\Formatters\StringFormatter

String formatter This formatter is used as the default action when no particular formatter is requested. It will print the provided data only if it is a string; if any other type is given, then nothing is printed.

: bool
All data types are acceptable. : \Consolidation\OutputFormatters\Options\FormatterOptions
Allow the formatter to mess with the configuration options before any transformations et. al. get underway.
Visibility Function
public isValidDataType(\ReflectionClass $dataType)
public overrideOptions(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public validate(mixed $structuredData) : void
Always validate any data, though. This format will never cause an error if it is selected for an incompatible data type; at worse, it simply does not print any data. public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : string
Given structured data, apply appropriate formatting, and return a printable string. protected reduceToSigleFieldAndWrite(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void
If the data provided to a 'string' formatter is a table, then try to emit it as a TSV value.

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface, \Consolidation\OutputFormatters\Validate\ValidationInterface, \Consolidation\OutputFormatters\Options\OverrideOptionsInterface


Class: \Consolidation\OutputFormatters\Formatters\TableFormatter

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.

: bool
Return the list of data types acceptable to this formatter : mixed
Convert the contents of the output data just before it is to be printed, prior to output but after restructuring and validation.
Visibility Function
public __construct() : void
public isValidDataType(\ReflectionClass $dataType)
public renderData(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public validDataTypes() : void public validate(mixed $structuredData) : mixed
Throw an IncompatibleDataException if the provided data cannot be processed by this formatter. Return the source data if it is valid. The data may be encapsulated or converted if necessary. public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : string
Given structured data, apply appropriate formatting, and return a printable string. protected static addCustomTableStyles(mixed $table) : void
Add our custom table style(s) to the table. protected renderEachCell(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : void protected wrap(mixed $headers, array $data, \Symfony\Component\Console\Helper\TableStyle $tableStyle, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : array
Wrap the table data

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface, \Consolidation\OutputFormatters\Validate\ValidDataTypesInterface, \Consolidation\OutputFormatters\Validate\ValidationInterface, \Consolidation\OutputFormatters\Formatters\RenderDataInterface


Class: \Consolidation\OutputFormatters\Formatters\TsvFormatter

Tab-separated value formatters Display the provided structured data in a tab-separated list. Output escaping is much lighter, since there is no allowance for altering the delimiter.

: mixed
Convert the contents of the output data just before it is to be printed, prior to output but after restructuring and validation. : string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public renderData(mixed $originalData, mixed $restructuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
protected getDefaultFormatterOptions() : mixed protected tsvEscape(mixed $data) : void protected writeOneLine(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, mixed $options) : void

This class extends \Consolidation\OutputFormatters\Formatters\CsvFormatter

This class implements \Consolidation\OutputFormatters\Formatters\RenderDataInterface, \Consolidation\OutputFormatters\Validate\ValidationInterface, \Consolidation\OutputFormatters\Validate\ValidDataTypesInterface, \Consolidation\OutputFormatters\Formatters\FormatterInterface


Class: \Consolidation\OutputFormatters\Formatters\VarExportFormatter

Var_export formatter Run provided date thruogh var_export.

: string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface


Class: \Consolidation\OutputFormatters\Formatters\XmlFormatter

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.

: bool
Return the list of data types acceptable to this formatter : mixed
Throw an IncompatibleDataException if the provided data cannot be processed by this formatter. Return the source data if it is valid. The data may be encapsulated or converted if necessary.
Visibility Function
public __construct() : void
public isValidDataType(\ReflectionClass $dataType)
public validDataTypes() : void
public validate(mixed $structuredData)
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options) : string
Given structured data, apply appropriate formatting, and return a printable string.

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface, \Consolidation\OutputFormatters\Validate\ValidDataTypesInterface, \Consolidation\OutputFormatters\Validate\ValidationInterface


Class: \Consolidation\OutputFormatters\Formatters\YamlFormatter

Yaml formatter Convert an array or ArrayObject into Yaml.

: string
Given structured data, apply appropriate formatting, and return a printable string.
Visibility Function
public write(\Symfony\Component\Console\Output\OutputInterface $output, mixed $data, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

This class implements \Consolidation\OutputFormatters\Formatters\FormatterInterface


Class: \Consolidation\OutputFormatters\Options\FormatterOptions

FormetterOptions holds information that affects the way a formatter renders its output. There are three places where a formatter might get options from: 1. Configuration associated with the command that produced the output. This is passed in to FormatterManager::write() along with the data to format. It might originally come from annotations on the command, or it might come from another source. Examples include the field labels for a table, or the default list of fields to display. 2. Options specified by the user, e.g. by commandline options. 3. Default values associated with the formatter itself. This class caches configuration from sources (1) and (2), and expects to be provided the defaults, (3), whenever a value is requested.

: void
Create a new FormatterOptions with the configuration data and the user-specified options for this request. : mixed
Get a formatter option
Visibility Function
public __construct(array $configurationData=array(), array $options=array())
public get(string $key, array $defaults=array(), bool/mixed $default=false)
public getConfigurationData() : array
Return a reference to the configuration data for this object. public getFormat(array $defaults=array()) : string
Determine the format that was requested by the caller. public getInputOptions(array $defaults) : array
Return all of the options from the provided $defaults array that exist in our InputInterface object. public getOptions() : array
Return a reference to the user-specified options for this request. public getXmlSchema() : \Consolidation\OutputFormatters\StructuredData\Xml\XmlSchema
Return the XmlSchema to use with --format=xml for data types that support that. This is used when an array needs to be converted into xml. public override(array $configurationData) : \Consolidation\OutputFormatters\Options\FormatterOptions
Create a new FormatterOptions object with new configuration data (provided), and the same options data as this instance. public parsePropertyList(string $value) : array
Convert from a textual list to an array public setConfigurationData(array $configurationData) : \Consolidation\OutputFormatters\Options\FormatterOptions
Change the configuration data for this formatter options object. public setConfigurationDefault(string $key, mixed $value) : \Consolidation\OutputFormatters\Options\FormetterOptions
Change one configuration value for this formatter option, but only if it does not already have a value set. public setDefaultFields(mixed $fields) : void public setDefaultStringField(mixed $defaultStringField) : void public setDelimiter(mixed $delimiter) : void public setFieldLabels(mixed $fieldLabels) : void public setIncludeFieldLables(mixed $includFieldLables) : void public setInput(\Symfony\Component\Console\Input\InputInterface $input) : \Consolidation\OutputFormatters\Options\type
Provide a Symfony Console InputInterface containing the user-specified options for this request. public setListDelimiter(mixed $listDelimiter) : void public setListOrientation(mixed $listOrientation) : void public setOption(string $key, mixed $value) : \Consolidation\OutputFormatters\Options\FormatterOptions
Change one option value specified by the user for this request. public setOptions(array $options) : \Consolidation\OutputFormatters\Options\FormatterOptions
Set all of the options that were specified by the user for this request. public setRowLabels(mixed $rowLabels) : void public setTableStyle(mixed $style) : void public setWidth(mixed $width) : void protected defaultsForKey(string $key, array $defaults, bool $default=false) : array
Reduce provided defaults to the single item identified by '$key', if it exists, or an empty array otherwise. protected fetch(string $key, array $defaults=array(), bool/mixed $default=false) : mixed
Look up a key, and return its raw value. protected fetchRawValues(array $defaults=array()) : array
Look up all of the items associated with the provided defaults. protected getOptionFormat(string $key) : string
Given a specific key, return the class method name of the parsing method for data stored under this key. protected parse(string $key, mixed $value) : mixed
Given the raw value for a specific key, do any type conversion (e.g. from a textual list to an array) needed for the data. protected setConfigurationValue(string $key, mixed $value) : \Consolidation\OutputFormatters\Options\FormetterOptions
Change one configuration value for this formatter option.

Interface: \Consolidation\OutputFormatters\Options\OverrideOptionsInterface

: \Consolidation\OutputFormatters\Options\FormatterOptions
Allow the formatter to mess with the configuration options before any transformations et. al. get underway.
Visibility Function
public overrideOptions(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

Class: \Consolidation\OutputFormatters\StructuredData\AbstractStructuredList (abstract)

Holds an array where each element of the array is one row, and each row contains an associative array where the keys are the field names, and the values are the field data. It is presumed that every row contains the same keys.

: void : \Consolidation\OutputFormatters\StructuredData\$this
Add a renderer
Visibility Function
public __construct(mixed $data)
public addRenderer(\Consolidation\OutputFormatters\StructuredData\RenderCellInterface $renderer, string $priority='normal')
public addRendererFunction(\callable $rendererFn, string $priority='normal') : \Consolidation\OutputFormatters\StructuredData\$this
Add a callable as a renderer public abstract getListData(\Consolidation\OutputFormatters\Options\FormatterOptions $options) : mixed public renderCell(mixed $key, mixed $cellData, \Consolidation\OutputFormatters\Options\FormatterOptions $options, mixed $rowData) : void public abstract restructure(\Consolidation\OutputFormatters\Options\FormatterOptions $options) : void protected createTableTransformation(mixed $data, mixed $options) : mixed protected defaultOptions() : array
A structured list may provide its own set of default options. These will be used in place of the command's default options (from the annotations) in instances where the user does not provide the options explicitly (on the commandline) or implicitly (via a configuration file). protected getFields(mixed $options, mixed $defaults) : mixed protected getReorderedFieldLabels(mixed $data, mixed $options, mixed $defaults) : mixed protected instantiateTableTransformation(mixed $data, mixed $fieldLabels, mixed $rowLabels) : void

This class extends \ArrayObject

This class implements \Countable, \Serializable, \ArrayAccess, \Traversable, \IteratorAggregate, \Consolidation\OutputFormatters\StructuredData\RestructureInterface, \Consolidation\OutputFormatters\StructuredData\ListDataInterface, \Consolidation\OutputFormatters\StructuredData\RenderCellCollectionInterface, \Consolidation\OutputFormatters\StructuredData\RenderCellInterface


Class: \Consolidation\OutputFormatters\StructuredData\AssociativeList

Old name for PropertyList class.

Visibility Function

This class extends \Consolidation\OutputFormatters\StructuredData\PropertyList

This class implements \Countable, \Serializable, \ArrayAccess, \Traversable, \IteratorAggregate, \Consolidation\OutputFormatters\StructuredData\RestructureInterface, \Consolidation\OutputFormatters\StructuredData\ListDataInterface, \Consolidation\OutputFormatters\StructuredData\RenderCellCollectionInterface, \Consolidation\OutputFormatters\StructuredData\RenderCellInterface


Class: \Consolidation\OutputFormatters\StructuredData\CallableRenderer

: void : void
Visibility Function
public __construct(\callable $renderFunction)
public renderCell(mixed $key, mixed $cellData, \Consolidation\OutputFormatters\Options\FormatterOptions $options, mixed $rowData)

This class implements \Consolidation\OutputFormatters\StructuredData\RenderCellInterface


Class: \Consolidation\OutputFormatters\StructuredData\HelpDocument

Visibility Function
public getDomData() : \DomDocument
Convert data into a \DomDocument.

This class implements \Consolidation\OutputFormatters\StructuredData\Xml\DomDataInterface


Interface: \Consolidation\OutputFormatters\StructuredData\ListDataInterface

: array
Convert data to a format suitable for use in a list. By default, the array values will be used. Implement ListDataInterface to use some other criteria (e.g. array keys).
Visibility Function
public getListData(\Consolidation\OutputFormatters\Options\FormatterOptions $options)

Interface: \Consolidation\OutputFormatters\StructuredData\OriginalDataInterface

Visibility Function
public getOriginalData() : mixed
Return the original data for this table. Used by any formatter that expects an array.

Class: \Consolidation\OutputFormatters\StructuredData\PropertyList

Holds an array where each element of the array is one key : value pair. The keys must be unique, as is typically the case for associative arrays.

: mixed : \Consolidation\OutputFormatters\StructuredData\Consolidation\OutputFormatters\Transformations\TableTransformation
Restructure this data for output by converting it into a table transformation object.
Visibility Function
public getListData(\Consolidation\OutputFormatters\Options\FormatterOptions $options)
public restructure(\Consolidation\OutputFormatters\Options\FormatterOptions $options)
protected defaultOptions() : void protected instantiateTableTransformation(mixed $data, mixed $fieldLabels, mixed $rowLabels) : void

This class extends \Consolidation\OutputFormatters\StructuredData\AbstractStructuredList

This class implements \Consolidation\OutputFormatters\StructuredData\RenderCellInterface, \Consolidation\OutputFormatters\StructuredData\RenderCellCollectionInterface, \Consolidation\OutputFormatters\StructuredData\ListDataInterface, \Consolidation\OutputFormatters\StructuredData\RestructureInterface, \IteratorAggregate, \Traversable, \ArrayAccess, \Serializable, \Countable


Interface: \Consolidation\OutputFormatters\StructuredData\RenderCellCollectionInterface

: \Consolidation\OutputFormatters\StructuredData\$this
Add a renderer
Visibility Function
public addRenderer(\Consolidation\OutputFormatters\StructuredData\RenderCellInterface $renderer)

This class implements \Consolidation\OutputFormatters\StructuredData\RenderCellInterface


Interface: \Consolidation\OutputFormatters\StructuredData\RenderCellInterface

: mixed
Convert the contents of one table cell into a string, so that it may be placed in the table. Renderer should return the $cellData passed to it if it does not wish to process it.
Visibility Function
public renderCell(string $key, mixed $cellData, \Consolidation\OutputFormatters\Options\FormatterOptions $options, array $rowData)

Interface: \Consolidation\OutputFormatters\StructuredData\RestructureInterface

: void
Allow structured data to be restructured -- i.e. to select fields to show, reorder fields, etc.
Visibility Function
public restructure(\Consolidation\OutputFormatters\Options\FormatterOptions $options)

Class: \Consolidation\OutputFormatters\StructuredData\RowsOfFields

Holds an array where each element of the array is one row, and each row contains an associative array where the keys are the field names, and the values are the field data. It is presumed that every row contains the same keys.

: mixed : \Consolidation\OutputFormatters\StructuredData\Consolidation\OutputFormatters\Transformations\TableTransformation
Restructure this data for output by converting it into a table transformation object.
Visibility Function
public getListData(\Consolidation\OutputFormatters\Options\FormatterOptions $options)
public restructure(\Consolidation\OutputFormatters\Options\FormatterOptions $options)
protected defaultOptions() : void

This class extends \Consolidation\OutputFormatters\StructuredData\AbstractStructuredList

This class implements \Consolidation\OutputFormatters\StructuredData\RenderCellInterface, \Consolidation\OutputFormatters\StructuredData\RenderCellCollectionInterface, \Consolidation\OutputFormatters\StructuredData\ListDataInterface, \Consolidation\OutputFormatters\StructuredData\RestructureInterface, \IteratorAggregate, \Traversable, \ArrayAccess, \Serializable, \Countable


Interface: \Consolidation\OutputFormatters\StructuredData\TableDataInterface

: array
Convert structured data into a form suitable for use by the table formatter. key from each row.
Visibility Function
public getOriginalData() : mixed
Return the original data for this table. Used by any formatter that is -not- a table.
public getTableData(bool/boolean $includeRowKey=false)

Interface: \Consolidation\OutputFormatters\StructuredData\Xml\DomDataInterface

Visibility Function
public getDomData() : \DomDocument
Convert data into a \DomDocument.

Class: \Consolidation\OutputFormatters\StructuredData\Xml\XmlSchema

: void : void
Visibility Function
public __construct(array $elementList=array())
public arrayToXML(mixed $structuredData)
protected addXmlChildren(\DOMDocument $dom, mixed $xmlParent, mixed $elementName, mixed $structuredData) : void protected addXmlData(\DOMDocument $dom, mixed $xmlParent, mixed $elementName, mixed $structuredData) : void protected addXmlDataOrAttribute(\DOMDocument $dom, mixed $xmlParent, mixed $elementName, mixed $key, mixed $value) : void protected determineElementName(mixed $key, mixed $childElementName, mixed $value) : void protected getDefaultElementName(mixed $parentElementName) : mixed protected getTopLevelElementName(mixed $structuredData) : mixed protected inElementList(mixed $parentElementName, mixed $elementName) : void protected isAssoc(mixed $data) : bool protected isAttribute(mixed $parentElementName, mixed $elementName, mixed $value) : bool protected singularForm(mixed $name) : void

This class implements \Consolidation\OutputFormatters\StructuredData\Xml\XmlSchemaInterface


Interface: \Consolidation\OutputFormatters\StructuredData\Xml\XmlSchemaInterface

When using arrays, we could represent XML data in a number of different ways. For example, given the following XML data strucutre: blah a b c This could be: [ 'id' => 1, 'name' => 'doc', 'foobars' => [ [ 'id' => '123', 'name' => 'blah', 'widgets' => [ [ 'foo' => 'a', 'bar' => 'b', 'baz' => 'c', ] ], ], ] ] The challenge is more in going from an array back to the more structured xml format. Note that any given key => string mapping could represent either an attribute, or a simple XML element containing only a string value. In general, we do not want to add extra layers of nesting in the data structure to disambiguate between these kinds of data, as we want the source data to render cleanly into other formats, e.g. yaml, json, et. al., and we do not want to force every data provider to have to consider the optimal xml schema for their data. Our strategy, therefore, is to expect clients that wish to provide a very specific xml representation to return a DOMDocument, and, for other data structures where xml is a secondary concern, then we will use some default heuristics to convert from arrays to xml.

: \DOMDocument
Convert data to a format suitable for use in a list. By default, the array values will be used. Implement ListDataInterface to use some other criteria (e.g. array keys).
Visibility Function
public arrayToXml(mixed $structuredData)

Class: \Consolidation\OutputFormatters\Transformations\DomToArraySimplifier

Simplify a DOMDocument to an array.

: bool : void
Visibility Function
public __construct() : void
public canSimplify(\ReflectionClass $dataType)
public simplifyToArray(mixed $structuredData, \Consolidation\OutputFormatters\Options\FormatterOptions $options)
protected elementToArray(\DOMNode $element) : array
Recursively convert the provided DOM element into a php array. protected getIdOfValue(mixed $value) : string
If the object has an 'id' or 'name' element, then use that as the array key when storing this value in its parent. protected getNodeAttributes(\DOMNode $element) : array
Get all of the attributes of the provided element. protected getNodeChildren(\DOMNode $element) : array
Get all of the children of the provided element, with simplification. protected getNodeChildrenData(\DOMNode $element) : array
Get the data from the children of the provided node in preliminary form. protected getUniformChildren(string $parentKey, \DOMNode $element) : array
Convert the children of the provided DOM element into an array. Here, 'uniform' means that all of the element names of the children are identical, and further, the element name of the parent is the plural form of the child names. When the children are uniform in this way, then the parent element name will be used as the key to store the children in, and the child list will be returned as a simple list with their (duplicate) element names omitted. protected getUniqueChildren(string $parentKey, \DOMNode $element) : array
Convert the children of the provided DOM element into an array. Here, 'unique' means that all of the element names of the children are different. Since the element names will become the key of the associative array that is returned, so duplicates are not supported. If there are any duplicates, then an exception will be thrown. protected hasUniformChildren(\DOMNode $element) : boolean
Determine whether the children of the provided element are uniform. protected valueCanBeSimplified(\DOMNode $value) : boolean
Determine whether the provided value has additional unnecessary nesting. {"color": "red"} is converted to "red". No other simplification is done.

This class implements \Consolidation\OutputFormatters\Transformations\SimplifyToArrayInterface


Interface: \Consolidation\OutputFormatters\Transformations\OverrideRestructureInterface

: mixed
Select data to use directly from the structured output, before the restructure operation has been executed.
Visibility Function
public overrideRestructure(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

Class: \Consolidation\OutputFormatters\Transformations\PropertyListTableTransformation

Visibility Function
public getOriginalData() : mixed

This class extends \Consolidation\OutputFormatters\Transformations\TableTransformation

This class implements \Consolidation\OutputFormatters\StructuredData\OriginalDataInterface, \Consolidation\OutputFormatters\StructuredData\TableDataInterface, \IteratorAggregate, \Traversable, \ArrayAccess, \Serializable, \Countable


Class: \Consolidation\OutputFormatters\Transformations\PropertyParser

Transform a string of properties into a PHP associative array. Input: one: red two: white three: blue Output: [ 'one' => 'red', 'two' => 'white', 'three' => 'blue', ]

: void
Visibility Function
public static parse(mixed $data)

Class: \Consolidation\OutputFormatters\Transformations\ReorderFields

Reorder the field labels based on the user-selected fields to display.

: array
Given a simple list of user-supplied field keys or field labels, return a reordered version of the field labels matching the user selection. key to the field label : void
Convert the provided string into a regex suitable for use in preg_match. Matching occurs in the same way as the Symfony Finder component: http://symfony.com/doc/current/components/finder.html#file-name
Visibility Function
public reorder(string/array $fields, array $fieldLabels, array $data)
protected convertToRegex(mixed $str)
protected getSelectedFieldKeys(mixed $fields, mixed $fieldLabels) : mixed protected isRegex(string $str) : bool Whether the given string is a regex
Checks whether the string is a regex. This function is copied from MultiplePcreFilterIterator in the Symfony Finder component. protected matchFieldInLabelMap(mixed $field, mixed $fieldLabels) : void protected reorderFieldLabels(mixed $fields, mixed $fieldLabels, mixed $data) : void

Interface: \Consolidation\OutputFormatters\Transformations\SimplifyToArrayInterface

: bool
Indicate whether or not the given data type can be simplified to an array : array
Convert structured data into a generic array, usable by generic array-based formatters. Objects that implement this interface may be attached to the FormatterManager, and will be used on any data structure that needs to be simplified into an array. An array simplifier should take no action other than to return its input data if it cannot simplify the provided data into an array.
Visibility Function
public canSimplify(\ReflectionClass $structuredOutput)
public simplifyToArray(mixed $structuredOutput, \Consolidation\OutputFormatters\Options\FormatterOptions $options)

Class: \Consolidation\OutputFormatters\Transformations\TableTransformation

: void : mixed
Visibility Function
public __construct(mixed $data, mixed $fieldLabels, array $rowLabels=array())
public getHeader(mixed $key)
public getHeaders() : mixed public getLayout() : mixed public getOriginalData() : mixed public getRowLabel(mixed $rowid) : mixed public getRowLabels() : mixed public getTableData(bool $includeRowKey=false) : mixed public isList() : bool public setLayout(mixed $layout) : void protected convertTableToList() : void protected getRowDataWithKey(mixed $data) : mixed protected static transformRow(mixed $row, mixed $fieldLabels) : void protected static transformRows(mixed $data, mixed $fieldLabels) : void

This class extends \ArrayObject

This class implements \Countable, \Serializable, \ArrayAccess, \Traversable, \IteratorAggregate, \Consolidation\OutputFormatters\StructuredData\TableDataInterface, \Consolidation\OutputFormatters\StructuredData\OriginalDataInterface


Class: \Consolidation\OutputFormatters\Transformations\WordWrapper

: void : void
Set the minimum width of just one column
Visibility Function
public __construct(mixed $width)
public minimumWidth(mixed $colkey, mixed $width)
public setMinimumWidths(array $minimumWidths) : void
If columns have minimum widths, then set them here. public setPaddingFromStyle(\Symfony\Component\Console\Helper\TableStyle $style) : void
Calculate our padding widths from the specified table style. public wrap(array $rows, array $widths=array()) : array
Wrap the cells in each part of the provided data table protected calculateWidths(mixed $rows, array $widths=array()) : void
Determine what widths we'll use for wrapping. protected wrapCell(mixed $cell, string $cellWidth) : mixed
Wrap one cell. Guard against modifying non-strings and then call through to wordwrap().

Class: \Consolidation\OutputFormatters\Transformations\Wrap\CalculateWidths

Calculate column widths for table cells. Influenced by Drush and webmozart/console.

: void
Given the total amount of available space, and the width of the columns to place, calculate the optimum column widths to use. : void
Calculate the longest cell data from any row of each of the cells.
Visibility Function
public __construct() : void
public calculate(mixed $availableWidth, \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $dataWidths, \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $minimumWidths)
public calculateLongestCell(mixed $rows)
public calculateLongestWord(mixed $rows) : void
Calculate the longest word and longest line in the provided data. public distributeLongColumns(mixed $availableWidth, \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $dataWidths, \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $minimumWidths) : void
Distribute the remainig space among the columns that were not included in the list of "short" columns. public getShortColumns(mixed $availableWidth, \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $dataWidths, \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $minimumWidths) : mixed
Return all of the columns whose longest line length is less than or equal to the average width. protected calculateColumnWidths(mixed $rows, \callable $fn) : void protected static longestWordLength(string $str) : int
Return the length of the longest word in the string.

Class: \Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths

Calculate the width of data in table cells in preparation for word wrapping.

: void : void
If the widths specified by this object do not fit within the provided avaiable width, then reduce them all proportionally.
Visibility Function
public __construct(array $widths=array())
public adjustMinimumWidths(mixed $availableWidth, mixed $dataCellWidths)
public averageWidth(mixed $availableWidth) : void
Calculate how much space is available on average for all columns. public combine(\Consolidation\OutputFormatters\Transformations\Wrap\ColumnWidths $combineWith) : void
Combine this set of widths with another set, and return a new set that contains the entries from both. public count() : void
Return the number of columns. public distribute(mixed $availableWidth) : void
Return proportional weights public enforceMinimums(mixed $minimumWidths) : void
Ensure that every item in $widths that has a corresponding entry in $minimumWidths is as least as large as the minimum value held there. public findShortColumns(mixed $thresholdWidth) : mixed
Find all of the columns that are shorter than the specified threshold. public findUndersizedColumns(mixed $minimumWidths) : mixed
Find all of the columns that are shorter than the corresponding minimum widths. public isEmpty() : bool
Return true if there is no data in this object public keys() : void
Return the available keys (column identifiers) from the calculated data set. public lastColumn() : void public paddingSpace(mixed $paddingInEachCell, mixed $extraPaddingAtEndOfLine, mixed $extraPaddingAtBeginningOfLine) : void public removeColumns(mixed $columnKeys) : void
Remove all of the specified columns from this data structure. public selectColumns(mixed $columnKeys) : void
Select all columns that exist in the provided list of keys. public setWidth(mixed $key, mixed $width) : void
Set the length of the specified column. public static sumWidth(mixed $widths) : void
Return the sum of the lengths of the provided widths. public totalWidth() : void
Return the sum of the lengths of the provided widths. public width(mixed $key) : void
Return the length of the specified column. public widths() : void
Return all of the lengths protected findColumnsUnderThreshold(array $thresholdWidths) : mixed

Interface: \Consolidation\OutputFormatters\Validate\ValidationInterface

Formatters may implement ValidationInterface in order to indicate whether a particular data structure is supported. Any formatter that does not implement ValidationInterface is assumed to only operate on arrays, or data types that implement SimplifyToArrayInterface.

: bool
Return true if the specified format is valid for use with this formatter. : mixed
Throw an IncompatibleDataException if the provided data cannot be processed by this formatter. Return the source data if it is valid. The data may be encapsulated or converted if necessary.
Visibility Function
public isValidDataType(\ReflectionClass $dataType)
public validate(mixed $structuredData)

Interface: \Consolidation\OutputFormatters\Validate\ValidDataTypesInterface

Formatters may implement ValidDataTypesInterface in order to indicate exactly which formats they support. The validDataTypes method can be called to retrieve a list of data types useful in providing hints in exception messages about which data types can be used with the formatter. Note that it is OPTIONAL for formatters to implement this interface. If a formatter implements only ValidationInterface, then clients that request the formatter via FormatterManager::write() will still get a list (via an InvalidFormatException) of all of the formats that are usable with the provided data type. Implementing ValidDataTypesInterface is benefitial to clients who instantiate a formatter directly (via new). Formatters that implement ValidDataTypesInterface may wish to use ValidDataTypesTrait.

Visibility Function
public validDataTypes() : \ReflectionClass[]
Return the list of data types acceptable to this formatter

This class implements \Consolidation\OutputFormatters\Validate\ValidationInterface