@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | if (count((array) $res) >= 2 && empty($auteur2)) { |
| 183 | 183 | // delete author-params |
| 184 | 184 | array_map( |
| 185 | - function ($param) { |
|
| 185 | + function($param) { |
|
| 186 | 186 | $this->unsetParam($param); |
| 187 | 187 | }, |
| 188 | 188 | ['auteur', 'auteurs', 'prénom1', 'nom1'] |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | // todo bug {{citation bloc}} si "=" ou "|" dans texte de citation |
| 531 | 531 | // Legacy : use {{début citation}} ... {{fin citation}} |
| 532 | 532 | if (preg_match('#[=|]#', $extrait) > 0) { |
| 533 | - $this->optiTemplate->externalTemplates[] = (object)[ |
|
| 533 | + $this->optiTemplate->externalTemplates[] = (object) [ |
|
| 534 | 534 | 'template' => 'début citation', |
| 535 | 535 | '1' => '', |
| 536 | 536 | 'raw' => '{{Début citation}}'.$extrait.'{{Fin citation}}', |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | $this->notCosmetic = true; |
| 540 | 540 | } else { |
| 541 | 541 | // StdClass |
| 542 | - $this->optiTemplate->externalTemplates[] = (object)[ |
|
| 542 | + $this->optiTemplate->externalTemplates[] = (object) [ |
|
| 543 | 543 | 'template' => 'citation bloc', |
| 544 | 544 | '1' => $extrait, |
| 545 | 545 | 'raw' => '{{Citation bloc|'.$extrait.'}}', |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | // "commentaire=bla" => {{Commentaire biblio|1=bla}} |
| 556 | 556 | if ($this->hasParamValue('commentaire')) { |
| 557 | 557 | $commentaire = $this->getParam('commentaire'); |
| 558 | - $this->optiTemplate->externalTemplates[] = (object)[ |
|
| 558 | + $this->optiTemplate->externalTemplates[] = (object) [ |
|
| 559 | 559 | 'template' => 'commentaire biblio', |
| 560 | 560 | '1' => $commentaire, |
| 561 | 561 | 'raw' => '{{Commentaire biblio|'.$commentaire.'}}', |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | $this->log->error('Catch EDITOR_TITLES_FILENAME import '.$e->getMessage()); |
| 699 | 699 | } |
| 700 | 700 | if (isset($data[$publisherName])) { |
| 701 | - return (string)urldecode($data[$publisherName]); |
|
| 701 | + return (string) urldecode($data[$publisherName]); |
|
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | return null; |
@@ -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 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function deleteEmptyValueArray(array $array): array |
| 28 | 28 | { |
| 29 | - return array_filter($array, function ($value) { |
|
| 29 | + return array_filter($array, function($value) { |
|
| 30 | 30 | return (null !== $value && '' !== $value); |
| 31 | 31 | }); |
| 32 | 32 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | class InternetDomainParser |
| 22 | 22 | { |
| 23 | 23 | // todo inject/config ? |
| 24 | - private const PATH_CACHE_PUBLIC_SUFFIX_LIST = __DIR__ . '/resources/public_suffix_list.dat'; |
|
| 24 | + private const PATH_CACHE_PUBLIC_SUFFIX_LIST = __DIR__.'/resources/public_suffix_list.dat'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * https://www.google.fr => google.fr |
@@ -61,20 +61,20 @@ discard block |
||
| 61 | 61 | // idn_to_ascii('teßt.com',IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46) |
| 62 | 62 | // checkdnsrr($string, "A") // check DNS record |
| 63 | 63 | if (!self::isHttpURL($url)) { |
| 64 | - throw new DomainException('URL not compatible : ' . $url); |
|
| 64 | + throw new DomainException('URL not compatible : '.$url); |
|
| 65 | 65 | } |
| 66 | 66 | $response = $this->client->get($url); |
| 67 | 67 | |
| 68 | 68 | if (200 !== $response->getStatusCode()) { |
| 69 | - echo 'HTTP error ' . $response->getStatusCode(); |
|
| 69 | + echo 'HTTP error '.$response->getStatusCode(); |
|
| 70 | 70 | if ($this->log !== null) { |
| 71 | - $this->log->error('HTTP error ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase()); |
|
| 71 | + $this->log->error('HTTP error '.$response->getStatusCode().' '.$response->getReasonPhrase()); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $html = (string)$response->getBody()->getContents() ?? ''; |
|
| 77 | + $html = (string) $response->getBody()->getContents() ?? ''; |
|
| 78 | 78 | |
| 79 | 79 | return ($normalized) ? $this->normalizeHtml($html, $url) : $html; |
| 80 | 80 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function isHttpURL(string $url): bool |
| 87 | 87 | { |
| 88 | - return (bool)preg_match('#^https?://[^ ]+$#i', $url); |
|
| 88 | + return (bool) preg_match('#^https?://[^ ]+$#i', $url); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $charset = $this->extractCharset($html) ?? 'WINDOWS-1252'; |
| 113 | 113 | |
| 114 | 114 | if (empty($charset)) { |
| 115 | - throw new DomainException('normalized html error and no charset found : ' . $url); |
|
| 115 | + throw new DomainException('normalized html error and no charset found : '.$url); |
|
| 116 | 116 | } |
| 117 | 117 | try { |
| 118 | 118 | $html2 = iconv($charset, 'UTF-8//TRANSLIT', $html); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return ''; |
| 122 | 122 | } |
| 123 | 123 | } catch (Throwable $e) { |
| 124 | - throw new DomainException("error converting : $charset to UTF-8" . $url, $e->getCode(), $e); |
|
| 124 | + throw new DomainException("error converting : $charset to UTF-8".$url, $e->getCode(), $e); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return $html2; |
@@ -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 |
@@ -124,8 +124,7 @@ |
||
| 124 | 124 | } |
| 125 | 125 | if (isset($this->summary->memo['count lien brisé'])) { |
| 126 | 126 | $suffix .= ', ⚠️️️lien brisé'; //⚠️ |
@@ -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); |