@@ -520,7 +520,10 @@ public function start($contents=null)
520
520
if (PHP_CODESNIFFER_VERBOSITY > 2 ) {
521
521
$ type = $ token ['type ' ];
522
522
$ content = str_replace ($ this ->eolChar , '\n ' , $ token ['content ' ]);
523
- $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
523
+ if (strtoupper (substr (PHP_OS , 0 , 3 )) !== 'WIN ' ) {
524
+ $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
525
+ }
526
+
524
527
echo "\t\tProcess token $ stackPtr: $ type => $ content " .PHP_EOL ;
525
528
}
526
529
@@ -1596,16 +1599,25 @@ private static function _createScopeMap(&$tokens, $tokenizer, $eolChar)
1596
1599
{
1597
1600
if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1598
1601
echo "\t*** START SCOPE MAP *** " .PHP_EOL ;
1602
+ $ isWin = false ;
1603
+ if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
1604
+ $ isWin = true ;
1605
+ }
1599
1606
}
1600
1607
1601
1608
$ numTokens = count ($ tokens );
1602
1609
for ($ i = 0 ; $ i < $ numTokens ; $ i ++) {
1603
1610
// Check to see if the current token starts a new scope.
1604
1611
if (isset ($ tokenizer ->scopeOpeners [$ tokens [$ i ]['code ' ]]) === true ) {
1605
1612
if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1606
- $ type = $ tokens [$ i ]['type ' ];
1607
- $ content = str_replace ($ eolChar , "\033[30;1m \\n \033[0m " , $ tokens [$ i ]['content ' ]);
1608
- $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
1613
+ $ type = $ tokens [$ i ]['type ' ];
1614
+ if ($ isWin === true ) {
1615
+ $ content = str_replace ($ eolChar , '\n ' , $ tokens [$ i ]['content ' ]);
1616
+ } else {
1617
+ $ content = str_replace ($ eolChar , "\033[30;1m \\n \033[0m " , $ tokens [$ i ]['content ' ]);
1618
+ $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
1619
+ }
1620
+
1609
1621
echo "\tStart scope map at $ i: $ type => $ content " .PHP_EOL ;
1610
1622
}
1611
1623
@@ -1649,6 +1661,14 @@ private static function _recurseScopeMap(
1649
1661
$ depth =1 ,
1650
1662
&$ ignore =0
1651
1663
) {
1664
+ if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1665
+ echo "\t*** START SCOPE MAP *** " .PHP_EOL ;
1666
+ $ isWin = false ;
1667
+ if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
1668
+ $ isWin = true ;
1669
+ }
1670
+ }
1671
+
1652
1672
$ opener = null ;
1653
1673
$ currType = $ tokens [$ stackPtr ]['code ' ];
1654
1674
$ startLine = $ tokens [$ stackPtr ]['line ' ];
@@ -1669,8 +1689,13 @@ private static function _recurseScopeMap(
1669
1689
1670
1690
if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1671
1691
$ type = $ tokens [$ i ]['type ' ];
1672
- $ content = str_replace ($ eolChar , "\033[30;1m \\n \033[0m " , $ tokens [$ i ]['content ' ]);
1673
- $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
1692
+ if ($ isWin === true ) {
1693
+ $ content = str_replace ($ eolChar , '\n ' , $ tokens [$ i ]['content ' ]);
1694
+ } else {
1695
+ $ content = str_replace ($ eolChar , "\033[30;1m \\n \033[0m " , $ tokens [$ i ]['content ' ]);
1696
+ $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
1697
+ }
1698
+
1674
1699
echo str_repeat ("\t" , $ depth );
1675
1700
echo "Process token $ i [ " ;
1676
1701
if ($ opener !== null ) {
@@ -1993,6 +2018,10 @@ private static function _createLevelMap(&$tokens, $tokenizer, $eolChar)
1993
2018
{
1994
2019
if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1995
2020
echo "\t*** START LEVEL MAP *** " .PHP_EOL ;
2021
+ $ isWin = false ;
2022
+ if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
2023
+ $ isWin = true ;
2024
+ }
1996
2025
}
1997
2026
1998
2027
$ numTokens = count ($ tokens );
@@ -2003,10 +2032,15 @@ private static function _createLevelMap(&$tokens, $tokenizer, $eolChar)
2003
2032
2004
2033
for ($ i = 0 ; $ i < $ numTokens ; $ i ++) {
2005
2034
if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
2006
- $ type = $ tokens [$ i ]['type ' ];
2007
- $ line = $ tokens [$ i ]['line ' ];
2008
- $ content = str_replace ($ eolChar , "\033[30;1m \\n \033[0m " , $ tokens [$ i ]['content ' ]);
2009
- $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
2035
+ $ type = $ tokens [$ i ]['type ' ];
2036
+ $ line = $ tokens [$ i ]['line ' ];
2037
+ if ($ isWin === true ) {
2038
+ $ content = str_replace ($ eolChar , '\n ' , $ tokens [$ i ]['content ' ]);
2039
+ } else {
2040
+ $ content = str_replace ($ eolChar , "\033[30;1m \\n \033[0m " , $ tokens [$ i ]['content ' ]);
2041
+ $ content = str_replace (' ' , "\033[30;1m· \033[0m " , $ content );
2042
+ }
2043
+
2010
2044
echo str_repeat ("\t" , ($ level + 1 ));
2011
2045
echo "Process token $ i on line $ line [lvl: $ level; " ;
2012
2046
if (empty ($ conditions ) !== true ) {
0 commit comments