PhoneNumberMask::maskNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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