| Total Complexity | 6 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class OuvrageEditErrorReport |
||
| 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 | public function getReport(string $text): ?array |
||
| 36 | } |
||
| 37 | |||
| 38 | public function countErrorInText(array $errors, string $text): int |
||
| 39 | { |
||
| 40 | $found = 0; |
||
| 41 | foreach ($errors as $error) { |
||
| 42 | if (false !== mb_strpos($text, $error)) { |
||
| 43 | ++$found; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | return $found; |
||
| 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 | public function deleteAllReports(string $text, ?string $botName = 'CodexBot'): string |
||
| 74 | } |
||
| 75 | } |
||
| 76 |