@@ -328,7 +328,7 @@ |
||
328 | 328 | 'modifs' => mb_substr(implode(',', $this->getSummaryLog()), 0, 250), |
329 | 329 | 'notcosmetic' => ($this->notCosmetic) ? 1 : 0, |
330 | 330 | 'major' => ($this->major) ? 1 : 0, |
331 | - 'isbn' => substr($isbn,0,19), |
|
331 | + 'isbn' => substr($isbn, 0, 19), |
|
332 | 332 | 'version' => WikiBotConfig::VERSION ?? null, |
333 | 333 | ]; |
334 | 334 | $this->log->info('finalData', $finalData); |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | if (isset($meta['citation_firstpage'])) { |
112 | 112 | $page = $meta['citation_firstpage']; |
113 | 113 | if (isset($meta['citation_lastpage'])) { |
114 | - $page .= '–' . $meta['citation_lastpage']; |
|
114 | + $page .= '–'.$meta['citation_lastpage']; |
|
115 | 115 | } |
116 | 116 | |
117 | - return (string)$page; |
|
117 | + return (string) $page; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return null; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $this->log->notice('EXCEPTION DATE'); |
341 | 341 | } |
342 | 342 | |
343 | - return '<!-- ' . $str . ' -->'; |
|
343 | + return '<!-- '.$str.' -->'; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | return $date->format('d-m-Y'); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | // Attention : pas de post-processing (sanitize title, etc.) |
35 | 35 | $result = $trans->process($url, $summary); |
36 | 36 | } catch (Exception $e) { |
37 | - echo "EXCEPTION ". $e->getMessage().$e->getFile().$e->getLine(); |
|
37 | + echo "EXCEPTION ".$e->getMessage().$e->getFile().$e->getLine(); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | echo $result."\n"; |
@@ -274,7 +274,7 @@ |
||
274 | 274 | if (mb_strlen($text) > $maxLength) { |
275 | 275 | $spacePos = mb_strrpos(mb_substr($text, 0, $maxLength), ' '); |
276 | 276 | $spacePos = ($spacePos > ($maxLength - 12)) ? $spacePos : $maxLength; |
277 | - $text = trim(mb_substr($text, 0, $spacePos)) . self::SYMBOL_TEXT_CUT; |
|
277 | + $text = trim(mb_substr($text, 0, $spacePos)).self::SYMBOL_TEXT_CUT; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $text; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // rebuild title but keep only the first 2 segments |
57 | - return trim($titleSegments[0]) . self::REBUILD_SEPARATOR . trim($titleSegments[1]); |
|
57 | + return trim($titleSegments[0]).self::REBUILD_SEPARATOR.trim($titleSegments[1]); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | return array_values(array_filter( |
104 | 104 | $seoSegments, |
105 | - function ($segment) use ($prettyDomainName, $siteName) { |
|
105 | + function($segment) use ($prettyDomainName, $siteName) { |
|
106 | 106 | $strippedSegment = mb_strtolower(TextUtil::stripPunctuation(TextUtil::stripAccents($segment))); |
107 | 107 | $strippedSegment = str_replace(['.', '-', ' '], '', $strippedSegment); |
108 | 108 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | public const VERSION = '1.0'; |
35 | 35 | |
36 | - public const WATCHPAGE_FILENAME = __DIR__ . '/resources/watch_pages.json'; |
|
36 | + public const WATCHPAGE_FILENAME = __DIR__.'/resources/watch_pages.json'; |
|
37 | 37 | |
38 | 38 | public const EXIT_ON_CHECK_WATCHPAGE = false; |
39 | 39 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function minutesSinceLastEdit(string $title): int |
158 | 158 | { |
159 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
159 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
160 | 160 | |
161 | - return (int)round((time() - strtotime($time)) / 60); |
|
161 | + return (int) round((time() - strtotime($time)) / 60); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -169,9 +169,8 @@ discard block |
||
169 | 169 | { |
170 | 170 | $text = WikiTextUtil::removeHTMLcomments($text); |
171 | 171 | $botName = $botName ?: self::getBotName(); |
172 | - $denyReg = (empty($botName)) ? '' : |
|
173 | - '|\{\{bots ?\| ?(optout|deny)\=[^\}]*' . preg_quote($botName, '#') . '[^\}]*\}\}'; |
|
174 | - return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}' . $denyReg . ')#i', $text) > 0; |
|
172 | + $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}'; |
|
173 | + return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0; |
|
175 | 174 | } |
176 | 175 | |
177 | 176 | /** |
@@ -227,14 +226,14 @@ discard block |
||
227 | 226 | |
228 | 227 | protected function getBotTalkPageTitle(): string |
229 | 228 | { |
230 | - return self::TALK_PAGE_PREFIX . $this::getBotName(); |
|
229 | + return self::TALK_PAGE_PREFIX.$this::getBotName(); |
|
231 | 230 | } |
232 | 231 | |
233 | 232 | protected function sendSMSandFunnyTalk(string $lastEditor, ?bool $botTalk): void |
234 | 233 | { |
235 | 234 | if (class_exists(SMS::class)) { |
236 | 235 | try { |
237 | - new SMS($this::getBotName() . ' {stop} by ' . $lastEditor); |
|
236 | + new SMS($this::getBotName().' {stop} by '.$lastEditor); |
|
238 | 237 | } catch (Exception $smsException) { |
239 | 238 | unset($smsException); |
240 | 239 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | if ($this->modeAuto) { |
24 | 24 | return true; |
25 | 25 | } |
26 | - $ask = readline(Color::LIGHT_MAGENTA . '*** '.$question.' [y/n/auto]' . Color::NORMAL); |
|
26 | + $ask = readline(Color::LIGHT_MAGENTA.'*** '.$question.' [y/n/auto]'.Color::NORMAL); |
|
27 | 27 | if ('auto' === $ask) { |
28 | 28 | $this->modeAuto = true; |
29 | 29 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES |
25 | 25 | ); |
26 | 26 | } catch (Throwable $e) { |
27 | - $this->log->critical("Can't parse ARTICLE_ANALYZED_FILENAME : " . $e->getMessage()); |
|
27 | + $this->log->critical("Can't parse ARTICLE_ANALYZED_FILENAME : ".$e->getMessage()); |
|
28 | 28 | $analyzed = []; |
29 | 29 | } |
30 | 30 | $this->pastAnalyzed = ($analyzed !== false) ? $analyzed : []; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | if (!$this->checkAlreadyAnalyzed($title)) { |
36 | 36 | $this->pastAnalyzed[] = $title; // skip doublon title |
37 | - @file_put_contents(static::ARTICLE_ANALYZED_FILENAME, $title . PHP_EOL, FILE_APPEND); |
|
37 | + @file_put_contents(static::ARTICLE_ANALYZED_FILENAME, $title.PHP_EOL, FILE_APPEND); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | protected function printTitle(string $title): void |
53 | 53 | { |
54 | 54 | echo "---------------------\n"; |
55 | - echo date('d-m-Y H:i:s') . ' ' . Color::BG_CYAN . " $title " . Color::NORMAL . "\n"; |
|
55 | + echo date('d-m-Y H:i:s').' '.Color::BG_CYAN." $title ".Color::NORMAL."\n"; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function canProcessTitleArticle(string $title, ?string $text): bool |