@@ -27,8 +27,8 @@ class Tokens
27
27
/**
28
28
* Checks if a pattern is a match for the specified token.
29
29
*
30
- * @param Token $token The token to be matched.
31
- * @param array $pattern The pattern to be matches.
30
+ * @param Token $token The token to be matched.
31
+ * @param array $pattern The pattern to be matches.
32
32
*
33
33
* @return bool
34
34
*/
@@ -71,7 +71,8 @@ public static function match(Token $token, array $pattern)
71
71
return true ;
72
72
}
73
73
74
- public static function replaceTokens ($ list , array $ find , array $ replace ) {
74
+ public static function replaceTokens ($ list , array $ find , array $ replace )
75
+ {
75
76
76
77
/**
77
78
* Whether the first parameter is a list.
@@ -107,7 +108,6 @@ public static function replaceTokens($list, array $find, array $replace) {
107
108
$ i = 0 ;
108
109
109
110
while ($ i < $ list ->count ) {
110
-
111
111
// A sequence may not start with a comment.
112
112
if ($ list ->tokens [$ i ]->type === Token::TYPE_COMMENT ) {
113
113
$ newList [] = $ list ->tokens [$ i ];
@@ -137,7 +137,6 @@ public static function replaceTokens($list, array $find, array $replace) {
137
137
138
138
// Checking if the next tokens match the pattern described.
139
139
while (($ j < $ list ->count ) && ($ k < $ findCount )) {
140
-
141
140
// Comments are being skipped.
142
141
if ($ list ->tokens [$ j ]->type === Token::TYPE_COMMENT ) {
143
142
++$ j ;
@@ -156,7 +155,6 @@ public static function replaceTokens($list, array $find, array $replace) {
156
155
157
156
// Checking if the sequence was found.
158
157
if ($ k === $ findCount ) {
159
-
160
158
// Inserting new tokens.
161
159
foreach ($ replace as $ token ) {
162
160
$ newList [] = $ token ;
@@ -174,5 +172,4 @@ public static function replaceTokens($list, array $find, array $replace) {
174
172
return $ isList ?
175
173
new TokensList ($ newList ) : TokensList::build ($ newList );
176
174
}
177
-
178
- }
175
+ }
0 commit comments