From 52b84c06b3b4a735ac8ee2a88f850ff3d872265d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 23 Mar 2017 20:44:29 +0100 Subject: [PATCH] Replace static with self --- examples/demo/server.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/demo/server.php b/examples/demo/server.php index 9883069..e7de008 100644 --- a/examples/demo/server.php +++ b/examples/demo/server.php @@ -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 .= "
  • {$description}

  • {$string}
    "; } @@ -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]; } } @@ -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) { @@ -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[] = "{$number}"; @@ -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'; } @@ -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, ''); @@ -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)