| Total Complexity | 6 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 96% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class ErrorReport |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Liste les erreurs reportées. |
||
| 16 | * 0 => "|editor=JT Staley, MP Bryant, N Pfennig, and JG Holt, eds. <!--PARAMETRE 'editor' N'EXISTE PAS -->" |
||
| 17 | * 1 => "|editor=DR Boone and RW Castenholz, eds. <!--PARAMETRE 'editor' N'EXISTE PAS -->". |
||
| 18 | * |
||
| 19 | * @param string $text |
||
| 20 | * |
||
| 21 | * @return array|null |
||
| 22 | */ |
||
| 23 | 1 | public function getReport(string $text): ?array |
|
| 24 | { |
||
| 25 | 1 | if (preg_match_all( |
|
| 26 | 1 | '#\\* <span style="background:\#FCDFE8"><nowiki>([^\n]+)</nowiki></span>\n#', |
|
| 27 | 1 | $text, |
|
| 28 | 1 | $matches |
|
| 29 | 1 | ) > 0 |
|
| 30 | ) { |
||
| 31 | // FIXED zizibot : des '<nowiki>' supplémentaires ajoutés à quelques rapports |
||
| 32 | 1 | return str_replace('<nowiki>', '', $matches[1]); |
|
| 33 | } |
||
| 34 | |||
| 35 | return null; |
||
| 36 | } |
||
| 37 | |||
| 38 | 1 | public function countErrorInText(array $errors, string $text): int |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Delete the previous bot errorReporting message from text. |
||
| 52 | * |
||
| 53 | * @param string $text |
||
| 54 | * @param string|null $botName |
||
| 55 | * |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | 1 | public function deleteAllReports(string $text, ?string $botName = 'CodexBot'): string |
|
| 74 | } |
||
| 75 | } |
||
| 76 |