@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // PUNCTUATION conversion |
| 53 | 53 | $punctuationColl = array_filter( |
| 54 | 54 | TextUtil::ALL_PUNCTUATION, |
| 55 | - function ($value) { |
|
| 55 | + function($value) { |
|
| 56 | 56 | // skip punctuation chars from mixed names (example : "Pierre-Marie L'Anglois") |
| 57 | 57 | return !in_array($value, ["'", '-', '-']); |
| 58 | 58 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $modText = preg_replace_callback_array( |
| 125 | 125 | [ |
| 126 | 126 | // URL |
| 127 | - '#\bhttps?://[^ \]]+#i' => function ($match) { |
|
| 127 | + '#\bhttps?://[^ \]]+#i' => function($match) { |
|
| 128 | 128 | // '#https?\:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+\#]*[\w\-\@?^=%&/~\+#])?#' |
| 129 | 129 | $this->tokenValue['URL'][] = $match[0]; |
| 130 | 130 | |
@@ -132,26 +132,26 @@ discard block |
||
| 132 | 132 | }, |
| 133 | 133 | // BIBABREV : "dir.", "trad.", "(dir.)", "[dir.]", etc. |
| 134 | 134 | // TODO: regex flaw : "(" not evaluated in BIBABREV. Example : "(dir.)" |
| 135 | - '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function ($match) { |
|
| 135 | + '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function($match) { |
|
| 136 | 136 | $this->tokenValue['BIBABREV'][] = $match[0]; // [1] = dir |
| 137 | 137 | |
| 138 | 138 | return ' BIBABREV '; |
| 139 | 139 | }, |
| 140 | 140 | // AND |
| 141 | - '# (et|and|&|with|avec|e) #' => function ($match) { |
|
| 141 | + '# (et|and|&|with|avec|e) #' => function($match) { |
|
| 142 | 142 | $this->tokenValue['AND'][] = $match[1]; |
| 143 | 143 | |
| 144 | 144 | return ' AND '; |
| 145 | 145 | }, |
| 146 | 146 | // COMMA |
| 147 | - '#,#' => function () { |
|
| 147 | + '#,#' => function() { |
|
| 148 | 148 | return ' COMMA '; |
| 149 | 149 | }, |
| 150 | 150 | // INITIAL : 2) convert letter ("A.") or junior ("Jr.") or senior ("Sr.") |
| 151 | 151 | // extract initial before "." converted in PUNCTUATION |
| 152 | 152 | // Note : \b word boundary match between "L" and "'Amour" in "L'Amour" (for [A-Z]\b) |
| 153 | 153 | // \b([A-Z]\. |[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)+ for grouping "A. B." in same INITIAL ? |
| 154 | - "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function ($match) { |
|
| 154 | + "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function($match) { |
|
| 155 | 155 | $this->tokenValue['INITIAL'][] = $match[0]; |
| 156 | 156 | |
| 157 | 157 | return ' INITIAL '; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function deleteEmptyValueArray(array $myArray): array |
| 22 | 22 | { |
| 23 | - return array_filter($myArray, function ($value) { |
|
| 23 | + return array_filter($myArray, function($value) { |
|
| 24 | 24 | return !is_null($value) && '' !== $value; |
| 25 | 25 | }); |
| 26 | 26 | } |
@@ -185,7 +185,7 @@ |
||
| 185 | 185 | ) { |
| 186 | 186 | array_walk( |
| 187 | 187 | $matches, |
| 188 | - function (&$value) { |
|
| 188 | + function(&$value) { |
|
| 189 | 189 | $value = str_replace(['CURLYBRACKETO', 'CURLYBRACKETC'], ['{', '}'], $value); |
| 190 | 190 | } |
| 191 | 191 | ); |
@@ -173,9 +173,9 @@ |
||
| 173 | 173 | */ |
| 174 | 174 | public function minutesSinceLastEdit(string $title): int |
| 175 | 175 | { |
| 176 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 176 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
| 177 | 177 | |
| 178 | - return (int)round((time() - strtotime($time)) / 60); |
|
| 178 | + return (int) round((time() - strtotime($time)) / 60); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if (count($res) >= 2 && empty($auteur2)) { |
| 163 | 163 | // delete author-params |
| 164 | 164 | array_map( |
| 165 | - function ($param) { |
|
| 165 | + function($param) { |
|
| 166 | 166 | $this->unsetParam($param); |
| 167 | 167 | }, |
| 168 | 168 | ['auteur', 'auteurs', 'prénom1', 'nom1'] |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | // todo detect duplication ouvrage/plume dans externalTemplate ? |
| 600 | 600 | if (!empty($this->getParam('plume'))) { |
| 601 | 601 | $plumeValue = $this->getParam('plume'); |
| 602 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
| 602 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
| 603 | 603 | 'template' => 'plume', |
| 604 | 604 | '1' => $plumeValue, |
| 605 | 605 | 'raw' => '{{nobr|. {{plume}}}}', |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | // todo bug {{citation bloc}} si "=" ou "|" dans texte de citation |
| 615 | 615 | // Legacy : use {{début citation}} ... {{fin citation}} |
| 616 | 616 | if (preg_match('#[=|]#', $extrait) > 0) { |
| 617 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
| 617 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
| 618 | 618 | 'template' => 'début citation', |
| 619 | 619 | '1' => '', |
| 620 | 620 | 'raw' => '{{début citation}}'.$extrait.'{{fin citation}}', |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | $this->notCosmetic = true; |
| 624 | 624 | } else { |
| 625 | 625 | // StdClass |
| 626 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
| 626 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
| 627 | 627 | 'template' => 'citation bloc', |
| 628 | 628 | '1' => $extrait, |
| 629 | 629 | 'raw' => '{{extrait|'.$extrait.'}}', |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | // "commentaire=bla" => {{Commentaire biblio|1=bla}} |
| 640 | 640 | if (!empty($this->getParam('commentaire'))) { |
| 641 | 641 | $commentaire = $this->getParam('commentaire'); |
| 642 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
| 642 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
| 643 | 643 | 'template' => 'commentaire biblio', |
| 644 | 644 | '1' => $commentaire, |
| 645 | 645 | 'raw' => '{{commentaire biblio|'.$commentaire.'}}', |
@@ -132,8 +132,7 @@ |
||
| 132 | 132 | |
| 133 | 133 | private function onlineIsbnSearch(string $isbn, ?string $isbn10 = null) |
| 134 | 134 | { |
| 135 | - online: |
|
| 136 | - echo "sleep 20...\n"; |
|
| 135 | + online : echo "sleep 20...\n"; |
|
| 137 | 136 | sleep(40); |
| 138 | 137 | |
| 139 | 138 | try { |
@@ -23,9 +23,9 @@ |
||
| 23 | 23 | if (200 !== $response->getStatusCode()) { |
| 24 | 24 | die('not 200 response'); |
| 25 | 25 | } |
| 26 | -try{ |
|
| 26 | +try { |
|
| 27 | 27 | $newText = $response->getBody()->getContents(); |
| 28 | -}catch (Throwable $e){ |
|
| 28 | +} catch (Throwable $e) { |
|
| 29 | 29 | dump($e); |
| 30 | 30 | die; |
| 31 | 31 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->xml = $xml; |
| 42 | 42 | |
| 43 | 43 | // skip multi-records |
| 44 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
| 44 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
| 45 | 45 | if (1 !== $nbResults) { |
| 46 | 46 | echo "BNF : $nbResults records (skip)\n"; |
| 47 | 47 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $res = []; |
| 102 | 102 | foreach ($elements as $element) { |
| 103 | 103 | if (isset($element) && $element instanceof SimpleXMLElement) { |
| 104 | - $res[] = (string)$element; |
|
| 104 | + $res[] = (string) $element; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $raw = $this->xpath2string('//mxc:datafield[@tag="215"]/mxc:subfield[@code="a"]'); |
| 124 | 124 | if (!empty($raw) && preg_match('#([0-9]{2,}) p\.#', $raw, $matches) > 0) { |
| 125 | - return (string)$matches[1]; |
|
| 125 | + return (string) $matches[1]; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | return null; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $raw = $this->xpath2string('//srw:recordIdentifier[1]/text()'); |
| 206 | 206 | |
| 207 | 207 | if ($raw && preg_match('#ark:/[0-9]+/cb([0-9]+)#', $raw, $matches) > 0) { |
| 208 | - return (string)$matches[1]; |
|
| 208 | + return (string) $matches[1]; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | return null; |
@@ -23,6 +23,6 @@ |
||
| 23 | 23 | $this::assertTrue(Bot::isEditionRestricted('{{3R}} bla')); |
| 24 | 24 | $this::assertTrue(Bot::isEditionRestricted('{{nobots}} bla')); |
| 25 | 25 | $this::assertTrue(Bot::isEditionRestricted('{{bots|deny=Bob,FuBot}} bla', 'FuBot')); |
| 26 | - $this::assertFalse(Bot::isEditionRestricted('{{bots|deny=Bob,FuBot}} bla'));; |
|
| 26 | + $this::assertFalse(Bot::isEditionRestricted('{{bots|deny=Bob,FuBot}} bla')); ; |
|
| 27 | 27 | } |
| 28 | 28 | } |