@@ -23,6 +23,6 @@ |
||
23 | 23 | $this::assertTrue(Bot::isEditionRestricted('{{3R}} bla')); |
24 | 24 | $this::assertTrue(Bot::isEditionRestricted('{{nobots}} bla')); |
25 | 25 | $this::assertTrue(Bot::isEditionRestricted('{{bots|deny=Bob,FuBot}} bla', 'FuBot')); |
26 | - $this::assertFalse(Bot::isEditionRestricted('{{bots|deny=Bob,FuBot}} bla'));; |
|
26 | + $this::assertFalse(Bot::isEditionRestricted('{{bots|deny=Bob,FuBot}} bla')); ; |
|
27 | 27 | } |
28 | 28 | } |
@@ -151,7 +151,7 @@ |
||
151 | 151 | |
152 | 152 | // No page to edit |
153 | 153 | $rows = $pageInfo->fetchAll(); |
154 | - if(empty($rows)){ |
|
154 | + if (empty($rows)) { |
|
155 | 155 | return "[]"; |
156 | 156 | } |
157 | 157 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function getRedirect(): ?string |
114 | 114 | { |
115 | 115 | if ($this->getText() && preg_match('/^#REDIRECT(?:ION)? ?\[\[([^]]+)]]/i', $this->getText(), $matches)) { |
116 | - return (string)trim($matches[1]); |
|
116 | + return (string) trim($matches[1]); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return null; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return bool |
148 | 148 | * @throws Exception |
149 | 149 | */ |
150 | - public function createPage(string $text, ?EditInfo $editInfo=null): bool |
|
150 | + public function createPage(string $text, ?EditInfo $editInfo = null): bool |
|
151 | 151 | { |
152 | 152 | if (!empty($this->page->getRevisions()->getLatest())) { |
153 | 153 | throw new \Exception('That page already exists'); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | ) { |
229 | 229 | foreach ($matches[0] as $num => $mention) { |
230 | 230 | $lang = $matches['lang'][$num] ?? ''; |
231 | - if(!empty($lang)){ |
|
231 | + if (!empty($lang)) { |
|
232 | 232 | $lang = Language::all2wiki($lang); |
233 | 233 | } |
234 | 234 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $parser = new TagParser(); // todo ParserFactory |
291 | 291 | $refs = $parser->importHtml($text)->getRefValues(); // [] |
292 | 292 | |
293 | - return (array)$refs; |
|
293 | + return (array) $refs; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -169,17 +169,17 @@ |
||
169 | 169 | |
170 | 170 | pageEdit: |
171 | 171 | |
172 | - try{ |
|
172 | + try { |
|
173 | 173 | $editInfo = new EditInfo($miniSummary, $this->minorFlag, $this->botFlag); |
174 | 174 | $success = $page->editPage(Normalizer::normalize($this->wikiText), $editInfo); |
175 | - }catch (\Throwable $e){ |
|
175 | + } catch (\Throwable $e) { |
|
176 | 176 | // Invalid CSRF token. |
177 | - if(strpos($e->getMessage(), 'Invalid CSRF token') !== false ) { |
|
177 | + if (strpos($e->getMessage(), 'Invalid CSRF token') !== false) { |
|
178 | 178 | echo "*** Invalid CSRF token \n"; |
179 | 179 | sleep(60); |
180 | 180 | $this->wikiLogin(); |
181 | 181 | goto pageEdit; |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | dump($e); // todo log |
184 | 184 | sleep(60); |
185 | 185 | return false; |
@@ -172,14 +172,14 @@ |
||
172 | 172 | try{ |
173 | 173 | $editInfo = new EditInfo($miniSummary, $this->minorFlag, $this->botFlag); |
174 | 174 | $success = $page->editPage(Normalizer::normalize($this->wikiText), $editInfo); |
175 | - }catch (\Throwable $e){ |
|
175 | + } catch (\Throwable $e){ |
|
176 | 176 | // Invalid CSRF token. |
177 | 177 | if(strpos($e->getMessage(), 'Invalid CSRF token') !== false ) { |
178 | 178 | echo "*** Invalid CSRF token \n"; |
179 | 179 | sleep(60); |
180 | 180 | $this->wikiLogin(); |
181 | 181 | goto pageEdit; |
182 | - }else{ |
|
182 | + } else{ |
|
183 | 183 | dump($e); // todo log |
184 | 184 | sleep(60); |
185 | 185 | return false; |