function Comment::getRawText
Returns the comment raw text
Return value
string
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Node/ Comment.php, line 120
Class
- Comment
- A node that represents a comment.
Namespace
Peast\Syntax\NodeCode
public function getRawText() {
$text = $this->getText();
$kind = $this->getKind();
if ($kind === self::KIND_MULTILINE) {
$sanitize = "*/";
}
else {
$sanitize = array(
"\n",
"\r",
);
}
$text = str_replace($sanitize, "", $text);
if ($kind === self::KIND_INLINE) {
return "//" . $text;
}
elseif ($kind === self::KIND_HASHBANG) {
return "#!" . $text;
}
elseif ($kind === self::KIND_HTML_OPEN) {
return "<!--" . $text;
}
elseif ($kind === self::KIND_HTML_CLOSE) {
return "-->" . $text;
}
else {
return "/*" . $text . "*/";
}
}