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

  • Style
  • StyleSet

Interfaces

  • Formatter
  • Overview
  • Namespace
  • Class

Class StyleSet

A set of styles used by the formatter.

Direct known subclasses

Webmozart\Console\Formatter\DefaultStyleSet
Namespace: Webmozart\Console\Api\Formatter
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/Formatter/StyleSet.php
Methods summary
public
# __construct( array $styles = array() )

Creates a new style set.

Creates a new style set.

Parameters

$styles
The styles to add.
public
# add( Webmozart\Console\Api\Formatter\Style $style )

Adds a style.

Adds a style.

Parameters

$style
The style to add.

Throws

LogicException
If the tag of the style is not set.
public
# merge( array $styles )

Adds styles to the style set.

Adds styles to the style set.

Existing styles are preserved.

Parameters

$styles
The styles to add.
public
# replace( array $styles )

Sets the styles of the style set.

Sets the styles of the style set.

Existing styles are removed.

Parameters

$styles
The styles to set.
public
# remove( string $tag )

Removes a style.

Removes a style.

This method does nothing if the tag does not exist.

Parameters

$tag
The tag of the style.
public
# clear( )

Clears the contents of the style set.

Clears the contents of the style set.

public boolean
# contains( string $tag )

Returns whether the style with the given tag exists.

Returns whether the style with the given tag exists.

Parameters

$tag
The tag of the style.

Returns

boolean

Returns true if a style with the given tag exists and false otherwise.

public boolean
# isEmpty( )

Returns whether the style set is empty.

Returns whether the style set is empty.

Returns

boolean

Returns true if the set contains no styles and false otherwise.

public Webmozart\Console\Api\Formatter\Style
# get( string $tag )

Returns the style with the given tag.

Returns the style with the given tag.

Parameters

$tag
The tag of the style.

Returns

Webmozart\Console\Api\Formatter\Style
The style.

Throws

OutOfBoundsException
If no style is set for the given tag.
public Webmozart\Console\Api\Formatter\Style[]
# toArray( )

Returns all styles.

Returns all styles.

Returns

Webmozart\Console\Api\Formatter\Style[]
The styles indexed by their tags.
Webmozart Console API API documentation generated by ApiGen