Class PHP_Beautifier_Filter_IndentStyles

Description

Filter Indent Styles: Indent the code in k&r, allman, gnu or whitesmiths

Use 'style' setting to select the style. You can change the style inside the file, using the callbacks features. The following is a description taken from http://catb.org/~esr/jargon/html/I/indent-style.html

K&R style ['k&r'] Named after Kernighan & Ritchie, because the examples in K&R are formatted this way. Also called kernel style because the Unix kernel is written in it, and the "One True Brace Style" (abbrev. 1TBS) by its partisans. In C code, the body is typically indented by eight spaces (or one tab) per level, as shown here. Four spaces are occasionally seen in C, but in C++ and Java four tends to be the rule rather than the exception.

  1. if (<cond>{
  2.    <body>
  3.    }

Allman style ['allman' or 'bsd'] Named for Eric Allman, a Berkeley hacker who wrote a lot of the BSD utilities in it (it is sometimes called BSD style). Resembles normal indent style in Pascal and Algol. It is the only style other than K&R in widespread use among Java programmers. Basic indent per level shown here is eight spaces, but four (or sometimes three) spaces are generally preferred by C++ and Java programmers.

  1.    if (<cond>)
  2.    {
  3.         <body>
  4.    }

Whitesmiths style ['whitesmiths']? popularized by the examples that came with Whitesmiths C, an early commercial C compiler. Basic indent per level shown here is eight spaces, but four spaces are occasionally seen.

  1.  if (<cond>)
  2.      {
  3.      <body>
  4.      }

GNU style ['gnu'] Used throughout GNU EMACS and the Free Software Foundation code, and just about nowhere else. Indents are always four spaces per level, with { and } halfway between the outer and inner indent levels.

  1.  if (<cond>)
  2.   {
  3.     <body>
  4.   }

Located in /Beautifier/Filter/IndentStyles.filter.php (line 75)

PHP_Beautifier_Filter
   |
   --PHP_Beautifier_Filter_IndentStyles
Variable Summary
Method Summary
 PHP_Beautifier_Filter_IndentStyles __construct (PHP_Beautifier $oBeaut, [ $aSettings = array()])
 void t_close_brace_bsd (string $sTag)
 void t_close_brace_gnu (string $sTag)
 void t_close_brace_ws (string $sTag)
 void|PHP_Beautifier_Filter::BYPASS t_else (string $sTag)
 void t_open_brace_bsd (string $sTag)
 void t_open_brace_gnu (string $sTag)
 void t_open_brace_ws (string $sTag)
 void __call ( $sMethod,  $aArgs)
Variables
mixed $aAllowedStyles = array(
"k&r" => "kr",
"allman" => "bsd",
"bsd" => "bsd",
"gnu" => "gnu",
"whitesmiths" => "ws",
"ws" => "ws"
)
(line 80)
  • access: public
mixed $aSettings = array(
'style' => 'K&R'
)
(line 77)
  • access: protected

Redefinition of:
PHP_Beautifier_Filter::$aSettings
Settings for the Filter
mixed $sDescription = 'Filter the code in 4 different indent styles: K&R, Allman, Whitesmiths and GNU' (line 88)
  • access: protected

Redefinition of:
PHP_Beautifier_Filter::$sDescription
Description of the Filter

Inherited Variables

Inherited from PHP_Beautifier_Filter

PHP_Beautifier_Filter::$aFilterTokenFunctions
PHP_Beautifier_Filter::$aSettingsDefinition
PHP_Beautifier_Filter::$aToken
PHP_Beautifier_Filter::$bOn
PHP_Beautifier_Filter::$oBeaut
Methods
Constructor __construct (line 89)
  • access: public
PHP_Beautifier_Filter_IndentStyles __construct (PHP_Beautifier $oBeaut, [ $aSettings = array()])

Redefinition of:
PHP_Beautifier_Filter::__construct()
Constructor If you need to overload this (for example, to create a definition for setting with addSettingDefinition() remember call the parent constructor.
t_close_brace_bsd (line 124)

Close braces in BSD style

void t_close_brace_bsd (string $sTag)
  • string $sTag: '}'
t_close_brace_gnu (line 168)

Close braces in GNU style

void t_close_brace_gnu (string $sTag)
  • string $sTag: '}'
t_close_brace_ws (line 152)

Close braces in Whitesmiths style

void t_close_brace_ws (string $sTag)
  • string $sTag: '}'
t_else (line 200)

Else for bds, gnu & ws

void|PHP_Beautifier_Filter::BYPASS t_else (string $sTag)
  • string $sTag: else or elseif
t_open_brace_bsd (line 113)

Open braces in BSD style

void t_open_brace_bsd (string $sTag)
  • string $sTag: '{'
t_open_brace_gnu (line 186)

Open braces in GNU style

void t_open_brace_gnu (string $sTag)
  • string $sTag: '{'
t_open_brace_ws (line 140)

Open braces in Whitesmiths style

void t_open_brace_ws (string $sTag)
  • string $sTag: '{'
__call (line 94)
  • access: public
void __call ( $sMethod,  $aArgs)
  • $sMethod
  • $aArgs

Redefinition of:
PHP_Beautifier_Filter::__call()

Inherited Methods

Inherited From PHP_Beautifier_Filter

 PHP_Beautifier_Filter::__construct()
 PHP_Beautifier_Filter::addSettingDefinition()
 PHP_Beautifier_Filter::getDescription()
 PHP_Beautifier_Filter::getName()
 PHP_Beautifier_Filter::getSetting()
 PHP_Beautifier_Filter::handleToken()
 PHP_Beautifier_Filter::off()
 PHP_Beautifier_Filter::on()
 PHP_Beautifier_Filter::postProcess()
 PHP_Beautifier_Filter::preProcess()
 PHP_Beautifier_Filter::setSetting()
 PHP_Beautifier_Filter::__call()
 PHP_Beautifier_Filter::__sleep()
 PHP_Beautifier_Filter::__toString()
Class Constants

Inherited Constants

Inherited from PHP_Beautifier_Filter

PHP_Beautifier_Filter::BYPASS

Documentation generated on Mon, 31 May 2010 16:16:08 -0400 by phpDocumentor 1.4.3