@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->url = $url; |
50 | 50 | $this->registrableDomain = null; |
51 | 51 | if (!ExternHttpClient::isHttpURL($url)) { |
52 | - $this->log->debug('Skip : not a valid URL : ' . $url); |
|
52 | + $this->log->debug('Skip : not a valid URL : '.$url); |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return false; |
58 | 58 | } |
59 | 59 | if (!ExternHttpClient::isHttpURL($url)) { |
60 | - throw new Exception('string is not an URL ' . $url); |
|
60 | + throw new Exception('string is not an URL '.$url); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->findRegistrableDomain(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | try { |
80 | 80 | $this->registrableDomain = $this->internetDomainParser->getRegistrableDomainFromURL($this->url); |
81 | 81 | } catch (Exception) { |
82 | - $this->log->warning('Skip : not a valid URL : ' . $this->url); |
|
82 | + $this->log->warning('Skip : not a valid URL : '.$this->url); |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | return $this->registrableDomain; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function hasForbiddenFilenameExtension(): bool |
94 | 94 | { |
95 | - return (bool)preg_match( |
|
95 | + return (bool) preg_match( |
|
96 | 96 | '#\.(pdf|jpg|jpeg|gif|png|xls|xlsx|xlr|xml|xlt|txt|csv|js|docx|exe|gz|zip|ini|movie|mp3|mp4|ogg|raw|rss|tar|tgz|wma)$#i', |
97 | 97 | $this->url |
98 | 98 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // PUNCTUATION conversion |
50 | 50 | $punctuationColl = array_filter( |
51 | 51 | TextUtil::ALL_PUNCTUATION, |
52 | - function ($value) { |
|
52 | + function($value) { |
|
53 | 53 | // skip punctuation chars from mixed names (example : "Pierre-Marie L'Anglois") |
54 | 54 | return !in_array($value, ["'", '-', '-']); |
55 | 55 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | if (preg_match('#^(PATTERNINITIAL|PATTERNURL|PATTERNAND|PATTERNCOMMA|PATTERNBIBABREV|PATTERNPUNCTUATION)$#', (string) $tok, $matches) > 0) { |
70 | 70 | |
71 | - $shortpattern = str_replace('PATTERN','', (string) $tok); |
|
71 | + $shortpattern = str_replace('PATTERN', '', (string) $tok); |
|
72 | 72 | $res['pattern'] .= ' '.$shortpattern; // PATTERNAND -> AND |
73 | 73 | if (in_array($matches[1], ['PATTERNCOMMA', 'PATTERNPUNCTUATION']) || empty($matches[1])) { |
74 | 74 | $res['value'][] = '*'; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | return preg_replace_callback_array( |
124 | 124 | [ |
125 | 125 | // URL |
126 | - '#\bhttps?://[^ \]]+#i' => function ($match): string { |
|
126 | + '#\bhttps?://[^ \]]+#i' => function($match): string { |
|
127 | 127 | // '#https?\:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+\#]*[\w\-\@?^=%&/~\+#])?#' |
128 | 128 | $this->tokenValue['URL'][] = $match[0]; |
129 | 129 | |
@@ -131,26 +131,26 @@ discard block |
||
131 | 131 | }, |
132 | 132 | // BIBABREV : "dir.", "trad.", "(dir.)", "[dir.]", etc. |
133 | 133 | // TODO: regex flaw : "(" not evaluated in BIBABREV. Example : "(dir.)" |
134 | - '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function ($match): string { |
|
134 | + '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function($match): string { |
|
135 | 135 | $this->tokenValue['BIBABREV'][] = $match[0]; // [1] = dir |
136 | 136 | |
137 | 137 | return ' PATTERNBIBABREV '; |
138 | 138 | }, |
139 | 139 | // AND |
140 | - '# (et|and|&|with|avec|e) #i' => function ($match): string { |
|
140 | + '# (et|and|&|with|avec|e) #i' => function($match): string { |
|
141 | 141 | $this->tokenValue['AND'][] = $match[0]; |
142 | 142 | |
143 | 143 | return ' PATTERNAND '; |
144 | 144 | }, |
145 | 145 | // COMMA |
146 | - '#,#' => function (): string { |
|
146 | + '#,#' => function(): string { |
|
147 | 147 | return ' PATTERNCOMMA '; |
148 | 148 | }, |
149 | 149 | // INITIAL : 2) convert letter ("A.") or junior ("Jr.") or senior ("Sr.") |
150 | 150 | // extract initial before "." converted in PUNCTUATION |
151 | 151 | // Note : \b word boundary match between "L" and "'Amour" in "L'Amour" (for [A-Z]\b) |
152 | 152 | // \b([A-Z]\. |[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)+ for grouping "A. B." in same INITIAL ? |
153 | - "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function ($match): string { |
|
153 | + "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function($match): string { |
|
154 | 154 | $this->tokenValue['INITIAL'][] = $match[0]; |
155 | 155 | |
156 | 156 | return ' PATTERNINITIAL '; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | /** |
41 | 41 | * @param mixed[] $options |
42 | 42 | */ |
43 | - public function __construct(private readonly LoggerInterface $log, private readonly ?array $options = []) |
|
43 | + public function __construct(private readonly LoggerInterface $log, private readonly ? array $options = []) |
|
44 | 44 | { |
45 | 45 | } |
46 | 46 |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | if (isset($meta['citation_firstpage'])) { |
29 | 29 | $page = $meta['citation_firstpage']; |
30 | 30 | if (isset($meta['citation_lastpage'])) { |
31 | - $page .= '–' . $meta['citation_lastpage']; |
|
31 | + $page .= '–'.$meta['citation_lastpage']; |
|
32 | 32 | } |
33 | 33 | |
34 | - return (string)$page; |
|
34 | + return (string) $page; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return null; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } catch (Exception) { |
161 | 161 | // 23/11/2015 00:00:00 |
162 | 162 | if (isset($this->log) && method_exists($this->log, 'notice')) { |
163 | - $this->log->notice('tryFormatDateOrComment failed with ' . $str); |
|
163 | + $this->log->notice('tryFormatDateOrComment failed with '.$str); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return sprintf('<!-- %s -->', $str); |
@@ -266,7 +266,7 @@ |
||
266 | 266 | * @return string|string[] |
267 | 267 | * @throws Throwable |
268 | 268 | */ |
269 | - private function processExternLinks(string $text, array $links): string|array |
|
269 | + private function processExternLinks(string $text, array $links): string | array |
|
270 | 270 | { |
271 | 271 | foreach ($links as $pattern) { |
272 | 272 | if ($this->quota->isQuotaReached()) { |
@@ -128,10 +128,10 @@ |
||
128 | 128 | JSON_THROW_ON_ERROR |
129 | 129 | ); |
130 | 130 | } catch (Throwable $e) { |
131 | - $this->log->error('Catch EDITOR_TITLES_FILENAME import ' . $e->getMessage()); |
|
131 | + $this->log->error('Catch EDITOR_TITLES_FILENAME import '.$e->getMessage()); |
|
132 | 132 | } |
133 | 133 | if (isset($data[$publisherName])) { |
134 | - return (string)urldecode((string) $data[$publisherName]); |
|
134 | + return (string) urldecode((string) $data[$publisherName]); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return null; |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | protected const USER_RC_LIMIT = 100; |
28 | 28 | protected const TASK_NAME = ' |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public const SLEEP_AFTER_EDITION = 15; // sec |
29 | 29 | public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 10; // minutes |
30 | 30 | public const CHECK_EDIT_CONFLICT = true; |
31 | - public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/../resources/article_externRef_edited.txt'; |
|
31 | + public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/../resources/article_externRef_edited.txt'; |
|
32 | 32 | public const SKIP_ADQ = false; |
33 | 33 | public const SKIP_LASTEDIT_BY_BOT = false; |
34 | 34 | public const CITATION_NUMBER_ON_FIRE = 15; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $result = $this->transformer->process($refContent, $this->summary); |
62 | 62 | } catch (Throwable $e) { |
63 | 63 | echo "** Problème détecté 234242\n"; |
64 | - $this->log->critical($e->getMessage() . " " . $e->getFile() . ":" . $e->getLine()); |
|
64 | + $this->log->critical($e->getMessage()." ".$e->getFile().":".$e->getLine()); |
|
65 | 65 | // TODO : parse $e->message -> variable process, taskName, botflag... |
66 | 66 | |
67 | 67 | return $refContent; |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | $prefixSummary = ($this->summary->isBotFlag()) ? 'bot ' : ''; |
122 | 122 | $suffix = ''; |
123 | 123 | if (isset($this->summary->memo['count article'])) { |
124 | - $suffix .= ' ' . $this->summary->memo['count article'] . 'x {article}'; |
|
124 | + $suffix .= ' '.$this->summary->memo['count article'].'x {article}'; |
|
125 | 125 | } |
126 | 126 | if (isset($this->summary->memo['count lien web'])) { |
127 | - $suffix .= ' ' . $this->summary->memo['count lien web'] . 'x {lien web}'; |
|
127 | + $suffix .= ' '.$this->summary->memo['count lien web'].'x {lien web}'; |
|
128 | 128 | } |
129 | 129 | if (isset($this->summary->memo['presse'])) { |
130 | 130 | $suffix .= ' |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | return OuvrageFactory::GoogleFromIsbn($this->isbn); |
40 | 40 | } catch (Throwable $e) { |
41 | - $this->logger->warning("*** ERREUR GOOGLE Isbn Search ***" . $e->getMessage()); |
|
41 | + $this->logger->warning("*** ERREUR GOOGLE Isbn Search ***".$e->getMessage()); |
|
42 | 42 | if (!str_contains($e->getMessage(), 'Could not resolve host: www.googleapis.com')) { |
43 | 43 | throw $e; |
44 | 44 | } |