File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,17 @@ class NewsFetcher {
1717 private ?string $ apiKey = null ;
1818 private CurlFetcher $ curlFetcher ;
1919
20- private const STATIC_REPLACEMENTS = [
21- ' (Anatol) ' => ' (Anatol) ' ,
22- ' (Kalle) ' => ' (Kalle) ' ,
23- ];
20+ private array $ staticReplacements = [];
2421
2522 public function __construct (string $ apiKey = null ) {
2623 $ this ->apiKey = $ apiKey ;
2724 $ this ->curlFetcher = new CurlFetcher ();
2825 }
2926
27+ public function setReplacements (array $ replacements ): void {
28+ $ this ->staticReplacements = $ replacements ;
29+ }
30+
3031 public function fetchAllForVersion (int |string $ version ): array {
3132 if (is_string ($ version )) {
3233 if ($ version !== 'master ' ) {
@@ -70,8 +71,8 @@ private function parseNewsPage(string $contents): array {
7071 $ lineNo = (int )$ lineNo ;
7172 ++$ lineNo ; // Line numbers start from 1, although the array index starts at 0
7273
73- if (isset (self :: STATIC_REPLACEMENTS [$ line ])) {
74- $ line = self :: STATIC_REPLACEMENTS [$ line ];
74+ if (isset ($ this -> staticReplacements [$ line ])) {
75+ $ line = $ this -> staticReplacements [$ line ];
7576 }
7677
7778 // Should skip line?
You can’t perform that action at this time.
0 commit comments