PHP_Beautifier
[ class tree: PHP_Beautifier ] [ index: PHP_Beautifier ] [ all elements ]

Class: PHP_Beautifier_Filter_IndentStyles

Source Location: /PHP_Beautifier-0.1.15/Beautifier/Filter/IndentStyles.filter.php

Class Overview

PHP_Beautifier_Filter
   |
   --PHP_Beautifier_Filter_IndentStyles

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


Author(s):

Version:

  • Release: 0.1.15

Copyright:

  • 2004-2010 Claudio Bustos

Variables

Methods


Inherited Variables

Inherited Methods

Class: PHP_Beautifier_Filter

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.
PHP_Beautifier_Filter::addSettingDefinition()
Add a setting definition
PHP_Beautifier_Filter::getDescription()
PHP_Beautifier_Filter::getName()
return @string
PHP_Beautifier_Filter::getSetting()
Get a setting of the Filter
PHP_Beautifier_Filter::handleToken()
Function called from PHP_Beautifier::process() to process the tokens.
PHP_Beautifier_Filter::off()
Turn off the Filter Use inside the code to beautify Ex.
PHP_Beautifier_Filter::on()
Turn on the Filter Use inside the code to beautify Ex.
PHP_Beautifier_Filter::postProcess()
Called from PHP_Beautifier::process() at the end of processing
PHP_Beautifier_Filter::preProcess()
Called from PHP_Beautifier::process() at the beginning
PHP_Beautifier_Filter::setSetting()
Set a value of a Setting
PHP_Beautifier_Filter::__call()
PHP_Beautifier_Filter::__sleep()
PHP_Beautifier_Filter::__toString()

Class Details

[line 75]
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.   }



[ Top ]


Class Variables

$aAllowedStyles = array(
        "k&r" => "kr",
        "allman" => "bsd",
        "bsd" => "bsd",
        "gnu" => "gnu",
        "whitesmiths" => "ws",
        "ws" => "ws"
    )

[line 80]

  • Access: public

Type:   mixed


[ Top ]

$aSettings = array(
        'style' => 'K&R'
    )

[line 77]

  • Access: protected

Type:   mixed
Overrides:   Array


[ Top ]

$sDescription =  'Filter the code in 4 different indent styles: K&R, Allman, Whitesmiths and GNU'

[line 88]

  • Access: protected

Type:   mixed
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 89]

PHP_Beautifier_Filter_IndentStyles __construct( PHP_Beautifier $oBeaut, [ $aSettings = array()])

  • Access: public

Overrides 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.)

Parameters:

PHP_Beautifier   $oBeaut   — 
   $aSettings   — 

[ Top ]

t_close_brace_bsd   [line 124]

void t_close_brace_bsd( string $sTag)

Close braces in BSD style

Parameters:

string   $sTag   —  '}'

[ Top ]

t_close_brace_gnu   [line 168]

void t_close_brace_gnu( string $sTag)

Close braces in GNU style

Parameters:

string   $sTag   —  '}'

[ Top ]

t_close_brace_ws   [line 152]

void t_close_brace_ws( string $sTag)

Close braces in Whitesmiths style

Parameters:

string   $sTag   —  '}'

[ Top ]

t_else   [line 200]

void|PHP_Beautifier_Filter::BYPASS t_else( string $sTag)

Else for bds, gnu & ws

Parameters:

string   $sTag   —  else or elseif

[ Top ]

t_open_brace_bsd   [line 113]

void t_open_brace_bsd( string $sTag)

Open braces in BSD style

Parameters:

string   $sTag   —  '{'

[ Top ]

t_open_brace_gnu   [line 186]

void t_open_brace_gnu( string $sTag)

Open braces in GNU style

Parameters:

string   $sTag   —  '{'

[ Top ]

t_open_brace_ws   [line 140]

void t_open_brace_ws( string $sTag)

Open braces in Whitesmiths style

Parameters:

string   $sTag   —  '{'

[ Top ]

__call   [line 94]

void __call( $sMethod, $aArgs)

  • Access: public

Overrides PHP_Beautifier_Filter::__call() (parent method not documented)

Parameters:

   $sMethod   — 
   $aArgs   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:37:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.