Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7430892
Base.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
Base.php
View Options
<?php
/**
* This file is part of the Peast package
*
* (c) Marco Marchiò <marco.mm89@gmail.com>
*
* For the full copyright and license information refer to the LICENSE file
* distributed with this source code
*/
namespace
Peast\Formatter
;
/**
* Base class for formatters, all the formatters must extend this class.
*
* @author Marco Marchiò <marco.mm89@gmail.com>
*
* @abstract
*/
abstract
class
Base
{
/**
* New line character
*
* @var string
*/
protected
$newLine
=
"
\n
"
;
/**
* Indentation character
*
* @var string
*/
protected
$indentation
=
"
\t
"
;
/**
* Boolean that indicates if open curly brackets in code blocks must be
* on a new line
*
* @var bool
*/
protected
$newLineBeforeCurlyBracket
=
false
;
/**
* Boolean that indicates if blocks of code must be wrapped in curly
* brackets also if they contain only one instruction
*
* @var bool
*/
protected
$alwaysWrapBlocks
=
true
;
/**
* Boolean that indicates if operators must be surrounded by spaces
*
* @var bool
*/
protected
$spacesAroundOperators
=
true
;
/**
* Boolean that indicates if content inside round brackets must be
* surrounded by spaces
*
* @var bool
*/
protected
$spacesInsideRoundBrackets
=
false
;
/**
* Boolean that indicates if comments must be rendered
*
* @var bool
*/
protected
$renderComments
=
true
;
/**
* Boolean that indicates if multiline documentation comments
* (for example JSDoc syntax) must be manipulated to match the
* right indentation
*
* @var bool
*/
protected
$recalcCommentsIndent
=
true
;
/**
* Class constructor
*
* @param bool $renderComments True to render the comments if
* the parser has collected them
* and the formatter allows their
* rendering
*/
public
function
__construct
(
$renderComments
=
false
)
{
if
(
$this
->
renderComments
)
{
$this
->
renderComments
=
$renderComments
;
}
}
/**
* Returns the new line character
*
* @return string
*/
public
function
getNewLine
()
{
return
$this
->
newLine
;
}
/**
* Returns the indentation character
*
* @return string
*/
public
function
getIndentation
()
{
return
$this
->
indentation
;
}
/**
* Returns a boolean that indicates if open curly brackets in code blocks
* must be on a new line
*
* @return bool
*/
public
function
getNewLineBeforeCurlyBracket
()
{
return
$this
->
newLineBeforeCurlyBracket
;
}
/**
* Returns a boolean that indicates if blocks of code must be wrapped in
* curly brackets also if they contain only one instruction
*
* @return bool
*/
public
function
getAlwaysWrapBlocks
()
{
return
$this
->
alwaysWrapBlocks
;
}
/**
* Returns a boolean that indicates if operators must be surrounded by
* spaces
*
* @return bool
*/
public
function
getSpacesAroundOperator
()
{
return
$this
->
spacesAroundOperators
;
}
/**
* Returns a boolean that indicates if content inside round brackets must be
* surrounded by spaces
*
* @return bool
*/
public
function
getSpacesInsideRoundBrackets
()
{
return
$this
->
spacesInsideRoundBrackets
;
}
/**
* Returns a boolean that indicates if comments must be rendered
*
* @return bool
*/
public
function
getRenderComments
()
{
return
$this
->
renderComments
;
}
/**
* Returns a boolean that indicates if multiline documentation comments
* (for example JSDoc syntax) must be manipulated to match the
* right indentation
*
* @return bool
*/
public
function
getRecalcCommentsIndent
()
{
return
$this
->
recalcCommentsIndent
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 10:41 (9 h, 10 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b4/8e/02adc640dc383928156119eec726
Default Alt Text
Base.php (4 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment