PHP 클래스 Platformsh\Cli\Util\Table

Usage: In a command's configure() method, add the --format option: Table::addFormatOption($this->getDefinition()); In a command's execute() method, build and display the table: $table = new Table($input, $output); $header = ['Column 1', 'Column 2', 'Column 3']; $rows = [ ['Cell 1', 'Cell 2', 'Cell 3'], ['Cell 4', 'Cell 5', 'Cell 6'], ]; $table->render($rows, $header);
파일 보기 프로젝트 열기: commerceguys/platform-cli 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$input
$output

공개 메소드들

메소드 설명
__construct ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
addFormatOption ( Symfony\Component\Console\Input\InputDefinition $definition ) Add the --format option to a command's input definition.
formatIsMachineReadable ( ) : boolean Find whether the user wants machine-readable output.
render ( array $rows, array $header = [] ) Render a table of data to output.
renderSimple ( array $values, array $propertyNames ) Render an single-dimensional array of values, with their property names.

보호된 메소드들

메소드 설명
getFormat ( ) : string | null Get the user-specified format.
renderCsv ( array $rows, array $header, string $delimiter = ',', string $enclosure = '"' ) Render CSV output.
renderTable ( array $rows, array $header ) Render a Symfony Console table.

메소드 상세

__construct() 공개 메소드

public __construct ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface

addFormatOption() 공개 정적인 메소드

Add the --format option to a command's input definition.
public static addFormatOption ( Symfony\Component\Console\Input\InputDefinition $definition )
$definition Symfony\Component\Console\Input\InputDefinition

formatIsMachineReadable() 공개 메소드

Find whether the user wants machine-readable output.
public formatIsMachineReadable ( ) : boolean
리턴 boolean True if the user has specified a machine-readable format via the --format option (e.g. 'csv' or 'tsv'), false otherwise.

getFormat() 보호된 메소드

Get the user-specified format.
protected getFormat ( ) : string | null
리턴 string | null

render() 공개 메소드

Render a table of data to output.
public render ( array $rows, array $header = [] )
$rows array The table rows.
$header array The table header (optional).

renderCsv() 보호된 메소드

Render CSV output.
protected renderCsv ( array $rows, array $header, string $delimiter = ',', string $enclosure = '"' )
$rows array
$header array
$delimiter string
$enclosure string

renderSimple() 공개 메소드

Render an single-dimensional array of values, with their property names.
public renderSimple ( array $values, array $propertyNames )
$values array
$propertyNames array

renderTable() 보호된 메소드

Render a Symfony Console table.
protected renderTable ( array $rows, array $header )
$rows array
$header array

프로퍼티 상세

$input 보호되어 있는 프로퍼티

protected $input

$output 보호되어 있는 프로퍼티

protected $output