@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $url, |
| 53 | 53 | (string) $archiveData['longformurl'], |
| 54 | 54 | $archiveData['timestamp'] |
| 55 | - ? DateTimeImmutable::createFromFormat('U', (string)$archiveData['timestamp']) |
|
| 55 | + ? DateTimeImmutable::createFromFormat('U', (string) $archiveData['timestamp']) |
|
| 56 | 56 | : null |
| 57 | 57 | ); // todo factory ? |
| 58 | 58 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $response = $this->externHttpClient->getClient()->request( |
| 63 | 63 | 'GET', |
| 64 | - self::API_URL . urlencode($url) |
|
| 64 | + self::API_URL.urlencode($url) |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | if (!$response instanceof ResponseInterface || $response->getStatusCode() !== 200) { |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | $data = json_decode($jsonString, true) ?? []; |
| 76 | 76 | |
| 77 | 77 | // check wikiwix archive status |
| 78 | - if (empty($data['status']) || (int)$data['status'] !== 200) { |
|
| 79 | - $this->log->debug('WikiwixAdapter incorrect response: ' . $jsonString); |
|
| 78 | + if (empty($data['status']) || (int) $data['status'] !== 200) { |
|
| 79 | + $this->log->debug('WikiwixAdapter incorrect response: '.$jsonString); |
|
| 80 | 80 | |
| 81 | 81 | return []; |
| 82 | 82 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $webarchive = $this->archiver->searchWebarchive($url); |
| 44 | 44 | if ($webarchive instanceof WebarchiveDTO) { |
| 45 | 45 | $this->log->notice(' |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | class WikiBotConfig |
| 32 | 32 | { |
| 33 | 33 | public const VERSION = '2.1'; |
| 34 | - public const WATCHPAGE_FILENAME = __DIR__ . '/resources/watch_pages.json'; |
|
| 34 | + public const WATCHPAGE_FILENAME = __DIR__.'/resources/watch_pages.json'; |
|
| 35 | 35 | public const EXIT_ON_CHECK_WATCHPAGE = false; |
| 36 | 36 | // do not stop if they play with {stop} on bot talk page |
| 37 | 37 | public const BLACKLIST_EDITOR = ['OrlodrimBot']; |
@@ -97,9 +97,8 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $text = WikiTextUtil::removeHTMLcomments($text); |
| 99 | 99 | $botName = $botName ?: self::getBotName(); |
| 100 | - $denyReg = (empty($botName)) ? '' : |
|
| 101 | - '|\{\{bots ?\| ?(optout|deny)\=[^\}]*' . preg_quote($botName, '#') . '[^\}]*\}\}'; |
|
| 102 | - return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}' . $denyReg . ')#i', $text) > 0; |
|
| 100 | + $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}'; |
|
| 101 | + return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0; |
|
| 103 | 102 | } |
| 104 | 103 | |
| 105 | 104 | protected static function getBotOwner() |
@@ -155,7 +154,7 @@ discard block |
||
| 155 | 154 | |
| 156 | 155 | protected function getBotTalkPageTitle(): string |
| 157 | 156 | { |
| 158 | - return self::TALK_PAGE_PREFIX . $this::getBotName(); |
|
| 157 | + return self::TALK_PAGE_PREFIX.$this::getBotName(); |
|
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | /** |
@@ -266,8 +265,8 @@ discard block |
||
| 266 | 265 | */ |
| 267 | 266 | public function minutesSinceLastEdit(string $title): int |
| 268 | 267 | { |
| 269 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 268 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 270 | 269 | |
| 271 | - return (int)round((time() - strtotime($time)) / 60); |
|
| 270 | + return (int) round((time() - strtotime($time)) / 60); |
|
| 272 | 271 | } |
| 273 | 272 | } |