Overview

Namespaces

  • Webmozart
    • Console
      • Adapter
      • Api
        • Application
        • Args
          • Format
        • Command
        • Config
        • Event
        • Formatter
        • IO
        • Resolver
      • Args
      • Config
      • Formatter
      • Handler
        • Help
      • IO
        • InputStream
        • OutputStream
      • Process
      • Resolver
      • UI
        • Alignment
        • Component
        • Help
        • Layout
        • Style
      • Util

Classes

  • Input
  • IO
  • Output

Interfaces

  • InputStream
  • OutputStream

Exceptions

  • IOException
  • Overview
  • Namespace
  • Class

Class Output

The console output.

This class wraps an output stream and adds convenience functionality for writing that stream.

Webmozart\Console\Api\IO\Output implements Webmozart\Console\Api\Formatter\Formatter
Namespace: Webmozart\Console\Api\IO
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/IO/Output.php
Methods summary
public
# __construct( Webmozart\Console\Api\IO\OutputStream $stream, Webmozart\Console\Api\Formatter\Formatter $formatter = null )

Creates an output for the given output stream.

Creates an output for the given output stream.

Parameters

$stream
The output stream.
$formatter

The formatter for formatting text written to the output stream.

public
# write( string $string, integer $flags = null )

Writes a string to the output stream.

Writes a string to the output stream.

The string is formatted before it is written to the output stream.

Parameters

$string
The string to write.
$flags

The flags. If one of of IO::VERBOSE, IO::VERY_VERBOSE and IO::DEBUG is passed, the output is only written if the verbosity level is the given level or higher.

Throws

Webmozart\Console\Api\IO\IOException
If writing fails or if the output stream is closed.
public
# writeLine( string $string, integer $flags = null )

Writes a line of text to the output stream.

Writes a line of text to the output stream.

The string is formatted before it is written to the output stream.

Parameters

$string
The string to write. A newline is appended.
$flags

The flags. If one of of IO::VERBOSE, IO::VERY_VERBOSE and IO::DEBUG is passed, the output is only written if the verbosity level is the given level or higher.

Throws

Webmozart\Console\Api\IO\IOException
If writing fails or if the output stream is closed.
public
# writeRaw( string $string, integer $flags = null )

Writes a string to the output stream without formatting.

Writes a string to the output stream without formatting.

Parameters

$string
The string to write.
$flags

The flags. If one of of IO::VERBOSE, IO::VERY_VERBOSE and IO::DEBUG is passed, the output is only written if the verbosity level is the given level or higher.

Throws

Webmozart\Console\Api\IO\IOException
If writing fails or if the output stream is closed.
public
# writeLineRaw( string $string, integer $flags = null )

Writes a line of text to the output stream without formatting.

Writes a line of text to the output stream without formatting.

Parameters

$string
The string to write. A newline is appended.
$flags

The flags. If one of of IO::VERBOSE, IO::VERY_VERBOSE and IO::DEBUG is passed, the output is only written if the verbosity level is the given level or higher.

Throws

Webmozart\Console\Api\IO\IOException
If writing fails or if the standard output is closed.
public
# flush( )

Forces all pending text to be written out.

Forces all pending text to be written out.

Throws

Webmozart\Console\Api\IO\IOException
If flushing fails or if the output stream is closed.
public
# close( )

Closes the output.

Closes the output.

public boolean
# isClosed( )

Returns whether the output is closed.

Returns whether the output is closed.

Returns

boolean

Returns true if the output is closed and false otherwise.

public
# setStream( Webmozart\Console\Api\IO\OutputStream $stream )

Sets the underlying stream.

Sets the underlying stream.

Parameters

$stream
The output stream.
public Webmozart\Console\Api\IO\OutputStream
# getStream( )

Returns the underlying stream.

Returns the underlying stream.

Returns

Webmozart\Console\Api\IO\OutputStream
The output stream.
public
# setFormatter( Webmozart\Console\Api\Formatter\Formatter $formatter )

Sets the output formatter.

Sets the output formatter.

Parameters

$formatter
The output formatter.
public Webmozart\Console\Api\Formatter\Formatter
# getFormatter( )

Returns the output formatter.

Returns the output formatter.

Returns

Webmozart\Console\Api\Formatter\Formatter
The output formatter.
public
# setVerbosity( integer $verbosity )

Sets the verbosity level of the output.

Sets the verbosity level of the output.

Parameters

$verbosity

One of the constants NORMAL, VERBOSE, VERY_VERBOSE or DEBUG. Only output with the given verbosity level or smaller will be written out.

public integer
# getVerbosity( )

Returns the current verbosity level.

Returns the current verbosity level.

Returns

integer
One of the verbosity constants.
public boolean
# isVerbose( )

Returns whether the verbosity level is IO::VERBOSE or greater.

Returns whether the verbosity level is IO::VERBOSE or greater.

Returns

boolean

Returns true if the verbosity level is IO::VERBOSE or greater and false otherwise.

public boolean
# isVeryVerbose( )

Returns whether the verbosity level is IO::VERY_VERBOSE or greater.

Returns whether the verbosity level is IO::VERY_VERBOSE or greater.

Returns

boolean

Returns true if the verbosity level is IO::VERY_VERBOSE or greater and false otherwise.

public boolean
# isDebug( )

Returns whether the verbosity level is IO::DEBUG.

Returns whether the verbosity level is IO::DEBUG.

Returns

boolean

Returns true if the verbosity level is IO::DEBUG and false otherwise.

public
# setQuiet( boolean $quiet )

Sets whether output should be suppressed completely.

Sets whether output should be suppressed completely.

Parameters

$quiet

Pass true to suppress all output and false otherwise.

public boolean
# isQuiet( )

Returns whether output is suppressed completely.

Returns whether output is suppressed completely.

Returns

boolean

Returns true if all output is suppressed and false otherwise.

public string
# format( string $string, Webmozart\Console\Api\Formatter\Style $style = null )

Formats the given string.

Formats the given string.

Parameters

$string
The string to format.
$style
The style to use.

Returns

string
The formatted string.

Implementation of

Webmozart\Console\Api\Formatter\Formatter::format()
public string
# removeFormat( string $string )

Removes the format tags from the given string.

Removes the format tags from the given string.

Parameters

$string
The string to remove the format tags from.

Returns

string
The string without format tags.

Implementation of

Webmozart\Console\Api\Formatter\Formatter::removeFormat()
protected boolean
# mayWrite( integer $flags )

Returns whether an output may be written for the given flags.

Returns whether an output may be written for the given flags.

Parameters

$flags
The flags.

Returns

boolean

Returns true if the output may be written and false otherwise.

Webmozart Console API API documentation generated by ApiGen