Code Duplication    Length = 17-18 lines in 2 locations

src/Tokenizers/PHP.php 2 locations

@@ 1021-1037 (lines=17) @@
1018
                }//end if
1019
1020
                $newToken = null;
1021
                if ($tokenIsArray === false) {
1022
                    if (isset(self::$_resolveTokenCache[$token[0]]) === true) {
1023
                        $newToken = self::$_resolveTokenCache[$token[0]];
1024
                    }
1025
                } else {
1026
                    $cacheKey = null;
1027
                    if ($token[0] === T_STRING) {
1028
                        $cacheKey = strtolower($token[1]);
1029
                    } else if ($token[0] !== T_CURLY_OPEN) {
1030
                        $cacheKey = $token[0];
1031
                    }
1032
1033
                    if ($cacheKey !== null && isset(self::$_resolveTokenCache[$cacheKey]) === true) {
1034
                        $newToken            = self::$_resolveTokenCache[$cacheKey];
1035
                        $newToken['content'] = $token[1];
1036
                    }
1037
                }
1038
1039
                if ($newToken === null) {
1040
                    $newToken = self::standardiseToken($token);
@@ 1557-1574 (lines=18) @@
1554
     */
1555
    public static function standardiseToken($token)
1556
    {
1557
        if (isset($token[1]) === false) {
1558
            if (isset(self::$_resolveTokenCache[$token[0]]) === true) {
1559
                return self::$_resolveTokenCache[$token[0]];
1560
            }
1561
        } else {
1562
            $cacheKey = null;
1563
            if ($token[0] === T_STRING) {
1564
                $cacheKey = strtolower($token[1]);
1565
            } else if ($token[0] !== T_CURLY_OPEN) {
1566
                $cacheKey = $token[0];
1567
            }
1568
1569
            if ($cacheKey !== null && isset(self::$_resolveTokenCache[$cacheKey]) === true) {
1570
                $newToken            = self::$_resolveTokenCache[$cacheKey];
1571
                $newToken['content'] = $token[1];
1572
                return $newToken;
1573
            }
1574
        }
1575
1576
        if (isset($token[1]) === false) {
1577
            return self::resolveSimpleToken($token[0]);