classes/phing/filters/ReplaceTokens.php
\ReplaceTokens
Replaces tokens in the original input with user-supplied values.
Example:
;
Or:
- Extends from
- \BaseParamFilterReader
- Implements
- \ChainableReader
- see
- \BaseParamFilterReader
- access
- public
- author
- Yannick Lecaillez
- author
- hans lellelid, hans@velum.net
- copyright
- © 2003 seasonfive. All rights reserved
- package
- phing.filters
- version
- $Revision: 1039 $ $Date: 2011-02-20 20:19:21 +0100 (Sun, 20 Feb 2011) $
Constants
Properties

array
$_alltokens= 'null'
Array holding all tokens given directly to the Filter and those passed via a TokenSource.
nullDetails- Type
- array

string
$_beginToken= '@'
Character marking the beginning of a token.
@Details- Type
- string

string
$_queuedData= 'null'
[Deprecated] Data that must be read from, if not null.
nullDetails- Type
- string

array
$_tokens= 'array'
Array to hold the replacee-replacer pairs (String to String).
arrayDetails- Type
- array
Methods

_initialize(
)
:
Initializes tokens and loads the replacee-replacer hashtable.
This method is only called when this filter is used through
a

chain(
object $reader
)
:
objectCreates a new ReplaceTokens using the passed in
Reader for instantiation.
| Name | Type | Description |
|---|---|---|
| $reader | object | A Reader object providing the underlying stream. Must not be |
| Type | Description |
|---|---|
| object |

createToken(
)
:
objectAdds a token element to the map of tokens to replace.
| Type | Description |
|---|---|
| object |

createTokensource(
)
:
objectAdds a token source to the sources of this filter.
| Type | Description |
|---|---|
| object |

getTokens(
)
:
arrayReturns the map of tokens which will be replaced.
; used by ReplaceTokens::chain()
| Type | Description |
|---|---|
| array |

getTokensources(
)
:
arrayReturns the token sources used by this filter; used by ReplaceTokens::chain()
| Type | Description |
|---|---|
| array |

read(
$len
=
null
)
:
mixedReturns stream with tokens having been replaced with appropriate values.
If a replacement value is not found for a token, the token is left in the stream.
| Name | Type | Description |
|---|---|---|
| $len |
| Type | Description |
|---|---|
| mixed |

replaceTokenCallback(
array $matches
)
:
stringPerforms lookup on key and returns appropriate replacement string.
| Name | Type | Description |
|---|---|---|
| $matches | array | Array of 1 el containing key to search for. |
| Type | Description |
|---|---|
| string |
- access
- private

setBeginToken(
string $beginToken
)
:
Sets the "begin token" character.
| Name | Type | Description |
|---|---|---|
| $beginToken | string | the character used to denote the beginning of a token. |

setEndToken(
string $endToken
)
:
Sets the "end token" character.
| Name | Type | Description |
|---|---|---|
| $endToken | string | the character used to denote the end of a token |

setTokens(
array $tokens
)
:
Sets the map of tokens to replace.
; used by ReplaceTokens::chain()
| Name | Type | Description |
|---|---|---|
| $tokens | array | A map (String->String) of token keys to replacement values. Must not be |
\Token
Holds a token.
- package
- phing.filters