GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 131-131 lines in 2 locations

vendor/squizlabs/php_codesniffer/CodeSniffer/File.php 2 locations

@@ 990-1120 (lines=131) @@
987
     *
988
     * @return boolean
989
     */
990
    private function _addError($error, $line, $column, $code, $data, $severity, $fixable)
991
    {
992
        if (isset(self::$_ignoredLines[$line]) === true) {
993
            return false;
994
        }
995
996
        // Work out which sniff generated the error.
997
        if (substr($code, 0, 9) === 'Internal.') {
998
            // Any internal message.
999
            $sniffCode = $code;
1000
        } else {
1001
            $parts = explode('_', str_replace('\\', '_', $this->_activeListener));
1002
            if (isset($parts[3]) === true) {
1003
                $sniff = $parts[0].'.'.$parts[2].'.'.$parts[3];
1004
1005
                // Remove "Sniff" from the end.
1006
                $sniff = substr($sniff, 0, -5);
1007
            } else {
1008
                $sniff = 'unknownSniff';
1009
            }
1010
1011
            $sniffCode = $sniff;
1012
            if ($code !== '') {
1013
                $sniffCode .= '.'.$code;
1014
            }
1015
        }//end if
1016
1017
        // If we know this sniff code is being ignored for this file, return early.
1018
        if (isset($this->_ignoredCodes[$sniffCode]) === true) {
1019
            return false;
1020
        }
1021
1022
        // Make sure this message type has not been set to "warning".
1023
        if (isset($this->ruleset[$sniffCode]['type']) === true
1024
            && $this->ruleset[$sniffCode]['type'] === 'warning'
1025
        ) {
1026
            // Pass this off to the warning handler.
1027
            return $this->_addWarning($error, $line, $column, $code, $data, $severity, $fixable);
1028
        } else if ($this->phpcs->cli->errorSeverity === 0) {
1029
            // Don't bother doing any processing as errors are just going to
1030
            // be hidden in the reports anyway.
1031
            return false;
1032
        }
1033
1034
        // Make sure we are interested in this severity level.
1035
        if (isset($this->ruleset[$sniffCode]['severity']) === true) {
1036
            $severity = $this->ruleset[$sniffCode]['severity'];
1037
        } else if ($severity === 0) {
1038
            $severity = PHPCS_DEFAULT_ERROR_SEV;
1039
        }
1040
1041
        if ($this->phpcs->cli->errorSeverity > $severity) {
1042
            return false;
1043
        }
1044
1045
        // Make sure we are not ignoring this file.
1046
        $patterns = $this->phpcs->getIgnorePatterns($sniffCode);
1047
        foreach ($patterns as $pattern => $type) {
1048
            // While there is support for a type of each pattern
1049
            // (absolute or relative) we don't actually support it here.
1050
            $replacements = array(
1051
                             '\\,' => ',',
1052
                             '*'   => '.*',
1053
                            );
1054
1055
            // We assume a / directory separator, as do the exclude rules
1056
            // most developers write, so we need a special case for any system
1057
            // that is different.
1058
            if (DIRECTORY_SEPARATOR === '\\') {
1059
                $replacements['/'] = '\\\\';
1060
            }
1061
1062
            $pattern = '`'.strtr($pattern, $replacements).'`i';
1063
            if (preg_match($pattern, $this->_file) === 1) {
1064
                $this->_ignoredCodes[$sniffCode] = true;
1065
                return false;
1066
            }
1067
        }//end foreach
1068
1069
        $this->_errorCount++;
1070
        if ($fixable === true) {
1071
            $this->_fixableCount++;
1072
        }
1073
1074
        if ($this->_recordErrors === false) {
1075
            if (isset($this->_errors[$line]) === false) {
1076
                $this->_errors[$line] = 0;
1077
            }
1078
1079
            $this->_errors[$line]++;
1080
            return true;
1081
        }
1082
1083
        // Work out the error message.
1084
        if (isset($this->ruleset[$sniffCode]['message']) === true) {
1085
            $error = $this->ruleset[$sniffCode]['message'];
1086
        }
1087
1088
        if (empty($data) === true) {
1089
            $message = $error;
1090
        } else {
1091
            $message = vsprintf($error, $data);
1092
        }
1093
1094
        if (isset($this->_errors[$line]) === false) {
1095
            $this->_errors[$line] = array();
1096
        }
1097
1098
        if (isset($this->_errors[$line][$column]) === false) {
1099
            $this->_errors[$line][$column] = array();
1100
        }
1101
1102
        $this->_errors[$line][$column][] = array(
1103
                                            'message'  => $message,
1104
                                            'source'   => $sniffCode,
1105
                                            'severity' => $severity,
1106
                                            'fixable'  => $fixable,
1107
                                           );
1108
1109
        if (PHP_CODESNIFFER_VERBOSITY > 1
1110
            && $this->fixer->enabled === true
1111
            && $fixable === true
1112
        ) {
1113
            @ob_end_clean();
1114
            echo "\tE: [Line $line] $message ($sniffCode)".PHP_EOL;
1115
            ob_start();
1116
        }
1117
1118
        return true;
1119
1120
    }//end _addError()
