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\Standards\PEAR\Sniffs\Commenting; use PHP_CodeSniffer\Fil..

Decoded Output download

<?php
 namespace PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; use PHP_CodeSniffer\Util\Common; class FileCommentSniff implements Sniff { protected $tags = array("@category" => array("required" => true, "allow_multiple" => false), "@package" => array("required" => true, "allow_multiple" => false), "@subpackage" => array("required" => false, "allow_multiple" => false), "@author" => array("required" => true, "allow_multiple" => true), "@copyright" => array("required" => false, "allow_multiple" => true), "@license" => array("required" => true, "allow_multiple" => false), "@version" => array("required" => false, "allow_multiple" => false), "@link" => array("required" => true, "allow_multiple" => true), "@see" => array("required" => false, "allow_multiple" => true), "@since" => array("required" => false, "allow_multiple" => false), "@deprecated" => array("required" => false, "allow_multiple" => false)); public function register() { return array(T_OPEN_TAG); } public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $commentStart = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true); if ($tokens[$commentStart]["code"] === T_DECLARE) { $semicolon = $phpcsFile->findNext(T_SEMICOLON, $commentStart + 1); $commentStart = $phpcsFile->findNext(T_WHITESPACE, $semicolon + 1, null, true); } if ($tokens[$commentStart]["code"] === T_COMMENT) { if (strstr($tokens[$commentStart]["content"], "vim:") !== false) { $commentStart = $phpcsFile->findNext(T_WHITESPACE, $commentStart + 1, null, true); } } $errorToken = $stackPtr + 1; if (isset($tokens[$errorToken]) === false) { $errorToken--; } if ($tokens[$commentStart]["code"] === T_CLOSE_TAG) { return $phpcsFile->numTokens + 1; } else { if ($tokens[$commentStart]["code"] === T_COMMENT) { $error = "You must use "/**" style comments for a file comment"; $phpcsFile->addError($error, $errorToken, "WrongStyle"); $phpcsFile->recordMetric($stackPtr, "File has doc comment", "yes"); return $phpcsFile->numTokens + 1; } else { if ($commentStart === false || $tokens[$commentStart]["code"] !== T_DOC_COMMENT_OPEN_TAG) { $phpcsFile->addError("Missing file doc comment", $errorToken, "Missing"); $phpcsFile->recordMetric($stackPtr, "File has doc comment", "no"); return $phpcsFile->numTokens + 1; } } } $commentEnd = $tokens[$commentStart]["comment_closer"]; for ($nextToken = $commentEnd + 1; $nextToken < $phpcsFile->numTokens; $nextToken++) { if ($tokens[$nextToken]["code"] === T_WHITESPACE) { continue; } if ($tokens[$nextToken]["code"] === T_ATTRIBUTE && isset($tokens[$nextToken]["attribute_closer"]) === true) { $nextToken = $tokens[$nextToken]["attribute_closer"]; continue; } break; } if ($nextToken === $phpcsFile->numTokens) { $nextToken--; } $ignore = array(T_CLASS, T_INTERFACE, T_TRAIT, T_ENUM, T_FUNCTION, T_CLOSURE, T_PUBLIC, T_PRIVATE, T_PROTECTED, T_FINAL, T_STATIC, T_ABSTRACT, T_READONLY, T_CONST, T_PROPERTY); if (in_array($tokens[$nextToken]["code"], $ignore, true) === true) { $phpcsFile->addError("Missing file doc comment", $stackPtr, "Missing"); $phpcsFile->recordMetric($stackPtr, "File has doc comment", "no"); return $phpcsFile->numTokens + 1; } $phpcsFile->recordMetric($stackPtr, "File has doc comment", "yes"); $found = false; for ($i = $commentStart + 1; $i < $commentEnd; $i++) { if ($tokens[$i]["code"] === T_DOC_COMMENT_TAG) { break; } else { if ($tokens[$i]["code"] === T_DOC_COMMENT_STRING && strstr(strtolower($tokens[$i]["content"]), "php version") !== false) { $found = true; break; } } } if ($found === false) { $error = "PHP version not specified"; $phpcsFile->addWarning($error, $commentEnd, "MissingVersion"); } $this->processTags($phpcsFile, $stackPtr, $commentStart); return $phpcsFile->numTokens + 1; } protected function processTags($phpcsFile, $stackPtr, $commentStart) { $tokens = $phpcsFile->getTokens(); if (get_class($this) === "PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff") { $docBlock = "file"; } else { $docBlock = "class"; } $commentEnd = $tokens[$commentStart]["comment_closer"]; $foundTags = array(); $tagTokens = array(); foreach ($tokens[$commentStart]["comment_tags"] as $tag) { $name = $tokens[$tag]["content"]; if (isset($this->tags[$name]) === false) { continue; } if ($this->tags[$name]["allow_multiple"] === false && isset($tagTokens[$name]) === true) { $error = "Only one %s tag is allowed in a %s comment"; $data = array($name, $docBlock); $phpcsFile->addError($error, $tag, "Duplicate" . ucfirst(substr($name, 1)) . "Tag", $data); } $foundTags[] = $name; $tagTokens[$name][] = $tag; $string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $tag, $commentEnd); if ($string === false || $tokens[$string]["line"] !== $tokens[$tag]["line"]) { $error = "Content missing for %s tag in %s comment"; $data = array($name, $docBlock); $phpcsFile->addError($error, $tag, "Empty" . ucfirst(substr($name, 1)) . "Tag", $data); continue; } } $pos = 0; foreach ($this->tags as $tag => $tagData) { if (isset($tagTokens[$tag]) === false) { if ($tagData["required"] === true) { $error = "Missing %s tag in %s comment"; $data = array($tag, $docBlock); $phpcsFile->addError($error, $commentEnd, "Missing" . ucfirst(substr($tag, 1)) . "Tag", $data); } continue; } else { $method = "process" . substr($tag, 1); if (method_exists($this, $method) === true) { call_user_func(array($this, $method), $phpcsFile, $tagTokens[$tag]); } } if (isset($foundTags[$pos]) === false) { break; } if ($foundTags[$pos] !== $tag) { $error = "The tag in position %s should be the %s tag"; $data = array($pos + 1, $tag); $phpcsFile->addError($error, $tokens[$commentStart]["comment_tags"][$pos], ucfirst(substr($tag, 1)) . "TagOrder", $data); } $pos++; while (isset($foundTags[$pos]) === true && $foundTags[$pos] === $tag) { $pos++; } } } protected function processCategory($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; if (Common::isUnderscoreName($content) !== true) { $newContent = str_replace(" ", "_", $content); $nameBits = explode("_", $newContent); $firstBit = array_shift($nameBits); $newName = ucfirst($firstBit) . "_"; foreach ($nameBits as $bit) { if ($bit !== '') { $newName .= ucfirst($bit) . "_"; } } $error = "Category name "%s" is not valid; consider "%s" instead"; $validName = trim($newName, "_"); $data = array($content, $validName); $phpcsFile->addError($error, $tag, "InvalidCategory", $data); } } } protected function processPackage($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; if (Common::isUnderscoreName($content) === true) { continue; } $newContent = str_replace(" ", "_", $content); $newContent = trim($newContent, "_"); $newContent = preg_replace("/[^A-Za-z_]/", '', $newContent); if ($newContent === '') { $error = "Package name "%s" is not valid"; $data = array($content); $phpcsFile->addError($error, $tag, "InvalidPackageValue", $data); } else { $nameBits = explode("_", $newContent); $firstBit = array_shift($nameBits); $newName = strtoupper($firstBit[0]) . substr($firstBit, 1) . "_"; foreach ($nameBits as $bit) { if ($bit !== '') { $newName .= strtoupper($bit[0]) . substr($bit, 1) . "_"; } } $error = "Package name "%s" is not valid; consider "%s" instead"; $validName = trim($newName, "_"); $data = array($content, $validName); $phpcsFile->addError($error, $tag, "InvalidPackage", $data); } } } protected function processSubpackage($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; if (Common::isUnderscoreName($content) === true) { continue; } $newContent = str_replace(" ", "_", $content); $nameBits = explode("_", $newContent); $firstBit = array_shift($nameBits); $newName = strtoupper($firstBit[0]) . substr($firstBit, 1) . "_"; foreach ($nameBits as $bit) { if ($bit !== '') { $newName .= strtoupper($bit[0]) . substr($bit, 1) . "_"; } } $error = "Subpackage name "%s" is not valid; consider "%s" instead"; $validName = trim($newName, "_"); $data = array($content, $validName); $phpcsFile->addError($error, $tag, "InvalidSubpackage", $data); } } protected function processAuthor($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; $local = "\da-zA-Z-_+"; $localMiddle = $local . ".\w"; if (preg_match("/^([^<]*)\s+<([" . $local . "]([" . $localMiddle . "]*[" . $local . "])*@[\da-zA-Z][-.\w]*[\da-zA-Z]\.[a-zA-Z]{2,})>$/", $content) === 0) { $error = "Content of the @author tag must be in the form "Display Name <[email protected]>""; $phpcsFile->addError($error, $tag, "InvalidAuthors"); } } } protected function processCopyright($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; $matches = array(); if (preg_match("/^([0-9]{4})((.{1})([0-9]{4}))? (.+)$/", $content, $matches) !== 0) { if ($matches[3] !== '' && $matches[3] !== null) { if ($matches[3] !== "-") { $error = "A hyphen must be used between the earliest and latest year"; $phpcsFile->addError($error, $tag, "CopyrightHyphen"); } if ($matches[4] !== '' && $matches[4] !== null && $matches[4] < $matches[1]) { $error = "Invalid year span "{$matches["1"]}{$matches["3"]}{$matches["4"]}" found; consider "{$matches["4"]}-{$matches["1"]}" instead"; $phpcsFile->addWarning($error, $tag, "InvalidCopyright"); } } } else { $error = "@copyright tag must contain a year and the name of the copyright holder"; $phpcsFile->addError($error, $tag, "IncompleteCopyright"); } } } protected function processLicense($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; $matches = array(); preg_match("/^([^\s]+)\s+(.*)/", $content, $matches); if (count($matches) !== 3) { $error = "@license tag must contain a URL and a license name"; $phpcsFile->addError($error, $tag, "IncompleteLicense"); } } } protected function processVersion($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["code"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["content"]; if (strstr($content, "CVS:") === false && strstr($content, "SVN:") === false && strstr($content, "GIT:") === false && strstr($content, "HG:") === false) { $error = "Invalid version "%s" in file comment; consider "CVS: <cvs_id>" or "SVN: <svn_id>" or "GIT: <git_id>" or "HG: <hg_id>" instead"; $data = array($content); $phpcsFile->addWarning($error, $tag, "InvalidVersion", $data); } } } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; use PHP_CodeSniffer\Util\Common; class FileCommentSniff implements Sniff { protected $tags = array("\100\x63\x61\x74\145\147\157\x72\171" => array("\x72\145\x71\x75\x69\x72\x65\144" => true, "\141\x6c\154\x6f\x77\x5f\155\x75\x6c\164\151\160\x6c\145" => false), "\100\160\x61\143\153\x61\x67\145" => array("\x72\x65\161\165\x69\162\x65\x64" => true, "\141\x6c\x6c\157\x77\137\x6d\x75\x6c\x74\x69\x70\154\145" => false), "\100\x73\165\142\160\141\143\153\141\147\145" => array("\x72\145\x71\165\x69\x72\145\x64" => false, "\141\x6c\154\x6f\x77\x5f\x6d\165\154\164\151\160\154\145" => false), "\100\141\165\x74\x68\x6f\x72" => array("\162\x65\x71\165\151\162\145\144" => true, "\x61\154\154\x6f\x77\x5f\155\165\154\x74\x69\x70\x6c\x65" => true), "\100\143\157\160\x79\162\x69\147\150\164" => array("\162\x65\x71\x75\x69\x72\145\x64" => false, "\x61\154\154\157\x77\x5f\155\x75\x6c\x74\151\160\x6c\145" => true), "\100\154\151\x63\x65\x6e\x73\145" => array("\162\x65\x71\x75\x69\x72\x65\x64" => true, "\141\x6c\x6c\x6f\x77\137\155\x75\154\164\x69\x70\x6c\x65" => false), "\x40\166\x65\x72\x73\151\x6f\x6e" => array("\162\145\161\165\151\x72\145\x64" => false, "\141\154\x6c\x6f\x77\x5f\155\x75\154\164\151\160\x6c\x65" => false), "\100\154\x69\x6e\x6b" => array("\162\145\x71\165\x69\x72\x65\x64" => true, "\x61\x6c\154\x6f\x77\137\155\165\154\x74\151\160\154\x65" => true), "\x40\x73\x65\145" => array("\x72\145\161\165\x69\x72\145\x64" => false, "\141\154\154\x6f\167\137\x6d\x75\154\164\151\160\x6c\145" => true), "\100\x73\x69\156\x63\145" => array("\x72\x65\x71\165\x69\162\x65\x64" => false, "\141\154\154\157\167\x5f\x6d\x75\x6c\164\151\x70\x6c\145" => false), "\100\x64\x65\x70\162\x65\x63\141\x74\x65\144" => array("\x72\145\161\165\151\162\x65\x64" => false, "\x61\x6c\x6c\x6f\x77\137\155\165\x6c\164\151\160\154\x65" => false)); public function register() { return array(T_OPEN_TAG); } public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $commentStart = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true); if ($tokens[$commentStart]["\143\157\x64\145"] === T_DECLARE) { $semicolon = $phpcsFile->findNext(T_SEMICOLON, $commentStart + 1); $commentStart = $phpcsFile->findNext(T_WHITESPACE, $semicolon + 1, null, true); } if ($tokens[$commentStart]["\143\x6f\144\x65"] === T_COMMENT) { if (strstr($tokens[$commentStart]["\143\157\x6e\x74\x65\x6e\x74"], "\x76\x69\155\x3a") !== false) { $commentStart = $phpcsFile->findNext(T_WHITESPACE, $commentStart + 1, null, true); } } $errorToken = $stackPtr + 1; if (isset($tokens[$errorToken]) === false) { $errorToken--; } if ($tokens[$commentStart]["\x63\157\x64\x65"] === T_CLOSE_TAG) { return $phpcsFile->numTokens + 1; } else { if ($tokens[$commentStart]["\x63\x6f\x64\145"] === T_COMMENT) { $error = "\131\157\165\x20\155\165\x73\x74\40\x75\x73\145\x20\x22\57\52\x2a\x22\40\x73\164\171\x6c\x65\x20\x63\x6f\155\x6d\145\x6e\164\x73\x20\146\157\x72\40\141\40\146\151\x6c\x65\40\143\157\155\x6d\x65\x6e\x74"; $phpcsFile->addError($error, $errorToken, "\127\162\x6f\x6e\147\x53\164\171\154\x65"); $phpcsFile->recordMetric($stackPtr, "\106\151\154\x65\40\150\x61\x73\x20\x64\157\143\x20\143\x6f\x6d\x6d\145\x6e\164", "\x79\145\x73"); return $phpcsFile->numTokens + 1; } else { if ($commentStart === false || $tokens[$commentStart]["\143\157\144\x65"] !== T_DOC_COMMENT_OPEN_TAG) { $phpcsFile->addError("\x4d\151\x73\x73\151\x6e\147\x20\146\x69\154\x65\x20\144\x6f\143\x20\x63\x6f\155\x6d\145\156\x74", $errorToken, "\x4d\x69\163\163\x69\x6e\x67"); $phpcsFile->recordMetric($stackPtr, "\106\151\154\x65\40\150\141\x73\x20\144\x6f\143\40\143\157\x6d\155\145\156\x74", "\156\157"); return $phpcsFile->numTokens + 1; } } } $commentEnd = $tokens[$commentStart]["\143\x6f\x6d\x6d\145\x6e\x74\x5f\x63\154\157\x73\x65\162"]; for ($nextToken = $commentEnd + 1; $nextToken < $phpcsFile->numTokens; $nextToken++) { if ($tokens[$nextToken]["\143\157\x64\145"] === T_WHITESPACE) { continue; } if ($tokens[$nextToken]["\x63\157\x64\145"] === T_ATTRIBUTE && isset($tokens[$nextToken]["\141\x74\164\x72\x69\x62\x75\164\x65\137\x63\x6c\x6f\163\x65\162"]) === true) { $nextToken = $tokens[$nextToken]["\141\x74\x74\162\x69\142\x75\164\x65\x5f\143\x6c\x6f\x73\145\x72"]; continue; } break; } if ($nextToken === $phpcsFile->numTokens) { $nextToken--; } $ignore = array(T_CLASS, T_INTERFACE, T_TRAIT, T_ENUM, T_FUNCTION, T_CLOSURE, T_PUBLIC, T_PRIVATE, T_PROTECTED, T_FINAL, T_STATIC, T_ABSTRACT, T_READONLY, T_CONST, T_PROPERTY); if (in_array($tokens[$nextToken]["\143\x6f\144\x65"], $ignore, true) === true) { $phpcsFile->addError("\115\x69\x73\x73\151\x6e\147\x20\x66\151\x6c\x65\x20\x64\157\x63\40\143\157\x6d\x6d\x65\156\164", $stackPtr, "\x4d\x69\x73\x73\151\156\x67"); $phpcsFile->recordMetric($stackPtr, "\x46\151\154\145\40\150\x61\x73\40\144\157\x63\x20\x63\x6f\x6d\x6d\145\156\164", "\156\x6f"); return $phpcsFile->numTokens + 1; } $phpcsFile->recordMetric($stackPtr, "\106\x69\154\x65\40\150\x61\x73\40\144\157\143\40\143\x6f\155\155\x65\x6e\164", "\171\145\163"); $found = false; for ($i = $commentStart + 1; $i < $commentEnd; $i++) { if ($tokens[$i]["\143\x6f\144\145"] === T_DOC_COMMENT_TAG) { break; } else { if ($tokens[$i]["\143\157\x64\x65"] === T_DOC_COMMENT_STRING && strstr(strtolower($tokens[$i]["\143\157\x6e\x74\145\156\x74"]), "\160\x68\160\40\166\145\162\x73\x69\157\156") !== false) { $found = true; break; } } } if ($found === false) { $error = "\120\110\120\40\166\x65\162\x73\151\x6f\x6e\x20\x6e\x6f\164\40\x73\160\145\x63\151\146\151\x65\x64"; $phpcsFile->addWarning($error, $commentEnd, "\x4d\x69\x73\163\151\156\x67\126\145\162\163\x69\157\156"); } $this->processTags($phpcsFile, $stackPtr, $commentStart); return $phpcsFile->numTokens + 1; } protected function processTags($phpcsFile, $stackPtr, $commentStart) { $tokens = $phpcsFile->getTokens(); if (get_class($this) === "\x50\x48\x50\x5f\103\157\x64\x65\x53\156\151\146\x66\145\x72\x5c\x53\x74\141\x6e\144\141\162\144\163\x5c\x50\105\x41\122\x5c\x53\x6e\x69\x66\x66\x73\134\103\x6f\155\155\145\x6e\164\x69\x6e\x67\x5c\106\x69\x6c\x65\x43\x6f\155\x6d\x65\156\x74\123\x6e\x69\x66\x66") { $docBlock = "\x66\x69\154\145"; } else { $docBlock = "\x63\154\141\x73\163"; } $commentEnd = $tokens[$commentStart]["\143\157\155\x6d\x65\156\164\137\143\154\x6f\163\x65\162"]; $foundTags = array(); $tagTokens = array(); foreach ($tokens[$commentStart]["\x63\157\x6d\x6d\145\156\x74\137\x74\x61\x67\163"] as $tag) { $name = $tokens[$tag]["\x63\x6f\x6e\164\x65\156\x74"]; if (isset($this->tags[$name]) === false) { continue; } if ($this->tags[$name]["\141\154\154\157\x77\137\155\165\x6c\164\151\160\x6c\145"] === false && isset($tagTokens[$name]) === true) { $error = "\117\156\154\x79\40\157\156\x65\x20\45\163\x20\x74\x61\147\40\x69\163\40\141\x6c\x6c\x6f\x77\145\144\x20\x69\x6e\x20\141\x20\x25\163\x20\143\157\155\155\145\x6e\x74"; $data = array($name, $docBlock); $phpcsFile->addError($error, $tag, "\104\165\x70\154\151\143\x61\164\x65" . ucfirst(substr($name, 1)) . "\124\x61\147", $data); } $foundTags[] = $name; $tagTokens[$name][] = $tag; $string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $tag, $commentEnd); if ($string === false || $tokens[$string]["\154\151\x6e\145"] !== $tokens[$tag]["\154\x69\x6e\x65"]) { $error = "\103\157\x6e\164\x65\156\164\40\155\151\163\x73\151\156\147\x20\146\x6f\x72\40\x25\163\x20\x74\141\147\x20\x69\156\40\45\163\40\143\x6f\x6d\155\x65\156\x74"; $data = array($name, $docBlock); $phpcsFile->addError($error, $tag, "\105\155\x70\164\171" . ucfirst(substr($name, 1)) . "\124\141\147", $data); continue; } } $pos = 0; foreach ($this->tags as $tag => $tagData) { if (isset($tagTokens[$tag]) === false) { if ($tagData["\x72\x65\x71\165\x69\162\145\x64"] === true) { $error = "\x4d\151\163\x73\x69\156\x67\x20\x25\163\40\164\141\147\40\151\156\40\x25\163\x20\x63\157\155\x6d\145\156\x74"; $data = array($tag, $docBlock); $phpcsFile->addError($error, $commentEnd, "\115\x69\x73\163\151\x6e\147" . ucfirst(substr($tag, 1)) . "\124\141\147", $data); } continue; } else { $method = "\160\x72\x6f\143\x65\163\x73" . substr($tag, 1); if (method_exists($this, $method) === true) { call_user_func(array($this, $method), $phpcsFile, $tagTokens[$tag]); } } if (isset($foundTags[$pos]) === false) { break; } if ($foundTags[$pos] !== $tag) { $error = "\124\150\x65\x20\164\x61\x67\x20\151\x6e\40\160\x6f\x73\151\164\151\157\x6e\x20\x25\163\40\163\x68\157\x75\x6c\x64\x20\x62\x65\x20\164\x68\145\x20\x25\x73\40\164\x61\147"; $data = array($pos + 1, $tag); $phpcsFile->addError($error, $tokens[$commentStart]["\x63\157\155\x6d\x65\156\x74\137\164\141\x67\x73"][$pos], ucfirst(substr($tag, 1)) . "\124\141\x67\x4f\x72\144\x65\162", $data); } $pos++; while (isset($foundTags[$pos]) === true && $foundTags[$pos] === $tag) { $pos++; } } } protected function processCategory($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\x63\157\144\145"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\143\x6f\156\164\145\x6e\x74"]; if (Common::isUnderscoreName($content) !== true) { $newContent = str_replace("\x20", "\x5f", $content); $nameBits = explode("\137", $newContent); $firstBit = array_shift($nameBits); $newName = ucfirst($firstBit) . "\137"; foreach ($nameBits as $bit) { if ($bit !== '') { $newName .= ucfirst($bit) . "\x5f"; } } $error = "\x43\x61\x74\145\147\157\162\x79\40\x6e\x61\x6d\x65\x20\42\x25\163\42\40\x69\x73\x20\156\157\164\40\x76\141\154\x69\144\x3b\40\143\x6f\x6e\x73\151\144\145\162\x20\x22\x25\163\x22\40\x69\x6e\x73\x74\145\141\144"; $validName = trim($newName, "\x5f"); $data = array($content, $validName); $phpcsFile->addError($error, $tag, "\x49\x6e\166\x61\154\x69\x64\x43\x61\x74\145\x67\157\162\171", $data); } } } protected function processPackage($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\143\157\144\145"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\143\157\156\164\x65\x6e\164"]; if (Common::isUnderscoreName($content) === true) { continue; } $newContent = str_replace("\x20", "\x5f", $content); $newContent = trim($newContent, "\137"); $newContent = preg_replace("\x2f\133\136\x41\55\132\141\x2d\x7a\x5f\x5d\57", '', $newContent); if ($newContent === '') { $error = "\x50\x61\x63\153\x61\147\x65\40\156\141\155\x65\x20\x22\x25\163\42\x20\151\x73\x20\x6e\x6f\x74\40\166\x61\x6c\151\144"; $data = array($content); $phpcsFile->addError($error, $tag, "\x49\x6e\x76\x61\x6c\x69\144\x50\141\x63\x6b\x61\147\145\126\141\154\165\145", $data); } else { $nameBits = explode("\137", $newContent); $firstBit = array_shift($nameBits); $newName = strtoupper($firstBit[0]) . substr($firstBit, 1) . "\137"; foreach ($nameBits as $bit) { if ($bit !== '') { $newName .= strtoupper($bit[0]) . substr($bit, 1) . "\x5f"; } } $error = "\120\141\143\x6b\x61\147\145\x20\x6e\141\155\x65\x20\x22\45\163\x22\x20\x69\163\x20\x6e\x6f\164\x20\x76\x61\154\151\144\x3b\x20\x63\157\x6e\x73\x69\144\x65\x72\40\x22\45\163\42\40\x69\x6e\163\164\145\x61\144"; $validName = trim($newName, "\137"); $data = array($content, $validName); $phpcsFile->addError($error, $tag, "\111\156\x76\x61\x6c\151\x64\x50\x61\x63\153\141\147\145", $data); } } } protected function processSubpackage($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\x63\x6f\144\145"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\x63\157\156\164\x65\x6e\164"]; if (Common::isUnderscoreName($content) === true) { continue; } $newContent = str_replace("\x20", "\137", $content); $nameBits = explode("\137", $newContent); $firstBit = array_shift($nameBits); $newName = strtoupper($firstBit[0]) . substr($firstBit, 1) . "\x5f"; foreach ($nameBits as $bit) { if ($bit !== '') { $newName .= strtoupper($bit[0]) . substr($bit, 1) . "\137"; } } $error = "\123\x75\x62\160\x61\x63\x6b\141\147\x65\x20\156\x61\155\x65\40\42\x25\163\42\40\151\163\40\156\x6f\164\x20\166\141\x6c\151\x64\73\x20\143\157\156\163\x69\x64\145\x72\40\42\x25\x73\x22\40\151\156\x73\x74\x65\x61\x64"; $validName = trim($newName, "\x5f"); $data = array($content, $validName); $phpcsFile->addError($error, $tag, "\x49\156\166\141\x6c\x69\144\x53\165\142\160\141\x63\153\141\x67\x65", $data); } } protected function processAuthor($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\143\157\144\145"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\143\x6f\x6e\x74\x65\156\x74"]; $local = "\134\144\141\55\172\x41\55\x5a\55\137\53"; $localMiddle = $local . "\56\134\x77"; if (preg_match("\x2f\136\x28\x5b\136\x3c\x5d\52\51\x5c\163\53\x3c\x28\x5b" . $local . "\x5d\x28\x5b" . $localMiddle . "\135\x2a\x5b" . $local . "\x5d\51\52\100\133\x5c\144\141\x2d\172\101\x2d\132\135\133\x2d\x2e\x5c\167\x5d\x2a\x5b\134\x64\141\x2d\172\x41\x2d\x5a\135\134\x2e\133\x61\x2d\x7a\x41\x2d\132\x5d\x7b\x32\54\175\51\76\x24\57", $content) === 0) { $error = "\x43\157\x6e\164\x65\x6e\x74\x20\x6f\x66\x20\164\150\x65\x20\x40\141\165\x74\x68\157\x72\40\164\x61\147\x20\x6d\x75\x73\164\x20\142\145\40\x69\x6e\x20\x74\150\145\x20\x66\157\162\155\40\42\x44\151\163\x70\154\x61\x79\40\116\141\155\x65\x20\74\x75\x73\x65\162\156\141\155\x65\x40\145\170\x61\x6d\x70\154\x65\x2e\x63\x6f\155\76\42"; $phpcsFile->addError($error, $tag, "\111\x6e\166\141\x6c\151\x64\101\165\164\x68\157\x72\163"); } } } protected function processCopyright($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\143\157\x64\x65"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\143\x6f\156\x74\x65\x6e\164"]; $matches = array(); if (preg_match("\57\136\x28\x5b\60\55\x39\135\173\x34\175\x29\x28\50\x2e\173\61\175\x29\x28\x5b\60\x2d\x39\x5d\x7b\64\175\x29\x29\77\40\x28\x2e\x2b\51\44\x2f", $content, $matches) !== 0) { if ($matches[3] !== '' && $matches[3] !== null) { if ($matches[3] !== "\55") { $error = "\x41\x20\x68\x79\160\150\x65\156\x20\x6d\x75\163\164\40\x62\145\x20\x75\x73\x65\144\40\x62\145\164\x77\x65\145\x6e\40\x74\150\x65\x20\x65\141\162\x6c\151\145\163\164\40\141\156\144\40\154\x61\164\x65\163\x74\x20\x79\145\x61\x72"; $phpcsFile->addError($error, $tag, "\103\157\x70\x79\x72\x69\147\x68\164\110\x79\160\150\x65\156"); } if ($matches[4] !== '' && $matches[4] !== null && $matches[4] < $matches[1]) { $error = "\x49\x6e\x76\x61\x6c\151\144\40\x79\145\141\x72\40\x73\x70\141\x6e\40\x22{$matches["\61"]}{$matches["\x33"]}{$matches["\x34"]}\42\x20\146\157\165\156\x64\73\40\x63\x6f\156\x73\151\x64\x65\162\40\x22{$matches["\64"]}\55{$matches["\x31"]}\x22\x20\151\156\163\x74\x65\x61\x64"; $phpcsFile->addWarning($error, $tag, "\x49\156\x76\x61\154\x69\x64\x43\157\160\171\162\x69\147\150\x74"); } } } else { $error = "\x40\x63\157\x70\x79\x72\x69\x67\150\x74\x20\164\x61\x67\40\155\165\x73\x74\40\143\157\x6e\164\x61\151\156\40\x61\40\171\145\x61\162\40\x61\x6e\144\x20\164\150\x65\40\156\x61\x6d\145\x20\x6f\146\40\x74\150\x65\40\x63\x6f\x70\x79\162\x69\x67\x68\x74\x20\x68\157\154\x64\145\x72"; $phpcsFile->addError($error, $tag, "\111\x6e\x63\x6f\x6d\x70\154\145\x74\x65\103\x6f\160\171\x72\151\x67\150\x74"); } } } protected function processLicense($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\143\157\144\145"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\143\157\x6e\x74\145\x6e\x74"]; $matches = array(); preg_match("\57\136\50\x5b\x5e\134\x73\135\x2b\51\134\x73\53\x28\56\52\51\x2f", $content, $matches); if (count($matches) !== 3) { $error = "\100\x6c\x69\x63\x65\x6e\163\x65\40\x74\141\147\40\155\165\x73\164\x20\143\157\156\164\141\151\x6e\40\141\x20\x55\122\114\x20\x61\156\x64\40\x61\x20\154\151\143\x65\x6e\163\x65\40\x6e\141\x6d\145"; $phpcsFile->addError($error, $tag, "\111\x6e\x63\x6f\155\160\154\145\x74\145\114\151\143\145\x6e\163\x65"); } } } protected function processVersion($phpcsFile, array $tags) { $tokens = $phpcsFile->getTokens(); foreach ($tags as $tag) { if ($tokens[$tag + 2]["\143\x6f\x64\x65"] !== T_DOC_COMMENT_STRING) { continue; } $content = $tokens[$tag + 2]["\x63\157\x6e\164\145\156\164"]; if (strstr($content, "\x43\126\123\72") === false && strstr($content, "\123\126\x4e\x3a") === false && strstr($content, "\107\111\124\72") === false && strstr($content, "\x48\x47\x3a") === false) { $error = "\111\x6e\x76\141\154\x69\x64\40\x76\145\162\163\151\157\x6e\40\42\x25\x73\x22\40\x69\156\x20\146\151\154\x65\x20\x63\x6f\x6d\155\145\x6e\164\73\40\143\157\x6e\x73\x69\x64\x65\162\x20\42\x43\126\x53\72\40\74\x63\166\x73\x5f\151\x64\76\42\40\x6f\x72\40\x22\x53\126\116\x3a\x20\x3c\x73\x76\x6e\x5f\151\144\x3e\x22\x20\x6f\162\40\42\x47\111\x54\x3a\40\74\x67\151\164\137\151\x64\76\x22\40\157\x72\40\42\110\107\x3a\x20\x3c\150\147\137\151\x64\x3e\42\x20\151\156\x73\164\145\141\x64"; $data = array($content); $phpcsFile->addWarning($error, $tag, "\x49\x6e\x76\141\154\x69\x64\x56\145\162\x73\x69\x6f\156", $data); } } } }

Function Calls

None

Variables

None

Stats

MD5 673377dca14efb61fec31fab5bd3c712
Eval Count 0
Decode Time 121 ms