phing-filters

# Class: ReplaceTokens Source Location: /filters/ReplaceTokens.php
### Class Overview
    Reader
       |
       --FilterReader
          |
          --BaseFilterReader
             |
             --BaseParamFilterReader
                |
                --ReplaceTokens
Replaces tokens in the original input with user-supplied values. #### Author(s): <href="mailto:yl@seasonfive.com" a href="mailto:yl@seasonfive.com">Yannick Lecaillez</a> hans lellelid, hans@velum.net #### Version: $Revision: 557 $ $Date: 2009-08-29 15:54:38 +0200 (Sat, 29 Aug 2009) $ #### Copyright: © 2003 seasonfive. All rights reserved Implements interfaces: ChainableReader | ### Constants DEFAULT_BEGIN_TOKEN DEFAULT_END_TOKEN | ### Methods chain createToken createTokensource getBeginToken getEndToken getTokens getTokensources read setBeginToken setEndToken setTokens setTokensources
### Inherited Variables #### Class: BaseParamFilterReader BaseParamFilterReader::$_parameters #### Class: BaseFilterReader BaseFilterReader::$initialized BaseFilterReader::$project #### Class: FilterReader FilterReader::$in | ### Inherited Methods #### Class: BaseParamFilterReader BaseParamFilterReader::getParameters() BaseParamFilterReader::setParameters() #### Class: BaseFilterReader BaseFilterReader::__construct() Constructor used by Phing's introspection mechanism. BaseFilterReader::eof() Returns whether the end of file has been reached with input stream. BaseFilterReader::getInitialized() Returns the initialized status. BaseFilterReader::getProject() Returns the project this filter is part of. BaseFilterReader::log() Convenience method to support logging in filters. BaseFilterReader::read() Reads characters. BaseFilterReader::readLine() Reads a line of text ending with '\n' (or until the end of the stream). BaseFilterReader::setInitialized() Sets the initialized status. BaseFilterReader::setProject() Sets the project to work with. #### Class: FilterReader FilterReader::__construct() FilterReader::close() FilterReader::getResource() FilterReader::read() Read data from source. FilterReader::reset() FilterReader::setReader() FilterReader::skip() #### Class: Reader Reader::close() Close stream. Reader::getResource() Returns the filename, url, etc. that is being read from. Reader::mark() If supported, places a "marker" (like a bookmark) at current stream position. Reader::markSupported() Whether marking is supported. Reader::read() Read data from source. Reader::ready() Is stream ready for reading. Reader::reset() Reset the current position in stream to beginning or last mark (if supported). Reader::skip() Move stream position relative to current pos.
### Class Details [line 51] Replaces tokens in the original input with user-supplied values. Example:
    ;
Or:
#### Tags:
author: | <href="mailto:yl@seasonfive.com" a href="mailto:yl@seasonfive.com">Yannick Lecaillez</a>
author: | hans lellelid, hans@velum.net
version: | $Revision: 557 $ $Date: 2009-08-29 15:54:38 +0200 (Sat, 29 Aug 2009) $
copyright: | © 2003 seasonfive. All rights reserved
see: | BaseParamFilterReader
access: | public
[ Top ] ### Class Methods ### method chain [line 293]
`object A chain( $reader)`
Creates a new ReplaceTokens using the passed in Reader for instantiation. #### Tags:
return: | new filter based on this configuration, but filtering the specified reader
Implementation of: ChainableReader::chain() Returns a reader with the same configuration as this one, but filtering input from the specified reader. #### Parameters:
object A | $reader | Reader object providing the underlying stream. Must not be null .
[ Top ] ### method createToken [line 220]
`object The createToken( )`
Adds a token element to the map of tokens to replace. #### Tags:
return: | token added to the map of replacements. Must not be null .
[ Top ] ### method createTokensource [line 230]
`object A createTokensource( )`
Adds a token source to the sources of this filter. #### Tags:
return: | Reference to the source just added.
[ Top ] ### method getBeginToken [line 192]
`string getBeginToken( )`
Returns the "begin token" character. #### Tags:
return: | The character used to denote the beginning of a token.
[ Top ] ### method getEndToken [line 210]
`the getEndToken( )`
Returns the "end token" character. #### Tags:
return: | character used to denote the beginning of a token
[ Top ] ### method getTokens [line 257]
`array getTokens( )`
Returns the map of tokens which will be replaced. ; used by ReplaceTokens::chain() #### Tags:
return: | A map (String->String) of token keys to replacement values.
[ Top ] ### method getTokensources [line 279]
`array getTokensources( )`
Returns the token sources used by this filter; used by ReplaceTokens::chain() [ Top ] ### method read [line 157]
`mixed read( [ $len = null])`
Returns 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. #### Tags:
return: | filtered stream, -1 on EOF.
Overrides BaseFilterReader::read() (Reads characters.) #### Parameters:
| $len |
[ Top ] ### method setBeginToken [line 183]
`void setBeginToken( string $beginToken)`
Sets the "begin token" character. #### Parameters:
string | $beginToken | the character used to denote the beginning of a token.
[ Top ] ### method setEndToken [line 201]
`void setEndToken( string $endToken)`
Sets the "end token" character. #### Parameters:
string | $endToken | the character used to denote the end of a token
[ Top ] ### method setTokens [line 242]
`void setTokens( array $tokens)`
Sets the map of tokens to replace. ; used by ReplaceTokens::chain() #### Parameters:
array | $tokens | A map (String->String) of token keys to replacement values. Must not be null .
[ Top ] ### method setTokensources [line 266]
`void setTokensources( array $sources)`
Sets the tokensources to use; used by ReplaceTokens::chain() #### Parameters:
array | $sources | An array of token sources.
[ Top ] ### Class Constants #### DEFAULT_BEGIN_TOKEN = "@" [line 57] Default "begin token" character. [ Top ] #### DEFAULT_END_TOKEN = "@" [line 63] Default "end token" character. [ Top ] Documentation generated on Mon, 19 Oct 2009 10:51:55 +0200 by phpDocumentor 1.4.3