Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
CommonPasswords | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
getData | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
isCommon | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Wikimedia\CommonPasswords; |
4 | |
5 | class CommonPasswords { |
6 | |
7 | /** |
8 | * @internal |
9 | * @return array |
10 | */ |
11 | public static function getData() { |
12 | static $data = null; |
13 | if ( $data === null ) { |
14 | $data = require __DIR__ . '/common.php'; |
15 | } |
16 | return $data; |
17 | } |
18 | |
19 | /** |
20 | * @param string $password Password to check if it's considered common |
21 | * @return bool |
22 | */ |
23 | public static function isCommon( $password ) { |
24 | return isset( self::getData()[ $password ] ); |
25 | } |
26 | } |