@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'titre' => $volume->title, |
52 | 52 | 'sous-titre' => $this->filterSubtitle($volume), |
53 | 53 | 'année' => $this->convertDate2Year($volume->publishedDate ?? null), |
54 | - 'pages totales' => (string)$volume->pageCount ?? null, |
|
54 | + 'pages totales' => (string) $volume->pageCount ?? null, |
|
55 | 55 | 'isbn' => $this->convertIsbn($volume), |
56 | 56 | 'présentation en ligne' => $this->presentationEnLigne($volume), |
57 | 57 | 'lire en ligne' => $this->lireEnLigne($volume), |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | // so isbn-13 replace isbn-10 |
113 | 113 | // todo refac algo (if 2x isbn13?) |
114 | 114 | $isbn = null; |
115 | - $ids = (array)$volume->industryIdentifiers; |
|
115 | + $ids = (array) $volume->industryIdentifiers; |
|
116 | 116 | foreach ($ids as $id) { |
117 | 117 | if (!$isbn && in_array($id->type, ['ISBN_10', 'ISBN_13'])) { |
118 | 118 | $isbn = $id->identifier; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | // todo verify http_build_query() enc_type parameter |
114 | 114 | // todo http_build_query() process an urlencode, but a not encoded q= value ("fu+bar") is beautiful |
115 | - return $googleURL . '?' . http_build_query($dat); |
|
115 | + return $googleURL.'?'.http_build_query($dat); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public static function isGoogleBookURL(string $text): bool |
122 | 122 | { |
123 | - return preg_match('#^' . self::GOOGLEBOOKS_START_URL_PATTERN . '[^>\]} \n]+$#i', $text) > 0; |
|
123 | + return preg_match('#^'.self::GOOGLEBOOKS_START_URL_PATTERN.'[^>\]} \n]+$#i', $text) > 0; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | */ |
153 | 153 | private static function isNewGoogleBookUrl(string $url): bool |
154 | 154 | { |
155 | - return (bool)preg_match( |
|
156 | - '#^' . self::GOOGLEBOOKS_NEW_START_URL_PATTERN . self::GOOGLEBOOKS_ID_REGEX . '(?:&.+)?#', |
|
155 | + return (bool) preg_match( |
|
156 | + '#^'.self::GOOGLEBOOKS_NEW_START_URL_PATTERN.self::GOOGLEBOOKS_ID_REGEX.'(?:&.+)?#', |
|
157 | 157 | $url |
158 | 158 | ); |
159 | 159 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | private static function getIDFromNewGBurl(string $url): ?string |
232 | 232 | { |
233 | 233 | if (preg_match( |
234 | - '#^' . self::GOOGLEBOOKS_NEW_START_URL_PATTERN . '(' . self::GOOGLEBOOKS_ID_REGEX . ')(?:&.+)?#', |
|
234 | + '#^'.self::GOOGLEBOOKS_NEW_START_URL_PATTERN.'('.self::GOOGLEBOOKS_ID_REGEX.')(?:&.+)?#', |
|
235 | 235 | $url, |
236 | 236 | $matches |
237 | 237 | ) |
@@ -244,6 +244,6 @@ discard block |
||
244 | 244 | |
245 | 245 | protected static function validateGoogleBooksId(string $id): bool |
246 | 246 | { |
247 | - return preg_match('#' . self::GOOGLEBOOKS_ID_REGEX . '#', $id) > 0; |
|
247 | + return preg_match('#'.self::GOOGLEBOOKS_ID_REGEX.'#', $id) > 0; |
|
248 | 248 | } |
249 | 249 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | protected function isValidParamName($name): bool |
156 | 156 | { |
157 | 157 | if (is_int($name)) { |
158 | - $name = (string)$name; |
|
158 | + $name = (string) $name; |
|
159 | 159 | } |
160 | 160 | // that parameter exists in template ? |
161 | 161 | // @phpstan-ignore-next-line |
@@ -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 |
@@ -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 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public const SLEEP_AFTER_EDITION = 60; |
33 | 33 | public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 15; |
34 | 34 | public const CHECK_EDIT_CONFLICT = true; |
35 | - public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/resources/article_edited.txt'; |
|
35 | + public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/resources/article_edited.txt'; |
|
36 | 36 | public const SKIP_LASTEDIT_BY_BOT = true; |
37 | 37 | public const SKIP_NOT_IN_MAIN_WIKISPACE = true; |
38 | 38 | public const SKIP_ADQ = true; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->initializePastAnalyzedTitles(); |
87 | 87 | |
88 | 88 | // @throw exception on "Invalid CSRF token" |
89 | - $this->run();//todo delete that and use (Worker)->run($duration) or process management |
|
89 | + $this->run(); //todo delete that and use (Worker)->run($duration) or process management |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | protected function setUpInConstructor(): void |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | final public function run(): void |
103 | 103 | { |
104 | - echo date('d-m-Y H:i:s') . " *** NEW WORKER ***\n"; |
|
104 | + echo date('d-m-Y H:i:s')." *** NEW WORKER ***\n"; |
|
105 | 105 | foreach ($this->getTitles() as $title) { |
106 | 106 | try { |
107 | 107 | $this->titleProcess($title); |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | |
203 | 203 | // If not a critical edition error |
204 | 204 | // example : Wiki Conflict : Page has been edited after getText() |
205 | - echo "Error : " . $e->getMessage() . "\n"; |
|
205 | + echo "Error : ".$e->getMessage()."\n"; |
|
206 | 206 | $this->log->warning($e->getMessage()); |
207 | 207 | |
208 | 208 | return; |
209 | 209 | } |
210 | 210 | |
211 | 211 | dump($result); |
212 | - echo "Sleep " . static::SLEEP_AFTER_EDITION . "\n"; |
|
212 | + echo "Sleep ".static::SLEEP_AFTER_EDITION."\n"; |
|
213 | 213 | sleep(static::SLEEP_AFTER_EDITION); |
214 | 214 | } |
215 | 215 |