standardiseToken() public static méthode

Takes a token produced from token_get_all() and produces a more uniform token.
public static standardiseToken ( string | array $token ) : array
$token string | array The token to convert.
Résultat array The new token.
 /**
  * Creates a token pattern.
  *
  * @param string $str The tokens string that the pattern should match.
  *
  * @return array The pattern step.
  * @see    _createSkipPattern()
  * @see    _parse()
  */
 private function _createTokenPattern($str)
 {
     // Don't add a space after the closing php tag as it will add a new
     // whitespace token.
     $tokens = token_get_all('<?php ' . $str . '?>');
     // Remove the <?php tag from the front and the end php tag from the back.
     $tokens = array_slice($tokens, 1, count($tokens) - 2);
     foreach ($tokens as &$token) {
         $token = PHP_CodeSniffer_Tokenizers_PHP::standardiseToken($token);
     }
     $patterns = array();
     foreach ($tokens as $patternInfo) {
         $patterns[] = array('type' => 'token', 'token' => $patternInfo['code'], 'value' => $patternInfo['content']);
     }
     return $patterns;
 }