TYPO3  7.6
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
SymfonyStyle Class Reference
Inheritance diagram for SymfonyStyle:
OutputStyle OutputInterface StyleInterface

Public Member Functions

 __construct (InputInterface $input, OutputInterface $output)
 
 block ($messages, $type=null, $style=null, $prefix= ' ', $padding=false)
 
 title ($message)
 
 section ($message)
 
 listing (array $elements)
 
 text ($message)
 
 success ($message)
 
 error ($message)
 
 warning ($message)
 
 note ($message)
 
 caution ($message)
 
 table (array $headers, array $rows)
 
 ask ($question, $default=null, $validator=null)
 
 askHidden ($question, $validator=null)
 
 confirm ($question, $default=true)
 
 choice ($question, array $choices, $default=null)
 
 progressStart ($max=0)
 
 progressAdvance ($step=1)
 
 progressFinish ()
 
 createProgressBar ($max=0)
 
 askQuestion (Question $question)
 
 writeln ($messages, $type=self::OUTPUT_NORMAL)
 
 write ($messages, $newline=false, $type=self::OUTPUT_NORMAL)
 
 newLine ($count=1)
 
- Public Member Functions inherited from OutputStyle
 __construct (OutputInterface $output)
 
 newLine ($count=1)
 
 createProgressBar ($max=0)
 
 write ($messages, $newline=false, $type=self::OUTPUT_NORMAL)
 
 writeln ($messages, $type=self::OUTPUT_NORMAL)
 
 setVerbosity ($level)
 
 getVerbosity ()
 
 setDecorated ($decorated)
 
 isDecorated ()
 
 setFormatter (OutputFormatterInterface $formatter)
 
 getFormatter ()
 

Public Attributes

const MAX_LINE_LENGTH = 120
 

Private Member Functions

 getProgressBar ()
 
 getTerminalWidth ()
 
 autoPrependBlock ()
 
 autoPrependText ()
 
 reduceBuffer ($messages)
 

Private Attributes

 $input
 
 $questionHelper
 
 $progressBar
 
 $lineLength
 
 $bufferedOutput
 

Detailed Description

Output decorator helpers for the Symfony Style Guide.

Author
Kevin Bond kevin.nosp@m.bond.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Definition at line 32 of file SymfonyStyle.php.

Constructor & Destructor Documentation

__construct ( InputInterface  $input,
OutputInterface  $output 
)
Parameters
InputInterface$input
OutputInterface$output

Definition at line 46 of file SymfonyStyle.php.

References SymfonyStyle\$input, OutputInterface\getFormatter(), SymfonyStyle\getTerminalWidth(), and OutputInterface\getVerbosity().

Member Function Documentation

ask (   $question,
  $default = null,
  $validator = null 
)

{Asks a question.

Parameters
string$question
string | null$default
callable | null$validator
Returns
string
}

Implements StyleInterface.

Definition at line 221 of file SymfonyStyle.php.

References SymfonyStyle\askQuestion().

askHidden (   $question,
  $validator = null 
)

{Asks a question with the user input hidden.

Parameters
string$question
callable | null$validator
Returns
string
}

Implements StyleInterface.

Definition at line 232 of file SymfonyStyle.php.

References SymfonyStyle\askQuestion().

askQuestion ( Question  $question)
Parameters
Question$question
Returns
string

Definition at line 311 of file SymfonyStyle.php.

References SymfonyStyle\autoPrependBlock(), and SymfonyStyle\newLine().

Referenced by SymfonyStyle\ask(), SymfonyStyle\askHidden(), SymfonyStyle\choice(), and SymfonyStyle\confirm().

autoPrependBlock ( )
private
autoPrependText ( )
private

Definition at line 389 of file SymfonyStyle.php.

References SymfonyStyle\newLine().

Referenced by SymfonyStyle\listing(), and SymfonyStyle\text().

block (   $messages,
  $type = null,
  $style = null,
  $prefix = ' ',
  $padding = false 
)

Formats a message as a block of text.

Parameters
string | array$messagesThe message to write in the block
string | null$typeThe block type (added in [] on first line)
string | null$styleThe style to apply to the whole block
string$prefixThe prefix for the block
bool$paddingWhether to add vertical padding

Definition at line 65 of file SymfonyStyle.php.

References SymfonyStyle\autoPrependBlock(), OutputFormatter\escape(), OutputStyle\getFormatter(), OutputStyle\isDecorated(), SymfonyStyle\newLine(), Helper\strlen(), Helper\strlenWithoutDecoration(), and SymfonyStyle\writeln().

Referenced by SymfonyStyle\caution(), SymfonyStyle\error(), SymfonyStyle\note(), SymfonyStyle\success(), and SymfonyStyle\warning().

caution (   $message)

{Formats a caution admonition.

Parameters
string | array$message
}

Implements StyleInterface.

Definition at line 197 of file SymfonyStyle.php.

References SymfonyStyle\block().

choice (   $question,
array  $choices,
  $default = null 
)

{Asks a choice question.

Parameters
string$question
array$choices
string | int | null$default
Returns
string
}

Implements StyleInterface.

Definition at line 253 of file SymfonyStyle.php.

References SymfonyStyle\askQuestion().

confirm (   $question,
  $default = true 
)

{Asks for confirmation.

Parameters
string$question
bool$default
Returns
bool
}

Implements StyleInterface.

Definition at line 245 of file SymfonyStyle.php.

References SymfonyStyle\askQuestion().

