function Scanner::commentsForCurrentToken
Gets or sets comments for the current token. If the parameter is an array it associates the given comments array to the current node, otherwise comments for the current token are returned
Parameters
array $comments Comments array:
Return value
array
3 calls to Scanner::commentsForCurrentToken()
- Scanner::consumeCommentsForCurrentToken in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Scanner.php - Consumes comment tokens associated with the current token
- Scanner::getToken in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Scanner.php - Returns the current token
- Scanner::reconsumeCurrentTokenAsRegexp in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Scanner.php - Tries to reconsume the current token as a regexp if possible
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Scanner.php, line 943
Class
- Scanner
- Base class for scanners.
Namespace
Peast\SyntaxCode
protected function commentsForCurrentToken($comments = null) {
$id = $this->currentToken ? spl_object_hash($this->currentToken) : "";
if ($comments !== null) {
$this->commentsMap[$id] = $comments;
}
elseif (isset($this->commentsMap[$id])) {
$comments = $this->commentsMap[$id];
unset($this->commentsMap[$id]);
}
return $comments;
}