Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace PHP_CodeSniffer\Tokenizers; use PHP_CodeSniffer\Config; use PHP_CodeSniff..

Decoded Output download

<?php
 namespace PHP_CodeSniffer\Tokenizers; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Exceptions\TokenizerException; use PHP_CodeSniffer\Util; class JS extends Tokenizer { public $scopeOpeners = array(T_IF => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => false, "shared" => false, "with" => array()), T_TRY => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => true, "shared" => false, "with" => array()), T_CATCH => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => true, "shared" => false, "with" => array()), T_ELSE => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => false, "shared" => false, "with" => array()), T_FOR => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => false, "shared" => false, "with" => array()), T_CLASS => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => true, "shared" => false, "with" => array()), T_FUNCTION => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => false, "shared" => false, "with" => array()), T_WHILE => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => false, "shared" => false, "with" => array()), T_DO => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => true, "shared" => false, "with" => array()), T_SWITCH => array("start" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "end" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "strict" => true, "shared" => false, "with" => array()), T_CASE => array("start" => array(T_COLON => T_COLON), "end" => array(T_BREAK => T_BREAK, T_RETURN => T_RETURN, T_CONTINUE => T_CONTINUE, T_THROW => T_THROW), "strict" => true, "shared" => true, "with" => array(T_DEFAULT => T_DEFAULT, T_CASE => T_CASE, T_SWITCH => T_SWITCH)), T_DEFAULT => array("start" => array(T_COLON => T_COLON), "end" => array(T_BREAK => T_BREAK, T_RETURN => T_RETURN, T_CONTINUE => T_CONTINUE, T_THROW => T_THROW), "strict" => true, "shared" => true, "with" => array(T_CASE => T_CASE, T_SWITCH => T_SWITCH))); public $endScopeTokens = array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET, T_BREAK => T_BREAK); protected $tokenValues = array("class" => "T_CLASS", "function" => "T_FUNCTION", "prototype" => "T_PROTOTYPE", "try" => "T_TRY", "catch" => "T_CATCH", "return" => "T_RETURN", "throw" => "T_THROW", "break" => "T_BREAK", "switch" => "T_SWITCH", "continue" => "T_CONTINUE", "if" => "T_IF", "else" => "T_ELSE", "do" => "T_DO", "while" => "T_WHILE", "for" => "T_FOR", "var" => "T_VAR", "case" => "T_CASE", "default" => "T_DEFAULT", "true" => "T_TRUE", "false" => "T_FALSE", "null" => "T_NULL", "this" => "T_THIS", "typeof" => "T_TYPEOF", "(" => "T_OPEN_PARENTHESIS", ")" => "T_CLOSE_PARENTHESIS", "{" => "T_OPEN_CURLY_BRACKET", "}" => "T_CLOSE_CURLY_BRACKET", "[" => "T_OPEN_SQUARE_BRACKET", "]" => "T_CLOSE_SQUARE_BRACKET", "?" => "T_INLINE_THEN", "." => "T_OBJECT_OPERATOR", "+" => "T_PLUS", "-" => "T_MINUS", "*" => "T_MULTIPLY", "%" => "T_MODULUS", "/" => "T_DIVIDE", "^" => "T_LOGICAL_XOR", "," => "T_COMMA", ";" => "T_SEMICOLON", ":" => "T_COLON", "<" => "T_LESS_THAN", ">" => "T_GREATER_THAN", "<<" => "T_SL", ">>" => "T_SR", ">>>" => "T_ZSR", "<<=" => "T_SL_EQUAL", ">>=" => "T_SR_EQUAL", ">>>=" => "T_ZSR_EQUAL", "<=" => "T_IS_SMALLER_OR_EQUAL", ">=" => "T_IS_GREATER_OR_EQUAL", "=>" => "T_DOUBLE_ARROW", "!" => "T_BOOLEAN_NOT", "||" => "T_BOOLEAN_OR", "&&" => "T_BOOLEAN_AND", "|" => "T_BITWISE_OR", "&" => "T_BITWISE_AND", "!=" => "T_IS_NOT_EQUAL", "!==" => "T_IS_NOT_IDENTICAL", "=" => "T_EQUAL", "==" => "T_IS_EQUAL", "===" => "T_IS_IDENTICAL", "-=" => "T_MINUS_EQUAL", "+=" => "T_PLUS_EQUAL", "*=" => "T_MUL_EQUAL", "/=" => "T_DIV_EQUAL", "%=" => "T_MOD_EQUAL", "++" => "T_INC", "--" => "T_DEC", "//" => "T_COMMENT", "/*" => "T_COMMENT", "/**" => "T_DOC_COMMENT", "*/" => "T_COMMENT"); protected $stringTokens = array("'" => "'", """ => """); protected $commentTokens = array("//" => null, "/*" => "*/", "/**" => "*/"); public function __construct($content, Config $config, $eolChar = "\n") { if ($this->isMinifiedContent($content, $eolChar) === true) { throw new TokenizerException("File appears to be minified and cannot be processed"); } parent::__construct($content, $config, $eolChar); } public function tokenize($string) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9*** START JS TOKENIZING ***" . PHP_EOL; } $maxTokenLength = 0; foreach ($this->tokenValues as $token => $values) { if (strlen($token) > $maxTokenLength) { $maxTokenLength = strlen($token); } } $tokens = array(); $inString = ''; $stringChar = null; $inComment = ''; $buffer = ''; $preStringBuffer = ''; $cleanBuffer = false; $commentTokenizer = new Comment(); $tokens[] = array("code" => T_OPEN_TAG, "type" => "T_OPEN_TAG", "content" => ''); $string = str_replace($this->eolChar, "
