Code Duplication    Length = 13-13 lines in 3 locations

lib/private/App/CodeChecker/NodeVisitor.php 3 locations

@@ 228-240 (lines=13) @@
225
		}
226
	}
227
228
	private function checkBlackListConstant($class, $constantName, Node $node) {
229
		$name = $class . '::' . $constantName;
230
		$lowerName = \strtolower($name);
231
232
		if (isset($this->blackListedConstants[$lowerName])) {
233
			$this->errors[]= [
234
				'disallowedToken' => $name,
235
				'errorCode' => CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED,
236
				'line' => $node->getLine(),
237
				'reason' => $this->buildReason($this->blackListedConstants[$lowerName], CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED)
238
			];
239
		}
240
	}
241
242
	private function checkBlackListFunction($class, $functionName, Node $node) {
243
		$name = $class . '::' . $functionName;
@@ 242-254 (lines=13) @@
239
		}
240
	}
241
242
	private function checkBlackListFunction($class, $functionName, Node $node) {
243
		$name = $class . '::' . $functionName;
244
		$lowerName = \strtolower($name);
245
246
		if (isset($this->blackListedFunctions[$lowerName])) {
247
			$this->errors[]= [
248
				'disallowedToken' => $name,
249
				'errorCode' => CodeChecker::STATIC_CALL_NOT_ALLOWED,
250
				'line' => $node->getLine(),
251
				'reason' => $this->buildReason($this->blackListedFunctions[$lowerName], CodeChecker::STATIC_CALL_NOT_ALLOWED)
252
			];
253
		}
254
	}
255
256
	private function checkBlackListMethod($class, $functionName, Node $node) {
257
		$name = $class . '::' . $functionName;
@@ 256-268 (lines=13) @@
253
		}
254
	}
255
256
	private function checkBlackListMethod($class, $functionName, Node $node) {
257
		$name = $class . '::' . $functionName;
258
		$lowerName = \strtolower($name);
259
260
		if (isset($this->blackListedMethods[$lowerName])) {
261
			$this->errors[]= [
262
				'disallowedToken' => $name,
263
				'errorCode' => CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED,
264
				'line' => $node->getLine(),
265
				'reason' => $this->buildReason($this->blackListedMethods[$lowerName], CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED)
266
			];
267
		}
268
	}
269
270
	private function buildReason($name, $errorCode) {
271
		if (isset($this->errorMessages[$errorCode])) {