PHP Class PhpParser\Comment

Afficher le fichier Open project: nikic/php-parser Class Usage Examples

Protected Properties

Свойство Type Description
$filePos
$line
$text

Méthodes publiques

Méthode Description
__construct ( string $text, integer $startLine, integer $startFilePos ) Constructs a comment node.
__toString ( ) : string Gets the comment text.
getFilePos ( ) : integer Gets the file offset the comment started on.
getLine ( ) : integer Gets the line number the comment started on.
getReformattedText ( ) : mixed | string Gets the reformatted comment text.
getText ( ) : string Gets the comment text.
jsonSerialize ( )

Private Methods

Méthode Description
getShortestWhitespacePrefixLen ( $str )

Method Details

__construct() public méthode

Constructs a comment node.
public __construct ( string $text, integer $startLine, integer $startFilePos )
$text string Comment text (including comment delimiters like /*)
$startLine integer Line number the comment started on
$startFilePos integer File offset the comment started on

__toString() public méthode

Gets the comment text.
public __toString ( ) : string
Résultat string The comment text (including comment delimiters like /*)

getFilePos() public méthode

Gets the file offset the comment started on.
public getFilePos ( ) : integer
Résultat integer File offset

getLine() public méthode

Gets the line number the comment started on.
public getLine ( ) : integer
Résultat integer Line number

getReformattedText() public méthode

"Reformatted" here means that we try to clean up the whitespace at the starts of the lines. This is necessary because we receive the comments without trailing whitespace on the first line, but with trailing whitespace on all subsequent lines.
public getReformattedText ( ) : mixed | string
Résultat mixed | string

getText() public méthode

Gets the comment text.
public getText ( ) : string
Résultat string The comment text (including comment delimiters like /*)

jsonSerialize() public méthode

public jsonSerialize ( )

Property Details

$filePos protected_oe property

protected $filePos

$line protected_oe property

protected $line

$text protected_oe property

protected $text