", $string); $chars = str_split($string); $numChars = count($chars); for ($i = 0; $i < $numChars; $i++) { $char = $chars[$i]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($char); $bufferContent = Util\Common::prepareForOutput($buffer); if ($inString !== '') { echo "	"; } if ($inComment !== '') { echo "\x9"; } echo "\x9Process char {$i} => {$content} (buffer: {$bufferContent})" . PHP_EOL; } if ($inString === '' && $inComment === '' && $buffer !== '') { if (trim($char) !== '' && trim($buffer) === '') { $tokens[] = array("code" => T_WHITESPACE, "type" => "T_WHITESPACE", "content" => str_replace("\xa", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\x9=> Added token T_WHITESPACE ({$content})" . PHP_EOL; } $buffer = ''; } if ($inString === '' && $inComment === '' && trim($char) === '' && trim($buffer) !== '') { $tokens[] = array("code" => T_STRING, "type" => "T_STRING", "content" => str_replace("
", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\x9=> Added token T_STRING ({$content})" . PHP_EOL; } $buffer = ''; } } if ($inComment === '' && isset($this->stringTokens[$char]) === true) { if ($inString === $char) { $escapes = 0; for ($x = $i - 1; $x >= 0; $x--) { if ($chars[$x] !== "\") { break; } $escapes++; } if ($escapes === 0 || $escapes % 2 === 0) { $tokens[] = array("code" => T_CONSTANT_ENCAPSED_STRING, "type" => "T_CONSTANT_ENCAPSED_STRING", "content" => str_replace("\xa", $this->eolChar, $buffer) . $char); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "	\x9* found end of string *" . PHP_EOL; $content = Util\Common::prepareForOutput($buffer . $char); echo "	=> Added token T_CONSTANT_ENCAPSED_STRING ({$content})" . PHP_EOL; } $buffer = ''; $preStringBuffer = ''; $inString = ''; $stringChar = null; continue; } } else { if ($inString === '') { $inString = $char; $stringChar = $i; $preStringBuffer = $buffer; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9	* looking for string closer *" . PHP_EOL; } } } } if ($inString !== '' && $char === "\xa") { if ($chars[$i - 1] !== "\") { $i = $stringChar; $buffer = $preStringBuffer; $preStringBuffer = ''; $inString = ''; $stringChar = null; $char = $chars[$i]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9* found newline before end of string, bailing *" . PHP_EOL; } } } $buffer .= $char; if ($inString !== '') { continue; } if ($buffer === $char && $char === "/" && $chars[$i + 1] !== "*") { $regex = $this->getRegexToken($i, $string, $chars, $tokens); if ($regex !== null) { $tokens[] = array("code" => T_REGULAR_EXPRESSION, "type" => "T_REGULAR_EXPRESSION", "content" => $regex["content"]); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($regex["content"]); echo "	=> Added token T_REGULAR_EXPRESSION ({$content})" . PHP_EOL; } $i = $regex["end"]; $buffer = ''; $cleanBuffer = false; continue; } } if (isset($this->tokenValues[strtolower($buffer)]) === true && (preg_match("|[a-zA-z0-9_]|", $char) === 0 || isset($chars[$i + 1]) === false || preg_match("|[a-zA-z0-9_]|", $chars[$i + 1]) === 0)) { $matchedToken = false; $lookAheadLength = $maxTokenLength - strlen($buffer); if ($lookAheadLength > 0) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "		* buffer possibly contains token, looking ahead {$lookAheadLength} chars *" . PHP_EOL; } $charBuffer = $buffer; for ($x = 1; $x <= $lookAheadLength; $x++) { if (isset($chars[$i + $x]) === false) { break; } $charBuffer .= $chars[$i + $x]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($charBuffer); echo "	\x9=> Looking ahead {$x} chars => {$content}" . PHP_EOL; } if (isset($this->tokenValues[strtolower($charBuffer)]) === true) { $oldType = $this->tokenValues[strtolower($buffer)]; $newType = $this->tokenValues[strtolower($charBuffer)]; if ($oldType === "T_COMMENT" && $newType === "T_DOC_COMMENT" && $chars[$i + $x + 1] === "/") { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9* look ahead ignored T_DOC_COMMENT, continuing *" . PHP_EOL; } } else { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9* look ahead found more specific token ({$newType}), ignoring {$i} *" . PHP_EOL; } $matchedToken = true; break; } } } } if ($matchedToken === false) { if (PHP_CODESNIFFER_VERBOSITY > 1 && $lookAheadLength > 0) { echo "		* look ahead found nothing *" . PHP_EOL; } $value = $this->tokenValues[strtolower($buffer)]; if ($value === "T_FUNCTION" && $buffer !== "function") { $value = "T_STRING"; } $tokens[] = array("code" => constant($value), "type" => $value, "content" => $buffer); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "	=> Added token {$value} ({$content})" . PHP_EOL; } $cleanBuffer = true; } } else { if (isset($this->tokenValues[strtolower($char)]) === true) { $newContent = substr(str_replace("\xa", $this->eolChar, $buffer), 0, -1); if ($newContent !== '') { $tokens[] = array("code" => T_STRING, "type" => "T_STRING", "content" => $newContent); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput(substr($buffer, 0, -1)); echo "\x9=> Added token T_STRING ({$content})" . PHP_EOL; } } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "	\x9* char is token, looking ahead " . ($maxTokenLength - 1) . " chars *" . PHP_EOL; } $charBuffer = $char; $matchedToken = false; for ($x = 1; $x <= $maxTokenLength; $x++) { if (isset($chars[$i + $x]) === false) { break; } $charBuffer .= $chars[$i + $x]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($charBuffer); echo "		=> Looking ahead {$x} chars => {$content}" . PHP_EOL; } if (isset($this->tokenValues[strtolower($charBuffer)]) === true) { if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokenValues[strtolower($charBuffer)]; echo "		* look ahead found more specific token ({$type}), ignoring {$i} *" . PHP_EOL; } $matchedToken = true; break; } } if ($matchedToken === false) { $value = $this->tokenValues[strtolower($char)]; $tokens[] = array("code" => constant($value), "type" => $value, "content" => $char); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9* look ahead found nothing *" . PHP_EOL; $content = Util\Common::prepareForOutput($char); echo "\x9=> Added token {$value} ({$content})" . PHP_EOL; } $cleanBuffer = true; } else { $buffer = $char; } } } if ($inComment === '' && array_key_exists($buffer, $this->commentTokens) === true) { if (isset($chars[$i - 2]) === true && $chars[$i - 2] === "\") { $lastToken = array_pop($tokens); $lastContent = $lastToken["content"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $value = $this->tokenValues[strtolower($lastContent)]; $content = Util\Common::prepareForOutput($lastContent); echo "\x9=> Removed token {$value} ({$content})" . PHP_EOL; } $lastChars = str_split($lastContent); $lastNumChars = count($lastChars); for ($x = 0; $x < $lastNumChars; $x++) { $lastChar = $lastChars[$x]; $value = $this->tokenValues[strtolower($lastChar)]; $tokens[] = array("code" => constant($value), "type" => $value, "content" => $lastChar); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($lastChar); echo "	=> Added token {$value} ({$content})" . PHP_EOL; } } } else { $inComment = $buffer; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9* looking for end of comment *" . PHP_EOL; } } } else { if ($inComment !== '') { if ($this->commentTokens[$inComment] === null) { if (strpos($buffer, "\xa") !== false) { $inComment = ''; } } else { if ($this->commentTokens[$inComment] === $buffer) { $inComment = ''; } } if (PHP_CODESNIFFER_VERBOSITY > 1) { if ($inComment === '') { echo "	\x9* found end of comment *" . PHP_EOL; } } if ($inComment === '' && $cleanBuffer === false) { $tokens[] = array("code" => T_STRING, "type" => "T_STRING", "content" => str_replace("\xa", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "	=> Added token T_STRING ({$content})" . PHP_EOL; } $buffer = ''; } } } if ($cleanBuffer === true) { $buffer = ''; $cleanBuffer = false; } } if (empty($buffer) === false) { if ($inString !== '') { $tokens[] = array("code" => T_STRING, "type" => "T_STRING", "content" => str_replace("
", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "	=> Added token T_STRING ({$content})" . PHP_EOL; } } else { $tokens[] = array("code" => T_WHITESPACE, "type" => "T_WHITESPACE", "content" => str_replace("
", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "	=> Added token T_WHITESPACE ({$content})" . PHP_EOL; } } } $tokens[] = array("code" => T_CLOSE_TAG, "type" => "T_CLOSE_TAG", "content" => ''); $finalTokens = array(); $newStackPtr = 0; $numTokens = count($tokens); for ($stackPtr = 0; $stackPtr < $numTokens; $stackPtr++) { $token = $tokens[$stackPtr]; if ($token["code"] === T_COMMENT || $token["code"] === T_DOC_COMMENT) { $newContent = ''; $tokenContent = $token["content"]; $endContent = null; if (isset($this->commentTokens[$tokenContent]) === true) { $endContent = $this->commentTokens[$tokenContent]; } while ($tokenContent !== $endContent) { if ($endContent === null && strpos($tokenContent, $this->eolChar) !== false) { $tokens[$stackPtr]["content"] = substr($tokenContent, strpos($tokenContent, $this->eolChar) + strlen($this->eolChar)); $tokenContent = substr($tokenContent, 0, strpos($tokenContent, $this->eolChar) + strlen($this->eolChar)); if ($tokens[$stackPtr]["content"] !== false && $tokens[$stackPtr]["content"] !== '') { $stackPtr--; } break; } $stackPtr++; $newContent .= $tokenContent; if (isset($tokens[$stackPtr]) === false) { break; } $tokenContent = $tokens[$stackPtr]["content"]; } if ($token["code"] === T_DOC_COMMENT) { $commentTokens = $commentTokenizer->tokenizeString($newContent . $tokenContent, $this->eolChar, $newStackPtr); foreach ($commentTokens as $commentToken) { $finalTokens[$newStackPtr] = $commentToken; $newStackPtr++; } continue; } else { $token["content"] = $newContent . $tokenContent; } } if (strpos($token["content"], $this->eolChar) !== false) { $tokenLines = explode($this->eolChar, $token["content"]); $numLines = count($tokenLines); for ($i = 0; $i < $numLines; $i++) { $newToken = array("content" => $tokenLines[$i]); if ($i === $numLines - 1) { if ($tokenLines[$i] === '') { break; } } else { $newToken["content"] .= $this->eolChar; } $newToken["type"] = $token["type"]; $newToken["code"] = $token["code"]; $finalTokens[$newStackPtr] = $newToken; $newStackPtr++; } } else { $finalTokens[$newStackPtr] = $token; $newStackPtr++; } if ($token["code"] === T_STRING || $token["code"] === T_OBJECT_OPERATOR) { $newContent = ''; $oldStackPtr = $stackPtr; while (preg_match("|^[0-9\.]+$|", $tokens[$stackPtr]["content"]) !== 0) { $newContent .= $tokens[$stackPtr]["content"]; $stackPtr++; } if ($newContent !== '' && $newContent !== ".") { $finalTokens[$newStackPtr - 1]["content"] = $newContent; if (ctype_digit($newContent) === true) { $finalTokens[$newStackPtr - 1]["code"] = constant("T_LNUMBER"); $finalTokens[$newStackPtr - 1]["type"] = "T_LNUMBER"; } else { $finalTokens[$newStackPtr - 1]["code"] = constant("T_DNUMBER"); $finalTokens[$newStackPtr - 1]["type"] = "T_DNUMBER"; } $stackPtr--; continue; } else { $stackPtr = $oldStackPtr; } } if ($token["code"] === T_OBJECT_OPERATOR) { for ($i = $stackPtr + 1; $i < $numTokens; $i++) { if (isset(Util\Tokens::$emptyTokens[$tokens[$i]["code"]]) === true) { continue; } if ($tokens[$i]["code"] !== T_PROTOTYPE && $tokens[$i]["code"] !== T_LNUMBER && $tokens[$i]["code"] !== T_DNUMBER) { $tokens[$i]["code"] = T_STRING; $tokens[$i]["type"] = "T_STRING"; } break; } } } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9*** END TOKENIZING ***" . PHP_EOL; } return $finalTokens; } public function getRegexToken($char, $string, $chars, $tokens) { $beforeTokens = array(T_EQUAL => true, T_IS_NOT_EQUAL => true, T_IS_IDENTICAL => true, T_IS_NOT_IDENTICAL => true, T_OPEN_PARENTHESIS => true, T_OPEN_SQUARE_BRACKET => true, T_RETURN => true, T_BOOLEAN_OR => true, T_BOOLEAN_AND => true, T_BOOLEAN_NOT => true, T_BITWISE_OR => true, T_BITWISE_AND => true, T_COMMA => true, T_COLON => true, T_TYPEOF => true, T_INLINE_THEN => true, T_INLINE_ELSE => true); $afterTokens = array("," => true, ")" => true, "]" => true, ";" => true, " " => true, "." => true, ":" => true, $this->eolChar => true); $numTokens = count($tokens); for ($prev = $numTokens - 1; $prev >= 0; $prev--) { if (isset(Util\Tokens::$emptyTokens[$tokens[$prev]["code"]]) === false) { break; } } if (isset($beforeTokens[$tokens[$prev]["code"]]) === false) { return null; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9* token possibly starts a regular expression *" . PHP_EOL; } $numChars = count($chars); for ($next = $char + 1; $next < $numChars; $next++) { if ($chars[$next] === "/") { if ($chars[$next - 1] !== "\") { break; } else { if ($chars[$next - 2] === "\") { break; } } } else { $possibleEolChar = substr($string, $next, strlen($this->eolChar)); if ($possibleEolChar === $this->eolChar) { break; } } } if ($chars[$next] !== "/") { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "	* could not find end of regular expression *" . PHP_EOL; } return null; } while (preg_match("|[a-zA-Z]|", $chars[$next + 1]) !== 0) { $next++; } $regexEnd = $next; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9* found end of regular expression at token {$regexEnd} *" . PHP_EOL; } for ($next += 1; $next < $numChars; $next++) { if ($chars[$next] !== " ") { break; } else { $possibleEolChar = substr($string, $next, strlen($this->eolChar)); if ($possibleEolChar === $this->eolChar) { break; } } } if (isset($afterTokens[$chars[$next]]) === false) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "	* tokens after regular expression do not look correct *" . PHP_EOL; } return null; } $content = ''; for ($x = $char; $x <= $regexEnd; $x++) { $content .= $chars[$x]; } $token = array("start" => $char, "end" => $regexEnd, "content" => $content); return $token; } public function processAdditional() { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9*** START ADDITIONAL JS PROCESSING ***" . PHP_EOL; } $numTokens = count($this->tokens); $classStack = array(); for ($i = 0; $i < $numTokens; $i++) { if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$i]["type"]; $content = Util\Common::prepareForOutput($this->tokens[$i]["content"]); echo str_repeat("	", count($classStack)); echo "\x9Process token {$i}: {$type} => {$content}" . PHP_EOL; } if ($this->tokens[$i]["code"] === T_FUNCTION && isset($this->tokens[$i]["scope_opener"]) === true) { for ($x = $i + 1; $x < $numTokens; $x++) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$x]["code"]]) === false) { break; } } if ($this->tokens[$x]["code"] === T_OPEN_PARENTHESIS) { $this->tokens[$i]["code"] = T_CLOSURE; $this->tokens[$i]["type"] = "T_CLOSURE"; if (PHP_CODESNIFFER_VERBOSITY > 1) { $line = $this->tokens[$i]["line"]; echo str_repeat("\x9", count($classStack)); echo "\x9* token {$i} on line {$line} changed from T_FUNCTION to T_CLOSURE *" . PHP_EOL; } for ($x = $this->tokens[$i]["scope_opener"] + 1; $x < $this->tokens[$i]["scope_closer"]; $x++) { if (isset($this->tokens[$x]["conditions"][$i]) === false) { continue; } $this->tokens[$x]["conditions"][$i] = T_CLOSURE; if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$x]["type"]; echo str_repeat("	", count($classStack)); echo "\x9	* cleaned {$x} ({$type}) *" . PHP_EOL; } } } continue; } else { if ($this->tokens[$i]["code"] === T_OPEN_CURLY_BRACKET && isset($this->tokens[$i]["scope_condition"]) === false && isset($this->tokens[$i]["bracket_closer"]) === true) { $condition = $this->tokens[$i]["conditions"]; $condition = end($condition); if ($condition === T_CLASS) { for ($parenCloser = $i - 1; $parenCloser > 0; $parenCloser--) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$parenCloser]["code"]]) === false) { break; } } if ($this->tokens[$parenCloser]["code"] === T_CLOSE_PARENTHESIS) { $parenOpener = $this->tokens[$parenCloser]["parenthesis_opener"]; for ($name = $parenOpener - 1; $name > 0; $name--) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$name]["code"]]) === false) { break; } } if ($this->tokens[$name]["code"] === T_STRING) { if (PHP_CODESNIFFER_VERBOSITY > 1) { $line = $this->tokens[$name]["line"]; echo str_repeat("\x9", count($classStack)); echo "	* token {$name} on line {$line} changed from T_STRING to T_FUNCTION *" . PHP_EOL; } $closer = $this->tokens[$i]["bracket_closer"]; $this->tokens[$name]["code"] = T_FUNCTION; $this->tokens[$name]["type"] = "T_FUNCTION"; foreach (array($name, $i, $closer) as $token) { $this->tokens[$token]["scope_condition"] = $name; $this->tokens[$token]["scope_opener"] = $i; $this->tokens[$token]["scope_closer"] = $closer; $this->tokens[$token]["parenthesis_opener"] = $parenOpener; $this->tokens[$token]["parenthesis_closer"] = $parenCloser; $this->tokens[$token]["parenthesis_owner"] = $name; } $this->tokens[$parenOpener]["parenthesis_owner"] = $name; $this->tokens[$parenCloser]["parenthesis_owner"] = $name; for ($x = $i + 1; $x < $closer; $x++) { $this->tokens[$x]["conditions"][$name] = T_FUNCTION; ksort($this->tokens[$x]["conditions"], SORT_NUMERIC); if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$x]["type"]; echo str_repeat("\x9", count($classStack)); echo "\x9	* added T_FUNCTION condition to {$x} ({$type}) *" . PHP_EOL; } } continue; } } } $classStack[] = $i; $closer = $this->tokens[$i]["bracket_closer"]; $this->tokens[$i]["code"] = T_OBJECT; $this->tokens[$i]["type"] = "T_OBJECT"; $this->tokens[$closer]["code"] = T_CLOSE_OBJECT; $this->tokens[$closer]["type"] = "T_CLOSE_OBJECT"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", count($classStack)); echo "\x9* token {$i} converted from T_OPEN_CURLY_BRACKET to T_OBJECT *" . PHP_EOL; echo str_repeat("\x9", count($classStack)); echo "	* token {$closer} converted from T_CLOSE_CURLY_BRACKET to T_CLOSE_OBJECT *" . PHP_EOL; } for ($x = $i + 1; $x < $closer; $x++) { $this->tokens[$x]["conditions"][$i] = T_OBJECT; ksort($this->tokens[$x]["conditions"], SORT_NUMERIC); if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$x]["type"]; echo str_repeat("\x9", count($classStack)); echo "	\x9* added T_OBJECT condition to {$x} ({$type}) *" . PHP_EOL; } } } else { if ($this->tokens[$i]["code"] === T_CLOSE_OBJECT) { $opener = array_pop($classStack); } else { if ($this->tokens[$i]["code"] === T_COLON) { if (isset($this->tokens[$i]["scope_condition"]) === true) { continue; } for ($x = $i - 1; $x >= 0; $x--) { if ($this->tokens[$x]["code"] === T_INLINE_THEN) { $this->tokens[$i]["code"] = T_INLINE_ELSE; $this->tokens[$i]["type"] = "T_INLINE_ELSE"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", count($classStack)); echo "	* token {$i} converted from T_COLON to T_INLINE_THEN *" . PHP_EOL; } continue 2; } else { if ($this->tokens[$x]["line"] < $this->tokens[$i]["line"]) { break; } } } for ($label = $i - 1; $label >= 0; $label--) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$label]["code"]]) === false) { break; } } if ($this->tokens[$label]["code"] !== T_STRING && $this->tokens[$label]["code"] !== T_CONSTANT_ENCAPSED_STRING) { continue; } if (empty($classStack) === false) { $this->tokens[$label]["code"] = T_PROPERTY; $this->tokens[$label]["type"] = "T_PROPERTY"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("	", count($classStack)); echo "	* token {$label} converted from T_STRING to T_PROPERTY *" . PHP_EOL; } } else { $this->tokens[$label]["code"] = T_LABEL; $this->tokens[$label]["type"] = "T_LABEL"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("	", count($classStack)); echo "	* token {$label} converted from T_STRING to T_LABEL *" . PHP_EOL; } } } } } } } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "	*** END ADDITIONAL JS PROCESSING ***" . PHP_EOL; } } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace PHP_CodeSniffer\Tokenizers; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Exceptions\TokenizerException; use PHP_CodeSniffer\Util; class JS extends Tokenizer { public $scopeOpeners = array(T_IF => array("\x73\164\x61\162\164" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\145\x6e\x64" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\163\164\162\x69\143\x74" => false, "\x73\150\x61\162\145\144" => false, "\x77\x69\164\150" => array()), T_TRY => array("\163\x74\x61\162\164" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\x65\x6e\144" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\163\164\x72\x69\x63\164" => true, "\163\150\141\x72\x65\x64" => false, "\x77\151\164\x68" => array()), T_CATCH => array("\163\164\x61\162\x74" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\x65\156\144" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\x73\x74\162\x69\x63\164" => true, "\163\x68\141\x72\145\144" => false, "\x77\x69\164\150" => array()), T_ELSE => array("\163\x74\141\162\164" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\145\x6e\x64" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\x73\x74\162\151\x63\x74" => false, "\163\150\x61\x72\145\144" => false, "\x77\x69\x74\150" => array()), T_FOR => array("\x73\x74\x61\162\x74" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\145\156\144" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\163\x74\x72\151\x63\164" => false, "\x73\150\x61\162\x65\x64" => false, "\x77\x69\x74\150" => array()), T_CLASS => array("\163\164\x61\x72\164" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\x65\x6e\x64" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\x73\164\x72\151\x63\x74" => true, "\x73\x68\141\x72\145\x64" => false, "\x77\x69\164\150" => array()), T_FUNCTION => array("\x73\x74\x61\162\x74" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\x65\x6e\x64" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\x73\164\x72\x69\143\164" => false, "\163\150\141\x72\145\144" => false, "\167\151\164\x68" => array()), T_WHILE => array("\x73\164\141\x72\x74" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\145\156\x64" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\x73\164\x72\x69\143\x74" => false, "\163\150\141\162\x65\x64" => false, "\167\151\164\150" => array()), T_DO => array("\x73\x74\x61\162\x74" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\x65\x6e\144" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\163\164\162\151\143\164" => true, "\x73\x68\x61\x72\x65\x64" => false, "\167\x69\164\150" => array()), T_SWITCH => array("\163\164\141\x72\164" => array(T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET), "\145\x6e\144" => array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET), "\163\164\162\151\x63\164" => true, "\x73\150\141\162\x65\144" => false, "\x77\x69\x74\150" => array()), T_CASE => array("\x73\164\141\x72\164" => array(T_COLON => T_COLON), "\x65\156\x64" => array(T_BREAK => T_BREAK, T_RETURN => T_RETURN, T_CONTINUE => T_CONTINUE, T_THROW => T_THROW), "\x73\164\x72\x69\143\164" => true, "\163\150\x61\162\145\144" => true, "\167\151\164\x68" => array(T_DEFAULT => T_DEFAULT, T_CASE => T_CASE, T_SWITCH => T_SWITCH)), T_DEFAULT => array("\x73\x74\x61\x72\164" => array(T_COLON => T_COLON), "\x65\156\144" => array(T_BREAK => T_BREAK, T_RETURN => T_RETURN, T_CONTINUE => T_CONTINUE, T_THROW => T_THROW), "\x73\x74\x72\151\x63\164" => true, "\163\x68\x61\x72\145\x64" => true, "\167\151\x74\x68" => array(T_CASE => T_CASE, T_SWITCH => T_SWITCH))); public $endScopeTokens = array(T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET, T_BREAK => T_BREAK); protected $tokenValues = array("\x63\154\x61\x73\x73" => "\124\x5f\x43\x4c\101\123\123", "\146\165\x6e\143\x74\x69\x6f\156" => "\x54\x5f\x46\x55\x4e\103\124\x49\x4f\116", "\x70\x72\157\x74\157\164\x79\x70\145" => "\124\137\120\122\x4f\x54\x4f\124\x59\x50\105", "\x74\x72\171" => "\124\x5f\x54\x52\131", "\143\x61\164\x63\150" => "\x54\137\x43\101\124\x43\110", "\162\145\164\x75\x72\156" => "\124\137\x52\105\x54\x55\122\116", "\x74\150\x72\x6f\167" => "\124\137\124\x48\122\117\x57", "\x62\162\145\141\x6b" => "\124\137\102\x52\x45\101\113", "\163\167\x69\164\143\150" => "\x54\x5f\123\x57\x49\124\103\110", "\143\157\x6e\x74\x69\x6e\x75\145" => "\124\137\103\117\116\124\x49\x4e\x55\105", "\x69\x66" => "\124\x5f\111\106", "\x65\154\x73\145" => "\124\x5f\105\x4c\x53\105", "\x64\157" => "\x54\137\104\x4f", "\x77\150\x69\154\145" => "\x54\x5f\x57\x48\111\x4c\x45", "\146\157\x72" => "\124\137\106\x4f\x52", "\x76\141\x72" => "\124\x5f\x56\x41\x52", "\x63\141\163\x65" => "\x54\x5f\103\101\x53\x45", "\144\145\x66\141\165\x6c\x74" => "\x54\137\104\x45\x46\101\x55\114\x54", "\164\x72\165\x65" => "\x54\137\x54\122\125\x45", "\146\141\154\163\145" => "\x54\137\x46\x41\x4c\123\x45", "\156\x75\154\154" => "\124\137\x4e\x55\x4c\114", "\x74\150\x69\x73" => "\x54\137\124\x48\111\x53", "\164\171\x70\145\157\x66" => "\124\137\124\131\120\x45\117\106", "\x28" => "\124\x5f\117\120\105\x4e\x5f\x50\101\x52\105\116\124\x48\x45\123\x49\x53", "\51" => "\x54\x5f\103\114\117\x53\105\x5f\x50\x41\122\x45\x4e\124\x48\x45\x53\x49\x53", "\173" => "\124\x5f\x4f\120\x45\116\137\x43\125\x52\114\x59\x5f\x42\122\x41\103\113\x45\124", "\x7d" => "\124\137\103\114\x4f\x53\105\137\x43\x55\x52\x4c\x59\x5f\102\122\101\x43\x4b\x45\x54", "\x5b" => "\x54\x5f\x4f\120\x45\x4e\x5f\x53\121\125\x41\x52\105\137\x42\x52\101\x43\113\x45\x54", "\x5d" => "\124\x5f\x43\x4c\117\x53\105\137\123\121\125\x41\x52\105\137\x42\x52\101\x43\x4b\105\x54", "\x3f" => "\x54\137\x49\116\114\x49\116\x45\x5f\124\110\x45\116", "\56" => "\124\x5f\117\x42\x4a\x45\103\124\137\117\120\105\x52\101\x54\x4f\x52", "\53" => "\x54\137\120\114\125\x53", "\x2d" => "\124\x5f\x4d\x49\x4e\125\x53", "\x2a" => "\124\x5f\x4d\x55\114\124\x49\120\114\x59", "\45" => "\124\137\115\x4f\104\x55\x4c\125\x53", "\x2f" => "\x54\137\x44\111\x56\x49\x44\x45", "\x5e" => "\124\137\114\117\x47\x49\x43\x41\x4c\137\x58\x4f\x52", "\54" => "\124\x5f\x43\x4f\115\x4d\101", "\x3b" => "\124\137\x53\105\115\111\x43\117\114\x4f\x4e", "\x3a" => "\x54\x5f\103\117\x4c\117\x4e", "\74" => "\124\137\x4c\105\123\x53\137\124\x48\101\x4e", "\76" => "\x54\137\x47\122\x45\x41\x54\105\x52\x5f\x54\x48\101\x4e", "\x3c\74" => "\124\x5f\x53\x4c", "\x3e\76" => "\x54\x5f\x53\x52", "\76\76\76" => "\x54\137\132\123\122", "\74\x3c\x3d" => "\124\137\x53\x4c\x5f\105\121\125\x41\114", "\x3e\76\x3d" => "\124\137\x53\122\x5f\x45\x51\x55\x41\114", "\x3e\x3e\76\75" => "\x54\x5f\x5a\x53\122\x5f\105\x51\x55\101\114", "\74\x3d" => "\x54\x5f\111\x53\x5f\x53\x4d\x41\x4c\x4c\105\x52\137\x4f\x52\137\x45\121\x55\101\x4c", "\x3e\75" => "\124\137\x49\x53\x5f\x47\x52\105\x41\x54\x45\122\137\x4f\x52\137\105\121\125\x41\x4c", "\75\x3e" => "\124\137\x44\x4f\x55\x42\114\x45\x5f\x41\122\122\117\x57", "\41" => "\x54\x5f\102\x4f\x4f\x4c\105\x41\116\x5f\x4e\117\x54", "\x7c\x7c" => "\124\x5f\x42\x4f\x4f\114\x45\x41\116\x5f\117\122", "\46\46" => "\124\137\102\x4f\117\114\105\101\x4e\137\x41\x4e\x44", "\x7c" => "\x54\137\102\111\x54\127\111\123\x45\137\117\122", "\46" => "\124\x5f\x42\x49\x54\x57\111\x53\x45\137\101\116\x44", "\x21\75" => "\124\137\x49\x53\x5f\x4e\117\x54\137\105\121\x55\101\114", "\x21\75\x3d" => "\x54\x5f\x49\x53\137\116\x4f\x54\x5f\x49\x44\105\x4e\x54\x49\x43\101\114", "\75" => "\124\x5f\105\x51\125\101\114", "\75\x3d" => "\x54\137\x49\123\x5f\x45\121\125\101\114", "\75\x3d\x3d" => "\124\137\111\123\137\x49\x44\105\x4e\x54\111\x43\101\114", "\x2d\75" => "\124\137\115\111\x4e\x55\123\137\105\121\125\101\x4c", "\53\75" => "\124\x5f\120\x4c\x55\x53\137\105\121\x55\x41\114", "\52\x3d" => "\x54\x5f\x4d\125\114\x5f\x45\121\x55\101\114", "\57\75" => "\124\137\104\x49\126\137\105\121\x55\101\x4c", "\x25\x3d" => "\x54\137\x4d\x4f\x44\x5f\x45\x51\x55\101\114", "\53\53" => "\124\137\x49\116\x43", "\x2d\55" => "\124\x5f\104\x45\x43", "\x2f\57" => "\124\137\103\117\x4d\x4d\105\116\x54", "\x2f\52" => "\124\x5f\103\x4f\x4d\115\105\x4e\x54", "\57\52\x2a" => "\124\137\104\x4f\x43\x5f\x43\x4f\x4d\x4d\x45\116\x54", "\52\x2f" => "\x54\137\x43\117\x4d\115\x45\116\x54"); protected $stringTokens = array("\x27" => "\47", "\x22" => "\42"); protected $commentTokens = array("\x2f\x2f" => null, "\x2f\52" => "\x2a\x2f", "\57\52\x2a" => "\52\x2f"); public function __construct($content, Config $config, $eolChar = "\x5c\156") { if ($this->isMinifiedContent($content, $eolChar) === true) { throw new TokenizerException("\x46\151\x6c\x65\x20\x61\x70\160\x65\141\x72\x73\40\x74\157\40\142\145\40\155\x69\x6e\151\146\151\x65\x64\x20\141\x6e\144\40\143\x61\x6e\x6e\157\x74\x20\142\x65\40\160\x72\157\143\x65\x73\x73\145\x64"); } parent::__construct($content, $config, $eolChar); } public function tokenize($string) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\52\52\x2a\x20\x53\x54\101\122\124\x20\x4a\123\40\124\x4f\x4b\x45\x4e\111\x5a\111\x4e\x47\40\x2a\x2a\x2a" . PHP_EOL; } $maxTokenLength = 0; foreach ($this->tokenValues as $token => $values) { if (strlen($token) > $maxTokenLength) { $maxTokenLength = strlen($token); } } $tokens = array(); $inString = ''; $stringChar = null; $inComment = ''; $buffer = ''; $preStringBuffer = ''; $cleanBuffer = false; $commentTokenizer = new Comment(); $tokens[] = array("\x63\157\144\145" => T_OPEN_TAG, "\x74\171\160\145" => "\x54\x5f\x4f\x50\x45\116\137\124\x41\x47", "\143\157\x6e\164\x65\x6e\x74" => ''); $string = str_replace($this->eolChar, "\12", $string); $chars = str_split($string); $numChars = count($chars); for ($i = 0; $i < $numChars; $i++) { $char = $chars[$i]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($char); $bufferContent = Util\Common::prepareForOutput($buffer); if ($inString !== '') { echo "\11"; } if ($inComment !== '') { echo "\x9"; } echo "\x9\120\x72\x6f\x63\145\163\x73\40\143\150\141\162\40{$i}\40\75\x3e\40{$content}\40\50\142\x75\x66\x66\x65\162\x3a\40{$bufferContent}\51" . PHP_EOL; } if ($inString === '' && $inComment === '' && $buffer !== '') { if (trim($char) !== '' && trim($buffer) === '') { $tokens[] = array("\143\157\144\x65" => T_WHITESPACE, "\164\171\x70\145" => "\124\x5f\127\x48\111\x54\105\x53\120\x41\103\x45", "\x63\157\x6e\x74\x65\156\164" => str_replace("\xa", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\x9\75\x3e\x20\x41\x64\x64\x65\x64\40\x74\x6f\153\x65\x6e\x20\124\x5f\127\x48\x49\x54\105\x53\120\x41\103\x45\40\x28{$content}\51" . PHP_EOL; } $buffer = ''; } if ($inString === '' && $inComment === '' && trim($char) === '' && trim($buffer) !== '') { $tokens[] = array("\x63\x6f\144\145" => T_STRING, "\164\171\160\x65" => "\124\x5f\123\124\x52\x49\x4e\107", "\143\x6f\156\x74\x65\x6e\x74" => str_replace("\12", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\x9\75\x3e\x20\x41\144\144\145\x64\x20\x74\x6f\153\145\x6e\x20\124\x5f\x53\x54\x52\x49\116\x47\40\x28{$content}\51" . PHP_EOL; } $buffer = ''; } } if ($inComment === '' && isset($this->stringTokens[$char]) === true) { if ($inString === $char) { $escapes = 0; for ($x = $i - 1; $x >= 0; $x--) { if ($chars[$x] !== "\x5c") { break; } $escapes++; } if ($escapes === 0 || $escapes % 2 === 0) { $tokens[] = array("\143\157\x64\x65" => T_CONSTANT_ENCAPSED_STRING, "\x74\171\x70\x65" => "\x54\137\x43\x4f\x4e\123\124\101\x4e\124\x5f\105\x4e\x43\101\x50\x53\105\104\x5f\x53\124\122\x49\x4e\107", "\143\157\156\164\x65\x6e\x74" => str_replace("\xa", $this->eolChar, $buffer) . $char); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\11\x9\52\40\x66\157\165\x6e\x64\x20\145\156\x64\x20\x6f\x66\x20\163\x74\x72\151\x6e\147\x20\x2a" . PHP_EOL; $content = Util\Common::prepareForOutput($buffer . $char); echo "\11\x3d\x3e\x20\x41\x64\x64\145\x64\x20\x74\157\153\145\156\x20\124\x5f\103\117\x4e\123\x54\x41\116\x54\x5f\105\x4e\x43\101\x50\x53\x45\x44\137\x53\x54\122\x49\116\x47\x20\50{$content}\x29" . PHP_EOL; } $buffer = ''; $preStringBuffer = ''; $inString = ''; $stringChar = null; continue; } } else { if ($inString === '') { $inString = $char; $stringChar = $i; $preStringBuffer = $buffer; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\11\52\x20\x6c\x6f\157\x6b\151\156\x67\40\146\x6f\x72\40\163\x74\x72\x69\x6e\147\40\143\154\x6f\163\145\x72\x20\x2a" . PHP_EOL; } } } } if ($inString !== '' && $char === "\xa") { if ($chars[$i - 1] !== "\x5c") { $i = $stringChar; $buffer = $preStringBuffer; $preStringBuffer = ''; $inString = ''; $stringChar = null; $char = $chars[$i]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9\x2a\x20\146\157\x75\x6e\144\40\156\x65\x77\154\x69\x6e\145\x20\142\x65\146\157\162\x65\40\145\156\144\40\157\x66\40\163\164\162\x69\x6e\x67\x2c\x20\142\141\151\x6c\151\156\x67\40\52" . PHP_EOL; } } } $buffer .= $char; if ($inString !== '') { continue; } if ($buffer === $char && $char === "\57" && $chars[$i + 1] !== "\x2a") { $regex = $this->getRegexToken($i, $string, $chars, $tokens); if ($regex !== null) { $tokens[] = array("\143\157\x64\145" => T_REGULAR_EXPRESSION, "\x74\171\x70\145" => "\124\137\122\105\x47\125\114\x41\x52\137\x45\x58\x50\122\105\123\123\111\x4f\116", "\x63\x6f\x6e\x74\145\x6e\164" => $regex["\143\157\156\164\x65\x6e\x74"]); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($regex["\143\x6f\156\x74\x65\x6e\x74"]); echo "\11\75\x3e\40\101\x64\144\145\x64\40\x74\x6f\x6b\x65\x6e\x20\x54\x5f\122\105\x47\125\114\x41\122\x5f\x45\x58\120\122\105\123\x53\111\117\x4e\40\x28{$content}\51" . PHP_EOL; } $i = $regex["\x65\x6e\x64"]; $buffer = ''; $cleanBuffer = false; continue; } } if (isset($this->tokenValues[strtolower($buffer)]) === true && (preg_match("\174\133\141\55\172\101\x2d\172\60\55\71\x5f\135\174", $char) === 0 || isset($chars[$i + 1]) === false || preg_match("\x7c\133\141\55\x7a\101\55\x7a\60\x2d\x39\x5f\135\x7c", $chars[$i + 1]) === 0)) { $matchedToken = false; $lookAheadLength = $maxTokenLength - strlen($buffer); if ($lookAheadLength > 0) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\11\11\x2a\x20\x62\165\x66\146\x65\162\x20\x70\x6f\x73\163\151\142\x6c\x79\x20\143\157\x6e\164\141\x69\x6e\x73\40\x74\x6f\153\145\x6e\x2c\x20\x6c\x6f\157\153\x69\156\147\40\141\x68\x65\141\144\40{$lookAheadLength}\40\143\x68\x61\x72\x73\40\x2a" . PHP_EOL; } $charBuffer = $buffer; for ($x = 1; $x <= $lookAheadLength; $x++) { if (isset($chars[$i + $x]) === false) { break; } $charBuffer .= $chars[$i + $x]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($charBuffer); echo "\11\x9\x3d\76\x20\x4c\x6f\157\x6b\x69\x6e\147\40\141\x68\145\141\x64\40{$x}\40\143\x68\x61\162\163\x20\75\x3e\40{$content}" . PHP_EOL; } if (isset($this->tokenValues[strtolower($charBuffer)]) === true) { $oldType = $this->tokenValues[strtolower($buffer)]; $newType = $this->tokenValues[strtolower($charBuffer)]; if ($oldType === "\124\137\x43\x4f\x4d\x4d\105\x4e\x54" && $newType === "\x54\x5f\104\117\x43\x5f\x43\x4f\115\x4d\x45\116\x54" && $chars[$i + $x + 1] === "\x2f") { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9\x2a\40\x6c\x6f\157\x6b\x20\x61\150\x65\141\x64\x20\151\147\156\x6f\162\145\144\x20\124\137\x44\117\x43\x5f\103\x4f\115\x4d\x45\x4e\x54\54\x20\143\157\x6e\164\x69\156\x75\151\x6e\147\x20\x2a" . PHP_EOL; } } else { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9\x2a\40\x6c\x6f\x6f\x6b\x20\141\x68\145\141\x64\x20\146\x6f\165\x6e\144\x20\x6d\157\x72\145\x20\163\160\x65\x63\151\146\151\143\40\164\x6f\153\x65\x6e\40\50{$newType}\x29\x2c\40\151\147\156\x6f\162\151\x6e\147\x20{$i}\x20\52" . PHP_EOL; } $matchedToken = true; break; } } } } if ($matchedToken === false) { if (PHP_CODESNIFFER_VERBOSITY > 1 && $lookAheadLength > 0) { echo "\11\11\x2a\40\154\157\157\x6b\x20\141\x68\x65\141\x64\40\x66\x6f\165\156\x64\x20\156\157\x74\x68\151\x6e\147\40\52" . PHP_EOL; } $value = $this->tokenValues[strtolower($buffer)]; if ($value === "\x54\137\x46\x55\x4e\x43\124\x49\x4f\116" && $buffer !== "\x66\165\156\143\x74\151\157\x6e") { $value = "\x54\137\123\124\x52\111\116\x47"; } $tokens[] = array("\143\x6f\x64\145" => constant($value), "\164\171\160\x65" => $value, "\x63\x6f\156\x74\x65\x6e\164" => $buffer); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\11\x3d\x3e\40\x41\x64\x64\145\144\40\x74\157\x6b\x65\x6e\40{$value}\40\50{$content}\51" . PHP_EOL; } $cleanBuffer = true; } } else { if (isset($this->tokenValues[strtolower($char)]) === true) { $newContent = substr(str_replace("\xa", $this->eolChar, $buffer), 0, -1); if ($newContent !== '') { $tokens[] = array("\143\157\144\145" => T_STRING, "\164\x79\x70\145" => "\x54\137\123\124\122\111\x4e\x47", "\x63\157\x6e\x74\145\156\164" => $newContent); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput(substr($buffer, 0, -1)); echo "\x9\75\76\x20\x41\144\144\145\144\40\x74\x6f\x6b\145\156\40\124\x5f\x53\124\x52\111\116\x47\x20\x28{$content}\51" . PHP_EOL; } } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\11\x9\52\40\143\x68\x61\162\x20\151\x73\x20\164\157\153\x65\156\54\40\154\157\157\153\x69\x6e\x67\40\141\150\145\x61\144\40" . ($maxTokenLength - 1) . "\40\143\x68\141\162\163\x20\52" . PHP_EOL; } $charBuffer = $char; $matchedToken = false; for ($x = 1; $x <= $maxTokenLength; $x++) { if (isset($chars[$i + $x]) === false) { break; } $charBuffer .= $chars[$i + $x]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($charBuffer); echo "\11\11\75\76\x20\114\157\x6f\x6b\151\156\x67\x20\x61\x68\145\141\144\40{$x}\40\x63\x68\x61\x72\x73\x20\x3d\76\40{$content}" . PHP_EOL; } if (isset($this->tokenValues[strtolower($charBuffer)]) === true) { if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokenValues[strtolower($charBuffer)]; echo "\11\11\x2a\x20\154\157\x6f\x6b\x20\141\x68\x65\x61\144\x20\x66\x6f\x75\156\x64\x20\x6d\x6f\162\x65\x20\163\x70\x65\x63\x69\x66\x69\143\40\164\157\x6b\145\156\x20\x28{$type}\51\54\x20\151\147\x6e\157\x72\151\x6e\x67\x20{$i}\40\52" . PHP_EOL; } $matchedToken = true; break; } } if ($matchedToken === false) { $value = $this->tokenValues[strtolower($char)]; $tokens[] = array("\x63\x6f\x64\145" => constant($value), "\x74\x79\160\x65" => $value, "\143\157\x6e\x74\x65\156\x74" => $char); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9\x2a\x20\x6c\x6f\157\153\x20\x61\x68\145\x61\144\40\146\x6f\165\156\x64\40\x6e\157\164\150\x69\x6e\x67\40\52" . PHP_EOL; $content = Util\Common::prepareForOutput($char); echo "\x9\x3d\76\40\x41\x64\144\145\144\40\x74\x6f\153\x65\156\x20{$value}\40\x28{$content}\x29" . PHP_EOL; } $cleanBuffer = true; } else { $buffer = $char; } } } if ($inComment === '' && array_key_exists($buffer, $this->commentTokens) === true) { if (isset($chars[$i - 2]) === true && $chars[$i - 2] === "\x5c") { $lastToken = array_pop($tokens); $lastContent = $lastToken["\x63\157\x6e\164\x65\156\x74"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { $value = $this->tokenValues[strtolower($lastContent)]; $content = Util\Common::prepareForOutput($lastContent); echo "\x9\75\x3e\40\x52\x65\155\157\x76\145\144\x20\164\157\x6b\145\x6e\40{$value}\x20\50{$content}\51" . PHP_EOL; } $lastChars = str_split($lastContent); $lastNumChars = count($lastChars); for ($x = 0; $x < $lastNumChars; $x++) { $lastChar = $lastChars[$x]; $value = $this->tokenValues[strtolower($lastChar)]; $tokens[] = array("\x63\x6f\x64\145" => constant($value), "\164\x79\x70\x65" => $value, "\x63\x6f\x6e\x74\x65\156\x74" => $lastChar); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($lastChar); echo "\11\75\x3e\x20\101\144\x64\x65\x64\40\164\x6f\x6b\145\156\x20{$value}\40\x28{$content}\51" . PHP_EOL; } } } else { $inComment = $buffer; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x9\52\x20\x6c\x6f\x6f\x6b\x69\x6e\147\40\146\x6f\162\x20\x65\x6e\144\40\x6f\146\x20\x63\x6f\155\155\145\156\x74\40\52" . PHP_EOL; } } } else { if ($inComment !== '') { if ($this->commentTokens[$inComment] === null) { if (strpos($buffer, "\xa") !== false) { $inComment = ''; } } else { if ($this->commentTokens[$inComment] === $buffer) { $inComment = ''; } } if (PHP_CODESNIFFER_VERBOSITY > 1) { if ($inComment === '') { echo "\11\x9\x2a\40\x66\x6f\165\156\144\40\145\156\144\x20\157\x66\x20\143\x6f\x6d\155\145\156\x74\40\52" . PHP_EOL; } } if ($inComment === '' && $cleanBuffer === false) { $tokens[] = array("\x63\x6f\x64\145" => T_STRING, "\x74\x79\160\x65" => "\x54\137\x53\x54\122\x49\116\107", "\143\157\x6e\164\145\x6e\x74" => str_replace("\xa", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\11\x3d\x3e\40\x41\x64\144\145\x64\40\164\x6f\x6b\x65\x6e\x20\124\137\123\x54\122\111\x4e\x47\x20\x28{$content}\51" . PHP_EOL; } $buffer = ''; } } } if ($cleanBuffer === true) { $buffer = ''; $cleanBuffer = false; } } if (empty($buffer) === false) { if ($inString !== '') { $tokens[] = array("\143\x6f\x64\x65" => T_STRING, "\x74\171\x70\x65" => "\124\137\x53\124\122\x49\x4e\x47", "\143\x6f\156\164\145\x6e\164" => str_replace("\12", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\11\75\76\x20\x41\x64\144\145\x64\x20\x74\157\153\x65\x6e\x20\124\137\123\124\x52\111\x4e\x47\40\50{$content}\51" . PHP_EOL; } } else { $tokens[] = array("\x63\157\144\145" => T_WHITESPACE, "\x74\171\x70\x65" => "\x54\137\x57\x48\111\x54\105\x53\x50\x41\x43\105", "\x63\x6f\156\164\x65\x6e\x74" => str_replace("\12", $this->eolChar, $buffer)); if (PHP_CODESNIFFER_VERBOSITY > 1) { $content = Util\Common::prepareForOutput($buffer); echo "\11\75\x3e\x20\x41\x64\144\145\x64\x20\164\157\153\145\x6e\40\x54\x5f\x57\x48\111\x54\105\123\x50\101\x43\105\40\50{$content}\51" . PHP_EOL; } } } $tokens[] = array("\x63\157\x64\145" => T_CLOSE_TAG, "\164\171\x70\145" => "\x54\x5f\x43\114\x4f\x53\x45\137\x54\101\x47", "\143\157\x6e\x74\145\156\164" => ''); $finalTokens = array(); $newStackPtr = 0; $numTokens = count($tokens); for ($stackPtr = 0; $stackPtr < $numTokens; $stackPtr++) { $token = $tokens[$stackPtr]; if ($token["\x63\x6f\144\145"] === T_COMMENT || $token["\143\157\x64\145"] === T_DOC_COMMENT) { $newContent = ''; $tokenContent = $token["\143\x6f\x6e\164\x65\x6e\x74"]; $endContent = null; if (isset($this->commentTokens[$tokenContent]) === true) { $endContent = $this->commentTokens[$tokenContent]; } while ($tokenContent !== $endContent) { if ($endContent === null && strpos($tokenContent, $this->eolChar) !== false) { $tokens[$stackPtr]["\143\x6f\x6e\x74\145\x6e\x74"] = substr($tokenContent, strpos($tokenContent, $this->eolChar) + strlen($this->eolChar)); $tokenContent = substr($tokenContent, 0, strpos($tokenContent, $this->eolChar) + strlen($this->eolChar)); if ($tokens[$stackPtr]["\x63\157\156\164\145\x6e\x74"] !== false && $tokens[$stackPtr]["\x63\157\x6e\164\x65\156\x74"] !== '') { $stackPtr--; } break; } $stackPtr++; $newContent .= $tokenContent; if (isset($tokens[$stackPtr]) === false) { break; } $tokenContent = $tokens[$stackPtr]["\143\x6f\156\x74\x65\x6e\x74"]; } if ($token["\143\x6f\x64\145"] === T_DOC_COMMENT) { $commentTokens = $commentTokenizer->tokenizeString($newContent . $tokenContent, $this->eolChar, $newStackPtr); foreach ($commentTokens as $commentToken) { $finalTokens[$newStackPtr] = $commentToken; $newStackPtr++; } continue; } else { $token["\x63\157\x6e\x74\145\x6e\x74"] = $newContent . $tokenContent; } } if (strpos($token["\143\157\x6e\164\x65\156\164"], $this->eolChar) !== false) { $tokenLines = explode($this->eolChar, $token["\x63\157\156\164\145\x6e\x74"]); $numLines = count($tokenLines); for ($i = 0; $i < $numLines; $i++) { $newToken = array("\x63\157\x6e\164\x65\x6e\164" => $tokenLines[$i]); if ($i === $numLines - 1) { if ($tokenLines[$i] === '') { break; } } else { $newToken["\143\157\x6e\x74\x65\156\164"] .= $this->eolChar; } $newToken["\164\171\160\145"] = $token["\x74\x79\x70\x65"]; $newToken["\x63\157\x64\145"] = $token["\x63\x6f\144\x65"]; $finalTokens[$newStackPtr] = $newToken; $newStackPtr++; } } else { $finalTokens[$newStackPtr] = $token; $newStackPtr++; } if ($token["\143\157\x64\145"] === T_STRING || $token["\x63\x6f\144\145"] === T_OBJECT_OPERATOR) { $newContent = ''; $oldStackPtr = $stackPtr; while (preg_match("\174\136\133\x30\x2d\x39\134\x2e\x5d\53\x24\174", $tokens[$stackPtr]["\143\x6f\156\x74\x65\x6e\164"]) !== 0) { $newContent .= $tokens[$stackPtr]["\143\157\x6e\x74\x65\156\164"]; $stackPtr++; } if ($newContent !== '' && $newContent !== "\x2e") { $finalTokens[$newStackPtr - 1]["\143\x6f\156\x74\x65\x6e\x74"] = $newContent; if (ctype_digit($newContent) === true) { $finalTokens[$newStackPtr - 1]["\x63\x6f\x64\x65"] = constant("\x54\x5f\114\x4e\125\115\102\x45\122"); $finalTokens[$newStackPtr - 1]["\x74\x79\x70\145"] = "\x54\x5f\x4c\116\x55\115\x42\x45\122"; } else { $finalTokens[$newStackPtr - 1]["\x63\157\144\x65"] = constant("\x54\x5f\104\116\x55\115\102\105\122"); $finalTokens[$newStackPtr - 1]["\x74\171\160\145"] = "\x54\x5f\104\x4e\125\115\x42\105\x52"; } $stackPtr--; continue; } else { $stackPtr = $oldStackPtr; } } if ($token["\143\x6f\144\x65"] === T_OBJECT_OPERATOR) { for ($i = $stackPtr + 1; $i < $numTokens; $i++) { if (isset(Util\Tokens::$emptyTokens[$tokens[$i]["\x63\157\x64\145"]]) === true) { continue; } if ($tokens[$i]["\143\x6f\x64\145"] !== T_PROTOTYPE && $tokens[$i]["\143\x6f\x64\x65"] !== T_LNUMBER && $tokens[$i]["\x63\157\x64\145"] !== T_DNUMBER) { $tokens[$i]["\x63\x6f\x64\145"] = T_STRING; $tokens[$i]["\164\x79\160\x65"] = "\124\x5f\x53\124\122\x49\x4e\107"; } break; } } } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x2a\52\52\40\105\116\104\40\x54\x4f\x4b\105\x4e\111\x5a\x49\116\x47\40\52\52\x2a" . PHP_EOL; } return $finalTokens; } public function getRegexToken($char, $string, $chars, $tokens) { $beforeTokens = array(T_EQUAL => true, T_IS_NOT_EQUAL => true, T_IS_IDENTICAL => true, T_IS_NOT_IDENTICAL => true, T_OPEN_PARENTHESIS => true, T_OPEN_SQUARE_BRACKET => true, T_RETURN => true, T_BOOLEAN_OR => true, T_BOOLEAN_AND => true, T_BOOLEAN_NOT => true, T_BITWISE_OR => true, T_BITWISE_AND => true, T_COMMA => true, T_COLON => true, T_TYPEOF => true, T_INLINE_THEN => true, T_INLINE_ELSE => true); $afterTokens = array("\x2c" => true, "\51" => true, "\x5d" => true, "\73" => true, "\40" => true, "\x2e" => true, "\72" => true, $this->eolChar => true); $numTokens = count($tokens); for ($prev = $numTokens - 1; $prev >= 0; $prev--) { if (isset(Util\Tokens::$emptyTokens[$tokens[$prev]["\x63\157\144\145"]]) === false) { break; } } if (isset($beforeTokens[$tokens[$prev]["\x63\157\x64\145"]]) === false) { return null; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\52\x20\164\x6f\153\x65\156\x20\x70\157\163\163\x69\x62\154\171\40\x73\x74\x61\162\164\x73\x20\141\40\x72\x65\147\165\154\141\162\40\x65\170\160\162\x65\x73\x73\x69\x6f\156\x20\x2a" . PHP_EOL; } $numChars = count($chars); for ($next = $char + 1; $next < $numChars; $next++) { if ($chars[$next] === "\x2f") { if ($chars[$next - 1] !== "\134") { break; } else { if ($chars[$next - 2] === "\134") { break; } } } else { $possibleEolChar = substr($string, $next, strlen($this->eolChar)); if ($possibleEolChar === $this->eolChar) { break; } } } if ($chars[$next] !== "\x2f") { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\11\x2a\40\x63\x6f\x75\154\x64\x20\x6e\x6f\164\x20\146\151\x6e\x64\x20\145\156\144\x20\x6f\146\40\x72\x65\147\x75\154\x61\162\x20\145\170\x70\162\145\163\x73\151\157\x6e\x20\x2a" . PHP_EOL; } return null; } while (preg_match("\x7c\x5b\x61\x2d\172\x41\x2d\132\135\174", $chars[$next + 1]) !== 0) { $next++; } $regexEnd = $next; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x2a\x20\x66\x6f\165\156\x64\40\145\156\144\x20\157\146\x20\x72\145\147\x75\x6c\141\162\x20\x65\170\x70\162\x65\x73\x73\151\157\156\x20\x61\164\x20\164\157\x6b\145\x6e\x20{$regexEnd}\x20\52" . PHP_EOL; } for ($next += 1; $next < $numChars; $next++) { if ($chars[$next] !== "\x20") { break; } else { $possibleEolChar = substr($string, $next, strlen($this->eolChar)); if ($possibleEolChar === $this->eolChar) { break; } } } if (isset($afterTokens[$chars[$next]]) === false) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\11\52\40\x74\x6f\153\145\156\163\40\141\146\164\145\162\40\x72\145\147\165\x6c\141\x72\x20\145\170\x70\x72\x65\x73\163\151\x6f\156\40\x64\157\x20\x6e\x6f\164\x20\154\157\x6f\x6b\x20\143\x6f\162\162\145\x63\164\40\52" . PHP_EOL; } return null; } $content = ''; for ($x = $char; $x <= $regexEnd; $x++) { $content .= $chars[$x]; } $token = array("\163\x74\x61\x72\x74" => $char, "\x65\156\144" => $regexEnd, "\x63\x6f\x6e\x74\145\156\164" => $content); return $token; } public function processAdditional() { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\x9\x2a\52\52\40\x53\x54\101\122\124\x20\x41\104\104\x49\124\x49\117\116\101\x4c\40\x4a\x53\x20\x50\x52\x4f\103\105\x53\x53\x49\x4e\107\40\52\x2a\x2a" . PHP_EOL; } $numTokens = count($this->tokens); $classStack = array(); for ($i = 0; $i < $numTokens; $i++) { if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$i]["\x74\x79\160\145"]; $content = Util\Common::prepareForOutput($this->tokens[$i]["\x63\x6f\156\x74\x65\156\x74"]); echo str_repeat("\11", count($classStack)); echo "\x9\x50\x72\157\x63\x65\x73\163\x20\164\157\153\145\156\x20{$i}\x3a\40{$type}\40\x3d\x3e\40{$content}" . PHP_EOL; } if ($this->tokens[$i]["\x63\x6f\144\145"] === T_FUNCTION && isset($this->tokens[$i]["\x73\x63\x6f\x70\x65\x5f\157\160\x65\156\x65\x72"]) === true) { for ($x = $i + 1; $x < $numTokens; $x++) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$x]["\x63\x6f\x64\x65"]]) === false) { break; } } if ($this->tokens[$x]["\x63\157\144\145"] === T_OPEN_PARENTHESIS) { $this->tokens[$i]["\143\x6f\144\x65"] = T_CLOSURE; $this->tokens[$i]["\x74\x79\160\145"] = "\124\137\x43\114\117\123\125\122\105"; if (PHP_CODESNIFFER_VERBOSITY > 1) { $line = $this->tokens[$i]["\x6c\x69\156\145"]; echo str_repeat("\x9", count($classStack)); echo "\x9\x2a\40\164\x6f\x6b\145\156\x20{$i}\40\x6f\x6e\x20\154\151\x6e\145\40{$line}\40\143\150\x61\x6e\x67\145\144\x20\x66\x72\x6f\x6d\x20\x54\x5f\106\x55\x4e\x43\x54\x49\117\x4e\x20\x74\x6f\40\x54\x5f\103\x4c\117\x53\x55\122\x45\x20\x2a" . PHP_EOL; } for ($x = $this->tokens[$i]["\x73\x63\x6f\160\x65\137\157\x70\x65\x6e\145\162"] + 1; $x < $this->tokens[$i]["\163\x63\157\x70\145\137\x63\x6c\x6f\163\145\x72"]; $x++) { if (isset($this->tokens[$x]["\143\x6f\156\x64\151\x74\x69\157\156\x73"][$i]) === false) { continue; } $this->tokens[$x]["\143\157\156\144\151\164\151\x6f\156\163"][$i] = T_CLOSURE; if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$x]["\x74\x79\x70\x65"]; echo str_repeat("\11", count($classStack)); echo "\x9\11\x2a\40\143\x6c\145\x61\156\145\x64\40{$x}\40\50{$type}\51\40\52" . PHP_EOL; } } } continue; } else { if ($this->tokens[$i]["\x63\157\x64\145"] === T_OPEN_CURLY_BRACKET && isset($this->tokens[$i]["\163\143\x6f\160\x65\137\143\x6f\x6e\144\151\x74\x69\157\x6e"]) === false && isset($this->tokens[$i]["\x62\162\141\x63\x6b\145\164\137\143\x6c\x6f\x73\x65\x72"]) === true) { $condition = $this->tokens[$i]["\x63\x6f\156\144\151\164\x69\157\156\163"]; $condition = end($condition); if ($condition === T_CLASS) { for ($parenCloser = $i - 1; $parenCloser > 0; $parenCloser--) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$parenCloser]["\143\x6f\x64\x65"]]) === false) { break; } } if ($this->tokens[$parenCloser]["\x63\157\144\145"] === T_CLOSE_PARENTHESIS) { $parenOpener = $this->tokens[$parenCloser]["\x70\141\162\145\x6e\164\150\x65\x73\x69\163\137\157\x70\x65\156\145\x72"]; for ($name = $parenOpener - 1; $name > 0; $name--) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$name]["\143\157\144\x65"]]) === false) { break; } } if ($this->tokens[$name]["\143\x6f\x64\x65"] === T_STRING) { if (PHP_CODESNIFFER_VERBOSITY > 1) { $line = $this->tokens[$name]["\x6c\151\x6e\x65"]; echo str_repeat("\x9", count($classStack)); echo "\11\52\40\164\157\x6b\x65\156\40{$name}\40\x6f\x6e\40\154\x69\156\x65\x20{$line}\40\143\150\141\156\147\145\144\x20\x66\x72\157\155\40\124\137\x53\x54\122\x49\116\x47\40\x74\157\x20\124\x5f\106\x55\x4e\x43\x54\111\117\116\x20\x2a" . PHP_EOL; } $closer = $this->tokens[$i]["\142\162\x61\x63\153\x65\x74\137\x63\x6c\157\x73\145\x72"]; $this->tokens[$name]["\x63\x6f\144\x65"] = T_FUNCTION; $this->tokens[$name]["\x74\171\x70\x65"] = "\x54\x5f\106\x55\116\103\124\x49\x4f\x4e"; foreach (array($name, $i, $closer) as $token) { $this->tokens[$token]["\163\x63\157\x70\x65\137\x63\x6f\156\144\x69\164\x69\157\156"] = $name; $this->tokens[$token]["\163\x63\x6f\x70\145\x5f\x6f\x70\145\156\145\162"] = $i; $this->tokens[$token]["\x73\x63\x6f\160\145\137\143\154\157\163\145\162"] = $closer; $this->tokens[$token]["\160\x61\162\x65\x6e\164\x68\145\163\x69\x73\x5f\x6f\160\145\156\145\162"] = $parenOpener; $this->tokens[$token]["\160\x61\162\x65\x6e\164\x68\145\163\x69\163\137\x63\154\157\x73\x65\162"] = $parenCloser; $this->tokens[$token]["\160\141\162\145\x6e\164\x68\x65\163\151\x73\137\157\x77\156\x65\x72"] = $name; } $this->tokens[$parenOpener]["\160\141\x72\x65\156\x74\150\145\163\x69\x73\137\157\167\156\145\162"] = $name; $this->tokens[$parenCloser]["\160\x61\x72\x65\x6e\164\150\145\163\151\x73\x5f\157\x77\x6e\145\162"] = $name; for ($x = $i + 1; $x < $closer; $x++) { $this->tokens[$x]["\143\157\x6e\144\x69\164\151\157\156\163"][$name] = T_FUNCTION; ksort($this->tokens[$x]["\143\157\x6e\x64\151\x74\151\x6f\156\x73"], SORT_NUMERIC); if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$x]["\164\171\160\145"]; echo str_repeat("\x9", count($classStack)); echo "\x9\11\x2a\x20\x61\x64\144\145\144\x20\124\137\106\125\116\103\124\x49\x4f\x4e\40\x63\157\x6e\x64\x69\164\x69\157\156\x20\164\x6f\40{$x}\40\x28{$type}\x29\40\52" . PHP_EOL; } } continue; } } } $classStack[] = $i; $closer = $this->tokens[$i]["\142\x72\141\143\x6b\145\164\137\143\x6c\x6f\163\145\162"]; $this->tokens[$i]["\143\157\144\x65"] = T_OBJECT; $this->tokens[$i]["\x74\171\160\145"] = "\x54\x5f\x4f\102\112\x45\x43\x54"; $this->tokens[$closer]["\143\x6f\x64\145"] = T_CLOSE_OBJECT; $this->tokens[$closer]["\164\x79\160\x65"] = "\124\137\x43\114\117\123\x45\x5f\x4f\x42\112\105\103\124"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", count($classStack)); echo "\x9\52\x20\164\157\153\145\x6e\x20{$i}\x20\143\157\x6e\x76\145\x72\164\x65\144\x20\x66\x72\x6f\x6d\40\124\x5f\x4f\120\x45\x4e\x5f\x43\125\122\114\131\x5f\x42\x52\101\103\x4b\x45\x54\x20\164\157\40\x54\x5f\117\x42\112\105\x43\x54\x20\52" . PHP_EOL; echo str_repeat("\x9", count($classStack)); echo "\11\x2a\40\x74\157\153\x65\x6e\40{$closer}\40\143\157\156\x76\x65\x72\x74\x65\144\40\146\x72\157\x6d\x20\x54\x5f\103\114\117\x53\105\x5f\x43\x55\x52\114\x59\x5f\x42\x52\x41\103\x4b\105\124\x20\x74\x6f\40\x54\x5f\103\x4c\x4f\123\105\137\x4f\x42\x4a\105\x43\x54\x20\52" . PHP_EOL; } for ($x = $i + 1; $x < $closer; $x++) { $this->tokens[$x]["\143\x6f\x6e\144\151\164\x69\x6f\x6e\x73"][$i] = T_OBJECT; ksort($this->tokens[$x]["\143\157\x6e\144\151\164\x69\x6f\156\x73"], SORT_NUMERIC); if (PHP_CODESNIFFER_VERBOSITY > 1) { $type = $this->tokens[$x]["\164\x79\x70\x65"]; echo str_repeat("\x9", count($classStack)); echo "\11\x9\x2a\40\141\144\144\x65\x64\x20\x54\137\x4f\x42\x4a\x45\x43\124\40\x63\x6f\x6e\x64\151\x74\151\x6f\156\x20\x74\157\x20{$x}\x20\x28{$type}\51\40\52" . PHP_EOL; } } } else { if ($this->tokens[$i]["\143\x6f\x64\145"] === T_CLOSE_OBJECT) { $opener = array_pop($classStack); } else { if ($this->tokens[$i]["\x63\x6f\144\x65"] === T_COLON) { if (isset($this->tokens[$i]["\x73\x63\157\x70\x65\137\143\x6f\x6e\x64\151\164\x69\x6f\156"]) === true) { continue; } for ($x = $i - 1; $x >= 0; $x--) { if ($this->tokens[$x]["\x63\157\144\145"] === T_INLINE_THEN) { $this->tokens[$i]["\143\x6f\x64\145"] = T_INLINE_ELSE; $this->tokens[$i]["\x74\x79\x70\x65"] = "\124\137\x49\116\114\x49\116\x45\x5f\x45\x4c\x53\x45"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", count($classStack)); echo "\11\52\40\164\x6f\153\145\x6e\40{$i}\x20\143\157\x6e\166\x65\x72\x74\x65\144\x20\146\x72\157\155\x20\x54\137\x43\117\114\x4f\116\40\x74\157\40\124\137\111\x4e\x4c\x49\x4e\105\x5f\124\x48\x45\116\40\52" . PHP_EOL; } continue 2; } else { if ($this->tokens[$x]["\154\151\156\145"] < $this->tokens[$i]["\x6c\151\156\x65"]) { break; } } } for ($label = $i - 1; $label >= 0; $label--) { if (isset(Util\Tokens::$emptyTokens[$this->tokens[$label]["\143\157\x64\x65"]]) === false) { break; } } if ($this->tokens[$label]["\143\x6f\x64\145"] !== T_STRING && $this->tokens[$label]["\143\x6f\x64\145"] !== T_CONSTANT_ENCAPSED_STRING) { continue; } if (empty($classStack) === false) { $this->tokens[$label]["\143\157\x64\x65"] = T_PROPERTY; $this->tokens[$label]["\164\171\160\x65"] = "\x54\x5f\120\x52\117\120\105\122\x54\131"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", count($classStack)); echo "\11\x2a\x20\x74\157\153\x65\x6e\40{$label}\x20\143\157\x6e\166\145\162\164\145\144\40\x66\x72\x6f\x6d\x20\124\137\123\x54\122\111\116\x47\40\x74\157\40\x54\x5f\x50\122\x4f\120\105\122\x54\131\x20\x2a" . PHP_EOL; } } else { $this->tokens[$label]["\143\157\144\x65"] = T_LABEL; $this->tokens[$label]["\164\171\x70\x65"] = "\x54\x5f\114\x41\x42\105\114"; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", count($classStack)); echo "\11\52\40\164\157\x6b\x65\x6e\x20{$label}\x20\143\x6f\156\166\x65\x72\x74\145\x64\x20\x66\x72\x6f\155\x20\124\x5f\123\x54\122\x49\x4e\107\x20\164\x6f\40\124\x5f\x4c\x41\102\105\114\x20\x2a" . PHP_EOL; } } } } } } } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo "\11\x2a\x2a\x2a\x20\105\x4e\x44\x20\x41\104\104\111\x54\111\x4f\x4e\x41\114\x20\x4a\123\x20\x50\122\117\x43\105\123\x53\111\x4e\x47\x20\x2a\52\52" . PHP_EOL; } } }

Function Calls

None

Variables

None

Stats

MD5 62ea6d636c600aa9e094205e5a2bd979
Eval Count 0
Decode Time 140 ms