| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 3 | public function __construct(string $file, ?IKBTranslations $lang = null) |
|
| 24 | { |
||
| 25 | 3 | $lang = $lang ?: new Translations(); |
|
| 26 | 3 | $rows = @file($file); |
|
| 27 | 3 | if (false === $rows) { |
|
| 28 | 1 | throw new BanException($lang->ikbDefinedFileNotFound($file)); |
|
| 29 | } |
||
| 30 | |||
| 31 | // remove empty records |
||
| 32 | 2 | $rows = array_filter($rows); |
|
| 33 | |||
| 34 | // sort them, better for lookup |
||
| 35 | 2 | sort($rows); |
|
| 36 | |||
| 37 | // last clearing |
||
| 38 | 2 | $this->knownRecords = array_map([$this, 'noCrLf'], $rows); |
|
| 39 | 2 | } |
|
| 46 |