createProgressBar (   $max = 0)

{}

Definition at line 293 of file SymfonyStyle.php.

References SymfonyStyle\$progressBar.

Referenced by SymfonyStyle\progressStart().

error (   $message)

{Formats an error result bar.

Parameters
string | array$message
}

Implements StyleInterface.

Definition at line 173 of file SymfonyStyle.php.

References SymfonyStyle\block().

getProgressBar ( )
private
Returns
ProgressBar

Definition at line 361 of file SymfonyStyle.php.

References SymfonyStyle\$progressBar.

Referenced by SymfonyStyle\progressAdvance(), and SymfonyStyle\progressFinish().

getTerminalWidth ( )
private

Definition at line 370 of file SymfonyStyle.php.

Referenced by SymfonyStyle\__construct().

listing ( array  $elements)

{Formats a list.

Parameters
array$elements
}

Implements StyleInterface.

Definition at line 133 of file SymfonyStyle.php.

References SymfonyStyle\autoPrependText(), SymfonyStyle\newLine(), and SymfonyStyle\writeln().

newLine (   $count = 1)
note (   $message)

{Formats a note admonition.

Parameters
string | array$message
}

Implements StyleInterface.

Definition at line 189 of file SymfonyStyle.php.

References SymfonyStyle\block().

progressAdvance (   $step = 1)

{Advances the progress output X steps.

Parameters
int$stepNumber of steps to advance
}

Implements StyleInterface.

Definition at line 275 of file SymfonyStyle.php.

References SymfonyStyle\getProgressBar().

progressFinish ( )

{Finishes the progress output.}

Implements StyleInterface.

Definition at line 283 of file SymfonyStyle.php.

References SymfonyStyle\getProgressBar(), and SymfonyStyle\newLine().

progressStart (   $max = 0)

{Starts the progress output.

Parameters
int$maxMaximum steps (0 if unknown)
}

Implements StyleInterface.

Definition at line 266 of file SymfonyStyle.php.

References SymfonyStyle\createProgressBar().

reduceBuffer (   $messages)
private

Definition at line 398 of file SymfonyStyle.php.

Referenced by SymfonyStyle\write(), and SymfonyStyle\writeln().

section (   $message)

{Formats a section title.

Parameters
string$message
}

Implements StyleInterface.

Definition at line 120 of file SymfonyStyle.php.

References SymfonyStyle\autoPrependBlock(), SymfonyStyle\newLine(), and SymfonyStyle\writeln().

success (   $message)

{Formats a success result bar.

Parameters
string | array$message
}

Implements StyleInterface.

Definition at line 165 of file SymfonyStyle.php.

References SymfonyStyle\block().

table ( array  $headers,
array  $rows 
)

{Formats a table.

Parameters
array$headers
array$rows
}

Implements StyleInterface.

Definition at line 205 of file SymfonyStyle.php.

References SymfonyStyle\newLine().

text (   $message)

{Formats informational text.

Parameters
string | array$message
}

Implements StyleInterface.

Definition at line 147 of file SymfonyStyle.php.

References SymfonyStyle\autoPrependText(), and SymfonyStyle\writeln().

title (   $message)

{Formats a command title.

Parameters
string$message
}

Implements StyleInterface.

Definition at line 107 of file SymfonyStyle.php.

References SymfonyStyle\autoPrependBlock(), SymfonyStyle\newLine(), and SymfonyStyle\writeln().

warning (   $message)

{Formats an warning result bar.

Parameters
string | array$message
}

Implements StyleInterface.

Definition at line 181 of file SymfonyStyle.php.

References SymfonyStyle\block().

write (   $messages,
  $newline = false,
  $type = self::OUTPUT_NORMAL 
)

{Writes a message to the output.

Parameters
string | array$messagesThe message as an array of lines or a single string
bool$newlineWhether to add a newline
int$typeThe type of output (one of the OUTPUT constants)
Exceptions
\InvalidArgumentExceptionWhen unknown output type is given
}

Implements OutputInterface.

Definition at line 343 of file SymfonyStyle.php.

References SymfonyStyle\reduceBuffer().

writeln (   $messages,
  $type = self::OUTPUT_NORMAL 
)

{Writes a message to the output and adds a newline at the end.

Parameters
string | array$messagesThe message as an array of lines of a single string
int$typeThe type of output (one of the OUTPUT constants)
Exceptions
\InvalidArgumentExceptionWhen unknown output type is given
}

Implements OutputInterface.

Definition at line 334 of file SymfonyStyle.php.

References SymfonyStyle\reduceBuffer().

Referenced by SymfonyStyle\block(), SymfonyStyle\listing(), SymfonyStyle\section(), SymfonyStyle\text(), and SymfonyStyle\title().

Member Data Documentation

$bufferedOutput
private

Definition at line 40 of file SymfonyStyle.php.

$input
private

Definition at line 36 of file SymfonyStyle.php.

Referenced by SymfonyStyle\__construct().

$lineLength
private

Definition at line 39 of file SymfonyStyle.php.

$progressBar
private

Definition at line 38 of file SymfonyStyle.php.

Referenced by SymfonyStyle\createProgressBar(), and SymfonyStyle\getProgressBar().

$questionHelper
private

Definition at line 37 of file SymfonyStyle.php.

const MAX_LINE_LENGTH = 120

Definition at line 34 of file SymfonyStyle.php.

Referenced by SymfonyStyleTest\testLongWordsBlockWrapping().