Skip to content

Commit

Permalink
Change misleading method name
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.php.net/repository/pear/packages/Text_Wiki/trunk@208175 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
bertrand Gugger committed Feb 28, 2006
1 parent de1dc1e commit cd60e08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Text/Wiki.php
Expand Up @@ -345,7 +345,7 @@ class Text_Wiki {
* @param array $rules The set of rules to load for this object. Defaults
* to null, which will load the default ruleset for this parser.
* @param string $parser The parser to be used (defaults to 'Default').
* For non-Default parsers, consider using the singleton() method instead
* For non-Default parsers, consider using the mill() method instead
* as the fetching of the rulesets from non-Default parsers causes an
* extra object instantiation, which is slower.
*/
Expand Down Expand Up @@ -388,17 +388,17 @@ function Text_Wiki($rules = null, $parser = 'Default')
}

/**
* Singleton.
* mill.
*
* This avoids instantiating multiple Text_Wiki instances where a number
* of objects are required in one call, e.g. to save memory in a
* CMS invironment where several parsers are required in a single page.
*
* $single = & singleton();
* $single = & mill();
*
* or
*
* $single = & singleton( array('Prefilter', 'Delimiter', 'Code', 'Function',
* $single = & mill( array('Prefilter', 'Delimiter', 'Code', 'Function',
* 'Html', 'Raw', 'Include', 'Embed', 'Anchor', 'Heading', 'Toc', 'Horiz',
* 'Break', 'Blockquote', 'List', 'Deflist', 'Table', 'Image', 'Phplookup',
* 'Center', 'Newline', 'Paragraph', 'Url', 'Freelink', 'Interwiki', 'Wikilink',
Expand All @@ -412,7 +412,7 @@ function Text_Wiki($rules = null, $parser = 'Default')
* After calling this, call $single->setParseConf(), setRenderConf() or setFormatConf()
* as usual for a constructed object of this class.
*
* The internal static array of singleton objects has no index on the parser
* The internal static array of mill objects has no index on the parser
* rules, the only index is on the parser name. So if you call this multiple
* times with different rules but the same parser name, you will get the same
* static parser object each time.
Expand All @@ -424,7 +424,7 @@ function Text_Wiki($rules = null, $parser = 'Default')
* @param string $parser The parser to be used (defaults to 'Default').
* @return &object a reference to the Text_Wiki unique instantiation.
*/
function &singleton($rules = null, $parser = 'Default')
function &mill($rules = null, $parser = 'Default')
{
static $only = array();
if (!isset($only[$parser])) {
Expand Down
6 changes: 3 additions & 3 deletions doc/test_Text_Wiki.php
Expand Up @@ -53,13 +53,13 @@
}

// instantiate a Text_Wiki object from the given class
$wiki = & Text_Wiki::singleton(null, $parser);
$wiki = & Text_Wiki::mill(null, $parser);

// Wiki.php 1.37 and prior, use this:
#$wiki = & Text_Wiki::singleton($parser);
#$wiki = & Text_Wiki::mill($parser);

// include this line of code instead to test creating an object
// using the constructor rather than the singleton method.
// using the constructor rather than the mill method.
#$wiki = new Text_Wiki(null, $parser);

#print "<pre>\n";
Expand Down

0 comments on commit cd60e08

Please sign in to comment.