TYPO3  7.6
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
StreamOutput Class Reference
Inheritance diagram for StreamOutput:
Output OutputInterface ConsoleOutput

Public Member Functions

 __construct ($stream, $verbosity=self::VERBOSITY_NORMAL, $decorated=null, OutputFormatterInterface $formatter=null)
 
 getStream ()
 
- Public Member Functions inherited from Output
 __construct ($verbosity=self::VERBOSITY_NORMAL, $decorated=false, OutputFormatterInterface $formatter=null)
 
 setFormatter (OutputFormatterInterface $formatter)
 
 getFormatter ()
 
 setDecorated ($decorated)
 
 isDecorated ()
 
 setVerbosity ($level)
 
 getVerbosity ()
 
 isQuiet ()
 
 isVerbose ()
 
 isVeryVerbose ()
 
 isDebug ()
 
 writeln ($messages, $type=self::OUTPUT_NORMAL)
 
 write ($messages, $newline=false, $type=self::OUTPUT_NORMAL)
 

Protected Member Functions

 doWrite ($message, $newline)
 
 hasColorSupport ()
 
- Protected Member Functions inherited from Output
 doWrite ($message, $newline)
 

Private Attributes

 $stream
 

Additional Inherited Members

- Public Attributes inherited from OutputInterface
const VERBOSITY_QUIET = 0
 
const VERBOSITY_NORMAL = 1
 
const VERBOSITY_VERBOSE = 2
 
const VERBOSITY_VERY_VERBOSE = 3
 
const VERBOSITY_DEBUG = 4
 
const OUTPUT_NORMAL = 0
 
const OUTPUT_RAW = 1
 
const OUTPUT_PLAIN = 2
 

Detailed Description

StreamOutput writes the output to a given stream.

Usage:

$output = new StreamOutput(fopen('php://stdout', 'w'));

As StreamOutput can use any stream, you can also use a file:

$output = new StreamOutput(fopen('/path/to/output.log', 'a', false));

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 31 of file StreamOutput.php.

Constructor & Destructor Documentation

__construct (   $stream,
  $verbosity = self::VERBOSITY_NORMAL,
  $decorated = null,
OutputFormatterInterface  $formatter = null 
)

Constructor.

Parameters
mixed$streamA stream resource
int$verbosityThe verbosity level (one of the VERBOSITY constants in OutputInterface)
bool | null$decoratedWhether to decorate messages (null for auto-guessing)
OutputFormatterInterface | null$formatterOutput formatter instance (null to use default OutputFormatter)
Exceptions
\InvalidArgumentExceptionWhen first argument is not a real stream

Definition at line 47 of file StreamOutput.php.

References Output\$formatter, StreamOutput\$stream, Output\$verbosity, and StreamOutput\hasColorSupport().

Member Function Documentation

doWrite (   $message,
  $newline 
)
protected

{}

Definition at line 75 of file StreamOutput.php.

getStream ( )

Gets the stream attached to this StreamOutput instance.

Returns
resource A stream resource

Definition at line 67 of file StreamOutput.php.

References StreamOutput\$stream.

Referenced by ProcessHelperTest\getOutput(), LegacyTableHelperTest\getOutputContent(), and TableTest\getOutputContent().

hasColorSupport ( )
protected

Returns true if the stream supports colorization.

Colorization is disabled if not supported by the stream:

  • Windows without Ansicon and ConEmu
  • non tty consoles
Returns
bool true if the stream supports colorization, false otherwise

Definition at line 95 of file StreamOutput.php.

Referenced by StreamOutput\__construct().

Member Data Documentation

$stream
private

Definition at line 33 of file StreamOutput.php.

Referenced by StreamOutput\__construct(), and StreamOutput\getStream().