Source for file Filter.php
Documentation is available at Filter.php
* Definition of class PHP_Beautifier_Filter
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* Definition for creation of Filters
* For concrete details, please see {@link PHP_Beautifier_Filter_Default}
* @package PHP_Beautifier
* @tutorial PHP_Beautifier/Filter/Filter.create.pkg
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
* Stores a reference to main PHP_Beautifier
* Associative array of functions to use when some token are found
* Settings for the Filter
* Definition of the settings
* Should be an associative array. The keys are the names of settings
* and the values are an array with the keys 'type' and '
* Description of the Filter
* If a method for parse Tokens of a Filter returns this, the control of the process
* is handle by the next Filter
* Switch to 'turn' on and off the filter
* If you need to overload this (for example, to create a
* definition for setting with {@link addSettingDefinition()}
* remember call the parent constructor.
* parent::__construct($oBeaut, $aSettings)
* @param array settings for the Filter
public function __construct(PHP_Beautifier $oBeaut, $aSettings = array ())
* Add a setting definition
'description' => $sDescription
* Use inside the code to beautify
final public function on()
* Use inside the code to beautify
* Get a setting of the Filter
* @param string name of setting
* @return mixed value of setting or false
* Set a value of a Setting
* @param string name of setting
* @param mixed value of setting
final public function setSetting($sSetting, $sValue)
* Function called from {@link PHP_Beautifier::process()} to process the tokens.
* If the received token is one of the keys of {@link $aFilterTokenFunctions}
* a function with the same name of the value of that key is called.
* If the method doesn't exists, {@link __call()} is called, and return
* {@link PHP_Beautifier_Filter::BYPASS}. PHP_Beautifier, now, call the next Filter is its list.
* If the method exists, it can return true or {@link PHP_Beautifier_Filter::BYPASS}.
* @return bool true if the token is processed, false bypass to the next Filter
* @see PHP_Beautifier::process()
$sMethod = $sValue = false;
echo $sMethod . ":" . trim($sValue) . "\n";
// return false if PHP_Beautifier_Filter::BYPASS
} else { // WEIRD!!! -> Add the same received
* @return mixed null or {@link PHP_Beautifier_Filter::BYPASS}
public function __call($sMethod, $aArgs)
* Called from {@link PHP_Beautifier::process()} at the beginning
* Called from {@link PHP_Beautifier::process()} at the end of processing
* The post-process must be made in {@link PHP_Beautifier::$aOut}
// php_beautifier->setBeautify(false);
$sOut= 'Filter: '. $this->getName(). "\n".
$sOut.= "Settings: No declared settings";
$sOut.= sprintf("- %s : %s (type %s)\n",$sSetting, $aSettings['description'], $aSettings['type']);
// php_beautifier->setBeautify(true);
Documentation generated on Sun, 22 Jun 2008 05:00:24 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|