PhoneNumberMask   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 10
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A maskNumber() 0 5 1
1
<?php
2
3
/**
4
 * SPDX-FileCopyrightText: 2018 Christoph Wurst <[email protected]>
5
 * SPDX-License-Identifier: AGPL-3.0-or-later
6
 */
7
8
namespace OCA\TwoFactorGateway;
9
10
class PhoneNumberMask {
11
12
	/**
13
	 * convert 123456789 to ******789
14
	 */
15
	public static function maskNumber(string $number): string {
16
		$length = strlen($number);
17
		$start = $length - 3;
18
19
		return str_repeat('*', $start) . substr($number, $start);
20
	}
21
}
22