@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $channel->basic_qos(null, 1, null); |
| 37 | 37 | // callback to $this->msgProcess(). |
| 38 | 38 | // TODO check Rector refac |
| 39 | - $channel->basic_consume(static::QUEUE_NAME, '', false, false, false, false, function (\PhpAmqpLib\Message\AMQPMessage $msg) : void { |
|
| 39 | + $channel->basic_consume(static::QUEUE_NAME, '', false, false, false, false, function(\PhpAmqpLib\Message\AMQPMessage $msg) : void { |
|
| 40 | 40 | $this->msgProcess($msg); |
| 41 | 41 | }); |
| 42 | 42 | |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function minutesSinceLastEdit(string $title): int |
| 208 | 208 | { |
| 209 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 209 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 210 | 210 | |
| 211 | - return (int)round((time() - strtotime($time)) / 60); |
|
| 211 | + return (int) round((time() - strtotime($time)) / 60); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -224,8 +224,7 @@ discard block |
||
| 224 | 224 | { |
| 225 | 225 | $text = WikiTextUtil::removeHTMLcomments($text); |
| 226 | 226 | $botName = $botName ?: getenv('BOT_NAME'); |
| 227 | - $denyReg = (empty($botName)) ? '' : |
|
| 228 | - '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}'; |
|
| 227 | + $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}'; |
|
| 229 | 228 | return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0; |
| 230 | 229 | } |
| 231 | 230 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $data = $this->getFileData(); |
| 56 | 56 | $this->lastDate = new DateTime($data['date'], new DateTimeZone(static::REBOOT_TIMEZONE)); |
| 57 | - $this->count = (int)$data['count']; |
|
| 57 | + $this->count = (int) $data['count']; |
|
| 58 | 58 | |
| 59 | 59 | // Today reboot date/time of the quota |
| 60 | 60 | $todayBoot = new DateTime(); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | try { |
| 78 | 78 | $json = file_get_contents(static::JSON_FILENAME); |
| 79 | - $array = (array)json_decode($json, true, 512, JSON_THROW_ON_ERROR); |
|
| 79 | + $array = (array) json_decode($json, true, 512, JSON_THROW_ON_ERROR); |
|
| 80 | 80 | } catch (Throwable $e) { |
| 81 | 81 | throw new ConfigException('Error on Google Quota file : reading or JSON malformed.'); |
| 82 | 82 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $this->xml = $xml; |
| 41 | 41 | |
| 42 | 42 | // skip multi-records |
| 43 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
| 43 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
| 44 | 44 | if (1 !== $nbResults) { |
| 45 | 45 | echo "BNF : $nbResults records (skip)\n"; |
| 46 | 46 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $res = []; |
| 127 | 127 | foreach ($elements as $element) { |
| 128 | 128 | if (isset($element) && $element instanceof SimpleXMLElement) { |
| 129 | - $res[] = (string)$element; |
|
| 129 | + $res[] = (string) $element; |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | $raw = $this->xpath2string('//mxc:datafield[@tag="215"]/mxc:subfield[@code="a"]'); |
| 196 | 196 | if (!empty($raw) && preg_match('#(\d{2,}) p\.#', $raw, $matches) > 0) { |
| 197 | - return (string)$matches[1]; |
|
| 197 | + return (string) $matches[1]; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | return null; |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | { |
| 60 | 60 | // Style "auto1234" |
| 61 | 61 | if (empty($this->getParam('périodique') || empty($this->getParam('date')))) { |
| 62 | - return 'auto'.(string)random_int(1000, 9999); |
|
| 62 | + return 'auto'.(string) random_int(1000, 9999); |
|
| 63 | 63 | } |
| 64 | 64 | // Style "LeMonde15022017" |
| 65 | 65 | $periodique = str_replace( |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $id .= ($this->getParam('nom'.$i)) ?? $this->getParam('auteur'.$i) ?? ''; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return $id . ($this->getParam('année') ?? ''); |
|
| 54 | + return $id.($this->getParam('année') ?? ''); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $string .= "\n"; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - return $string . '}}'; |
|
| 97 | + return $string.'}}'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | // Gestion alias |
| 270 | 270 | if (!$this->isValidParamName($name)) { |
| 271 | 271 | // hack : 1 => "ouvrage collectif" |
| 272 | - $name = (string)$name; |
|
| 272 | + $name = (string) $name; |
|
| 273 | 273 | $this->log[] = "parameter $name not found"; |
| 274 | 274 | |
| 275 | 275 | // todo keep there |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // PUNCTUATION conversion |
| 54 | 54 | $punctuationColl = array_filter( |
| 55 | 55 | TextUtil::ALL_PUNCTUATION, |
| 56 | - function ($value) { |
|
| 56 | + function($value) { |
|
| 57 | 57 | // skip punctuation chars from mixed names (example : "Pierre-Marie L'Anglois") |
| 58 | 58 | return !in_array($value, ["'", '-', '-']); |
| 59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | if (preg_match('#^(PATTERNINITIAL|PATTERNURL|PATTERNAND|PATTERNCOMMA|PATTERNBIBABREV|PATTERNPUNCTUATION)$#', $tok, $matches) > 0) { |
| 74 | 74 | |
| 75 | - $shortpattern = str_replace('PATTERN','', $tok); |
|
| 75 | + $shortpattern = str_replace('PATTERN', '', $tok); |
|
| 76 | 76 | $res['pattern'] .= ' '.$shortpattern; // PATTERNAND -> AND |
| 77 | 77 | if (in_array($matches[1], ['PATTERNCOMMA', 'PATTERNPUNCTUATION']) || empty($matches[1])) { |
| 78 | 78 | $res['value'][] = '*'; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | return preg_replace_callback_array( |
| 130 | 130 | [ |
| 131 | 131 | // URL |
| 132 | - '#\bhttps?://[^ \]]+#i' => function ($match): string { |
|
| 132 | + '#\bhttps?://[^ \]]+#i' => function($match): string { |
|
| 133 | 133 | // '#https?\:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+\#]*[\w\-\@?^=%&/~\+#])?#' |
| 134 | 134 | $this->tokenValue['URL'][] = $match[0]; |
| 135 | 135 | |
@@ -137,26 +137,26 @@ discard block |
||
| 137 | 137 | }, |
| 138 | 138 | // BIBABREV : "dir.", "trad.", "(dir.)", "[dir.]", etc. |
| 139 | 139 | // TODO: regex flaw : "(" not evaluated in BIBABREV. Example : "(dir.)" |
| 140 | - '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function ($match): string { |
|
| 140 | + '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function($match): string { |
|
| 141 | 141 | $this->tokenValue['BIBABREV'][] = $match[0]; // [1] = dir |
| 142 | 142 | |
| 143 | 143 | return ' PATTERNBIBABREV '; |
| 144 | 144 | }, |
| 145 | 145 | // AND |
| 146 | - '# (et|and|&|with|avec|e) #i' => function ($match): string { |
|
| 146 | + '# (et|and|&|with|avec|e) #i' => function($match): string { |
|
| 147 | 147 | $this->tokenValue['AND'][] = $match[0]; |
| 148 | 148 | |
| 149 | 149 | return ' PATTERNAND '; |
| 150 | 150 | }, |
| 151 | 151 | // COMMA |
| 152 | - '#,#' => function (): string { |
|
| 152 | + '#,#' => function(): string { |
|
| 153 | 153 | return ' PATTERNCOMMA '; |
| 154 | 154 | }, |
| 155 | 155 | // INITIAL : 2) convert letter ("A.") or junior ("Jr.") or senior ("Sr.") |
| 156 | 156 | // extract initial before "." converted in PUNCTUATION |
| 157 | 157 | // Note : \b word boundary match between "L" and "'Amour" in "L'Amour" (for [A-Z]\b) |
| 158 | 158 | // \b([A-Z]\. |[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)+ for grouping "A. B." in same INITIAL ? |
| 159 | - "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function ($match): string { |
|
| 159 | + "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function($match): string { |
|
| 160 | 160 | $this->tokenValue['INITIAL'][] = $match[0]; |
| 161 | 161 | |
| 162 | 162 | return ' PATTERNINITIAL '; |
@@ -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; |