1121
1122
1123
    /**
@@ 1137-1267 (lines=131) @@
1134
     *
1135
     * @return boolean
1136
     */
1137
    private function _addWarning($warning, $line, $column, $code, $data, $severity, $fixable)
1138
    {
1139
        if (isset(self::$_ignoredLines[$line]) === true) {
1140
            return false;
1141
        }
1142
1143
        // Work out which sniff generated the warning.
1144
        if (substr($code, 0, 9) === 'Internal.') {
1145
            // Any internal message.
1146
            $sniffCode = $code;
1147
        } else {
1148
            $parts = explode('_', str_replace('\\', '_', $this->_activeListener));
1149
            if (isset($parts[3]) === true) {
1150
                $sniff = $parts[0].'.'.$parts[2].'.'.$parts[3];
1151
1152
                // Remove "Sniff" from the end.
1153
                $sniff = substr($sniff, 0, -5);
1154
            } else {
1155
                $sniff = 'unknownSniff';
1156
            }
1157
1158
            $sniffCode = $sniff;
1159
            if ($code !== '') {
1160
                $sniffCode .= '.'.$code;
1161
            }
1162
        }//end if
1163
1164
        // If we know this sniff code is being ignored for this file, return early.
1165
        if (isset($this->_ignoredCodes[$sniffCode]) === true) {
1166
            return false;
1167
        }
1168
1169
        // Make sure this message type has not been set to "error".
1170
        if (isset($this->ruleset[$sniffCode]['type']) === true
1171
            && $this->ruleset[$sniffCode]['type'] === 'error'
1172
        ) {
1173
            // Pass this off to the error handler.
1174
            return $this->_addError($warning, $line, $column, $code, $data, $severity, $fixable);
1175
        } else if ($this->phpcs->cli->warningSeverity === 0) {
1176
            // Don't bother doing any processing as warnings are just going to
1177
            // be hidden in the reports anyway.
1178
            return false;
1179
        }
1180
1181
        // Make sure we are interested in this severity level.
1182
        if (isset($this->ruleset[$sniffCode]['severity']) === true) {
1183
            $severity = $this->ruleset[$sniffCode]['severity'];
1184
        } else if ($severity === 0) {
1185
            $severity = PHPCS_DEFAULT_WARN_SEV;
1186
        }
1187
1188
        if ($this->phpcs->cli->warningSeverity > $severity) {
1189
            return false;
1190
        }
1191
1192
        // Make sure we are not ignoring this file.
1193
        $patterns = $this->phpcs->getIgnorePatterns($sniffCode);
1194
        foreach ($patterns as $pattern => $type) {
1195
            // While there is support for a type of each pattern
1196
            // (absolute or relative) we don't actually support it here.
1197
            $replacements = array(
1198
                             '\\,' => ',',
1199
                             '*'   => '.*',
1200
                            );
1201
1202
            // We assume a / directory separator, as do the exclude rules
1203
            // most developers write, so we need a special case for any system
1204
            // that is different.
1205
            if (DIRECTORY_SEPARATOR === '\\') {
1206
                $replacements['/'] = '\\\\';
1207
            }
1208
1209
            $pattern = '`'.strtr($pattern, $replacements).'`i';
1210
            if (preg_match($pattern, $this->_file) === 1) {
1211
                $this->_ignoredCodes[$sniffCode] = true;
1212
                return false;
1213
            }
1214
        }//end foreach
1215
1216
        $this->_warningCount++;
1217
        if ($fixable === true) {
1218
            $this->_fixableCount++;
1219
        }
1220
1221
        if ($this->_recordErrors === false) {
1222
            if (isset($this->_warnings[$line]) === false) {
1223
                $this->_warnings[$line] = 0;
1224
            }
1225
1226
            $this->_warnings[$line]++;
1227
            return true;
1228
        }
1229
1230
        // Work out the warning message.
1231
        if (isset($this->ruleset[$sniffCode]['message']) === true) {
1232
            $warning = $this->ruleset[$sniffCode]['message'];
1233
        }
1234
1235
        if (empty($data) === true) {
1236
            $message = $warning;
1237
        } else {
1238
            $message = vsprintf($warning, $data);
1239
        }
1240
1241
        if (isset($this->_warnings[$line]) === false) {
1242
            $this->_warnings[$line] = array();
1243
        }
1244
1245
        if (isset($this->_warnings[$line][$column]) === false) {
1246
            $this->_warnings[$line][$column] = array();
1247
        }
1248
1249
        $this->_warnings[$line][$column][] = array(
1250
                                              'message'  => $message,
1251
                                              'source'   => $sniffCode,
1252
                                              'severity' => $severity,
1253
                                              'fixable'  => $fixable,
1254
                                             );
1255
1256
        if (PHP_CODESNIFFER_VERBOSITY > 1
1257
            && $this->fixer->enabled === true
1258
            && $fixable === true
1259
        ) {
1260
            @ob_end_clean();
1261
            echo "\tW: $message ($sniffCode)".PHP_EOL;
1262
            ob_start();
1263
        }
1264
1265
        return true;
1266
1267
    }//end _addWarning()
1268
1269
1270
    /**