PHP Class Box\Spout\Writer\Common\Helper\AbstractStyleHelper

Exibir arquivo Open project: box/spout Class Usage Examples

Protected Properties

Property Type Description
$serializedStyleToStyleIdMappingTable [SERIALIZED_STYLE] => [STYLE_ID] mapping table, keeping track of the registered styles
$styleIdToStyleMappingTable [STYLE_ID] => [STYLE] mapping table, keeping track of the registered styles

Public Methods

Method Description
__construct ( Style $defaultStyle )
applyExtraStylesIfNeeded ( Style $style, array $dataRow ) : Style Apply additional styles if the given row needs it.
registerStyle ( Style $style ) : Style Registers the given style as a used style.

Protected Methods

Method Description
applyWrapTextIfCellContainsNewLine ( Style $style, array $dataRow ) : Style Set the "wrap text" option if a cell of the given row contains a new line.
getDefaultStyle ( ) : Style Returns the default style
getRegisteredStyles ( ) : Style[]
getStyleFromSerializedStyle ( string $serializedStyle ) : Style Returns the registered style associated to the given serialization.
hasStyleAlreadyBeenRegistered ( Style $style ) : boolean Returns whether the given style has already been registered.

Method Details

__construct() public method

public __construct ( Style $defaultStyle )
$defaultStyle Box\Spout\Writer\Style\Style

applyExtraStylesIfNeeded() public method

Typically, set "wrap text" if a cell contains a new line.
public applyExtraStylesIfNeeded ( Style $style, array $dataRow ) : Style
$style Box\Spout\Writer\Style\Style The original style
$dataRow array The row the style will be applied to
return Box\Spout\Writer\Style\Style The updated style

applyWrapTextIfCellContainsNewLine() protected method

Set the "wrap text" option if a cell of the given row contains a new line.
protected applyWrapTextIfCellContainsNewLine ( Style $style, array $dataRow ) : Style
$style Box\Spout\Writer\Style\Style The original style
$dataRow array The row the style will be applied to
return Box\Spout\Writer\Style\Style The eventually updated style

getDefaultStyle() protected method

Returns the default style
protected getDefaultStyle ( ) : Style
return Box\Spout\Writer\Style\Style Default style

getRegisteredStyles() protected method

protected getRegisteredStyles ( ) : Style[]
return Box\Spout\Writer\Style\Style[] List of registered styles

getStyleFromSerializedStyle() protected method

Returns the registered style associated to the given serialization.
protected getStyleFromSerializedStyle ( string $serializedStyle ) : Style
$serializedStyle string The serialized style from which the actual style should be fetched from
return Box\Spout\Writer\Style\Style

hasStyleAlreadyBeenRegistered() protected method

Returns whether the given style has already been registered.
protected hasStyleAlreadyBeenRegistered ( Style $style ) : boolean
$style Box\Spout\Writer\Style\Style
return boolean

registerStyle() public method

Duplicate styles won't be registered more than once.
public registerStyle ( Style $style ) : Style
$style Box\Spout\Writer\Style\Style The style to be registered
return Box\Spout\Writer\Style\Style The registered style, updated with an internal ID.

Property Details

$serializedStyleToStyleIdMappingTable protected_oe property

[SERIALIZED_STYLE] => [STYLE_ID] mapping table, keeping track of the registered styles
protected $serializedStyleToStyleIdMappingTable

$styleIdToStyleMappingTable protected_oe property

[STYLE_ID] => [STYLE] mapping table, keeping track of the registered styles
protected $styleIdToStyleMappingTable