コード例 #1
0
 public function getClassnameForToken(Token $token)
 {
     $type = $token->getType();
     $value = $token->getValue();
     $classname = null;
     switch ($type) {
         case T_STRING:
             // case of operators
             if (isset(self::$OPERATOR_MAP[$value])) {
                 $classname = self::$OPERATOR_MAP[$value];
             }
             break;
         default:
             $classname = token_name($type);
             break;
     }
     // camelcase
     $classname = strtolower($classname);
     $classname = preg_replace_callback('/_(.?)/', function ($matches) {
         return strtoupper($matches[1]);
     }, $classname);
     $classname = preg_replace('!(^t)!', '', $classname);
     if (null !== $classname) {
         $classname = '\\Hal\\MutaTesting\\Mutater\\Mutater' . $classname;
     }
     return $classname;
 }
コード例 #2
0
ファイル: TokenTest.php プロジェクト: truffo/PhpMetrics
 /**
  * @dataProvider providesTokens
  */
 public function testICanWorkWithDifferentKindOfTokens($data)
 {
     $token = new Token($data);
     $this->assertNotNull($token->getType());
 }