vendor/wikimedia/common-passwords/src/CommonPasswords.php
raw| 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 | } |