PHP Class ReplaceTokens, symfony-1.4

Example:
;
  
Or:

  
  
  
See also: BaseParamFilterReader
Author: hans lellelid, [email protected]
Inheritance: extends BaseParamFilterReader, implements ChainableReader
Mostra file Open project: vjousse/symfony-1.4 Class Usage Examples

Public Methods

Method Description
chain ( Reader $reader ) : object Creates a new ReplaceTokens using the passed in Reader for instantiation.
createToken ( ) : object Adds a token element to the map of tokens to replace.
createTokensource ( ) : object Adds a token source to the sources of this filter.
getBeginToken ( ) : string Returns the "begin token" character.
getEndToken ( ) : the Returns the "end token" character.
getTokens ( ) : array Returns the map of tokens which will be replaced.
getTokensources ( ) : array Returns the token sources used by this filter; used by ReplaceTokens::chain()
read ( $len = null ) : mixed Returns stream with tokens having been replaced with appropriate values.
setBeginToken ( string $beginToken ) Sets the "begin token" character.
setEndToken ( string $endToken ) Sets the "end token" character.
setTokens ( $tokens ) Sets the map of tokens to replace.
setTokensources ( $sources ) Sets the tokensources to use; used by ReplaceTokens::chain()

Private Methods

Method Description
_initialize ( ) Initializes tokens and loads the replacee-replacer hashtable.
replaceTokenCallback ( array $matches ) : string Performs lookup on key and returns appropriate replacement string.

Method Details

chain() public method

Creates a new ReplaceTokens using the passed in Reader for instantiation.
public chain ( Reader $reader ) : object
$reader Reader
return object A new filter based on this configuration, but filtering the specified reader

createToken() public method

Adds a token element to the map of tokens to replace.
public createToken ( ) : object
return object The token added to the map of replacements. Must not be null.

createTokensource() public method

Adds a token source to the sources of this filter.
public createTokensource ( ) : object
return object A Reference to the source just added.

getBeginToken() public method

Returns the "begin token" character.
public getBeginToken ( ) : string
return string The character used to denote the beginning of a token.

getEndToken() public method

Returns the "end token" character.
public getEndToken ( ) : the
return the character used to denote the beginning of a token

getTokens() public method

; used by ReplaceTokens::chain()
public getTokens ( ) : array
return array A map (String->String) of token keys to replacement values.

getTokensources() public method

Returns the token sources used by this filter; used by ReplaceTokens::chain()
public getTokensources ( ) : array
return array

read() public method

If a replacement value is not found for a token, the token is left in the stream.
public read ( $len = null ) : mixed
return mixed filtered stream, -1 on EOF.

setBeginToken() public method

Sets the "begin token" character.
public setBeginToken ( string $beginToken )
$beginToken string the character used to denote the beginning of a token.

setEndToken() public method

Sets the "end token" character.
public setEndToken ( string $endToken )
$endToken string the character used to denote the end of a token

setTokens() public method

; used by ReplaceTokens::chain()
public setTokens ( $tokens )

setTokensources() public method

Sets the tokensources to use; used by ReplaceTokens::chain()
public setTokensources ( $sources )