Skip to content

Commit

Permalink
Replace static with self
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja committed Mar 23, 2017
1 parent 9608bf3 commit 52b84c0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions examples/demo/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static function render(SyntaxTree $syntaxTree)

$corrections = '';
foreach ($syntaxTree->corrections as $correction) {
$description = static::getDescription($correction->type);
$description = self::getDescription($correction->type);
$string = TokenRenderer::renderQueryString($syntaxTree->tokenSequence, $correction->tokens);
$corrections .= "<li><p>{$description}</p></li><div class='overflow'><pre class='correction'>{$string}</pre></div>";
}
Expand Down Expand Up @@ -134,11 +134,11 @@ public static function render(SyntaxTree $syntaxTree)
*/
public static function getDescription($type)
{
if (!isset(static::$descriptions[$type])) {
if (!isset(self::$descriptions[$type])) {
return 'Undefined';
}

return static::$descriptions[$type];
return self::$descriptions[$type];
}
}

Expand All @@ -150,7 +150,7 @@ public static function renderQueryString(TokenSequence $tokenSequence, array $ma

foreach ($tokenSequence->tokens as $token) {
$lexeme = htmlentities($token->lexeme);
$name = static::getTokenTypeName($token);
$name = self::getTokenTypeName($token);

foreach ($markTokens as $markToken) {
if ($markToken === $token) {
Expand All @@ -172,8 +172,8 @@ public static function renderTable(TokenSequence $tokenSequence)

foreach ($tokenSequence->tokens as $index => $token) {
$number = $index + 1;
$matchedTokenString = static::renderMatchedTokenString($tokenSequence, $token);
$tokenTypeName = static::getTokenTypeName($token);
$matchedTokenString = self::renderMatchedTokenString($tokenSequence, $token);
$tokenTypeName = self::getTokenTypeName($token);
$tokenLength = mb_strlen($token->lexeme);
$cells = [];
$cells[] = "<td class='number'>{$number}</td>";
Expand Down Expand Up @@ -213,7 +213,7 @@ private static function getTokenTypeName(Token $token)
case 256:
return 'Right group delimiter';
case 512:
return static::getTermTokenTypeName($token);
return self::getTermTokenTypeName($token);
case 1024:
return 'BAILOUT';
}
Expand Down Expand Up @@ -268,7 +268,7 @@ class SyntaxTreeRenderer
*/
public static function render(SyntaxTree $syntaxTree)
{
$namedArray = static::convert($syntaxTree->rootNode);
$namedArray = self::convert($syntaxTree->rootNode);
$iterator = new RecursiveArrayIterator($namedArray);
$treeIterator = new RecursiveTreeIterator($iterator);
$treeIterator->setPrefixPart(RecursiveTreeIterator::PREFIX_LEFT, '');
Expand Down Expand Up @@ -323,14 +323,14 @@ private static function convert(Node $node)
$subObjects = [];

if ($node instanceof Term) {
$subObjects = static::getTermSubObjects($node);
$subObjects = self::getTermSubObjects($node);
} else {
foreach ($node->getNodes() as $subNode) {
$subObjects[] = static::convert($subNode);
$subObjects[] = self::convert($subNode);
}
}

return new NamedArrayObject(static::getNodeName($node), $subObjects);
return new NamedArrayObject(self::getNodeName($node), $subObjects);
}

private static function getTermSubObjects(Term $term)
Expand Down

0 comments on commit 52b84c0

Please sign in to comment.