TextStrings
Utility functions for working with text string tokens.
Table of Contents
| getCompleteTextString() | Get the complete contents of a - potentially multi-line - text string. | string |
|---|---|---|
| stripQuotes() | Strip text delimiter quotes from an arbitrary string. | string |
Methods
getCompleteTextString()
Get the complete contents of a - potentially multi-line - text string.
public
static getCompleteTextString(
$phpcsFile :
File
, $stackPtr :
int
[, $stripQuotes :
bool
= true ]
)
: string
Parameters
- $phpcsFile : File
The file where this token was found.
- $stackPtr : int
Pointer to the first text string token of a multi-line text string or to a Nowdoc/Heredoc opener.
- $stripQuotes : bool = true
Optional. Whether to strip text delimiter quotes off the resulting text string. Defaults to true.
Tags
Return values
stringstripQuotes()
Strip text delimiter quotes from an arbitrary string.
public
static stripQuotes(
$string :
string
)
: string
Intended for use with the "contents" of a T_CONSTANT_ENCAPSED_STRING / T_DOUBLE_QUOTED_STRING.
Prevents stripping mis-matched quotes. Prevents stripping quotes from the textual content of the string.
Parameters
- $string : string
The raw string.
Tags
Return values
string —String without quotes around it.