@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if (count($res) >= 2 && empty($auteur2)) { |
187 | 187 | // delete author-params |
188 | 188 | array_map( |
189 | - function ($param) { |
|
189 | + function($param) { |
|
190 | 190 | $this->unsetParam($param); |
191 | 191 | }, |
192 | 192 | ['auteur', 'auteurs', 'prénom1', 'nom1'] |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | // todo bug {{citation bloc}} si "=" ou "|" dans texte de citation |
697 | 697 | // Legacy : use {{début citation}} ... {{fin citation}} |
698 | 698 | if (preg_match('#[=|]#', $extrait) > 0) { |
699 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
699 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
700 | 700 | 'template' => 'début citation', |
701 | 701 | '1' => '', |
702 | 702 | 'raw' => '{{Début citation}}'.$extrait.'{{Fin citation}}', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $this->notCosmetic = true; |
706 | 706 | } else { |
707 | 707 | // StdClass |
708 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
708 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
709 | 709 | 'template' => 'citation bloc', |
710 | 710 | '1' => $extrait, |
711 | 711 | 'raw' => '{{Citation bloc|'.$extrait.'}}', |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | // "commentaire=bla" => {{Commentaire biblio|1=bla}} |
722 | 722 | if (!empty($this->getParam('commentaire'))) { |
723 | 723 | $commentaire = $this->getParam('commentaire'); |
724 | - $this->ouvrage->externalTemplates[] = (object)[ |
|
724 | + $this->ouvrage->externalTemplates[] = (object) [ |
|
725 | 725 | 'template' => 'commentaire biblio', |
726 | 726 | '1' => $commentaire, |
727 | 727 | 'raw' => '{{Commentaire biblio|'.$commentaire.'}}', |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ) > 0 |
30 | 30 | ) { |
31 | 31 | // FIXED zizibot : des '<nowiki>' supplémentaires ajoutés à quelques rapports |
32 | - return str_replace('<nowiki>','', $matches[1]); |
|
32 | + return str_replace('<nowiki>', '', $matches[1]); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return null; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - public function deleteAllReports(string $text, ?string $botName='ZiziBot'): string |
|
58 | + public function deleteAllReports(string $text, ?string $botName = 'ZiziBot'): string |
|
59 | 59 | { |
60 | 60 | $pattern = sprintf( |
61 | 61 | '#== Ouvrage avec erreur de paramètre ==(.*)Le robot \[\[Utilisateur:%s\|%s\]\] \(\[\[Discussion utilisateur:%s\|discuter\]\]\) [0-9a-zéà: ]+ \(CET\)[\n]*#s', |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | return array_filter( |
24 | 24 | $myArray, |
25 | - function ($value) { |
|
25 | + function($value) { |
|
26 | 26 | return !is_null($value) && '' !== $value; |
27 | 27 | } |
28 | 28 | ); |
@@ -60,14 +60,14 @@ |
||
60 | 60 | */ |
61 | 61 | $data = $this->mapping($volume); |
62 | 62 | |
63 | - if(isset($data['infos'])) { |
|
63 | + if (isset($data['infos'])) { |
|
64 | 64 | $infos = $data['infos']; |
65 | 65 | unset($data['infos']); |
66 | 66 | } |
67 | 67 | |
68 | 68 | try { |
69 | 69 | $this->ouvrage->hydrate($data); |
70 | - if(isset($infos)) { |
|
70 | + if (isset($infos)) { |
|
71 | 71 | $this->ouvrage->setInfos($infos); |
72 | 72 | } |
73 | 73 | } catch (Throwable $e) { |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $res = $this->searchByISNI($infos['ISNIAuteur1']); |
41 | 41 | } |
42 | 42 | if (isset($infos['isbn'])) { |
43 | - if(!empty($res)) { |
|
43 | + if (!empty($res)) { |
|
44 | 44 | sleep(2); |
45 | 45 | } |
46 | 46 | $res = array_merge($res, $this->findArticleByISBN13($infos['isbn'])); |
@@ -40,10 +40,10 @@ |
||
40 | 40 | $db = new Mysql($pdo); |
41 | 41 | |
42 | 42 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate is not null'); |
43 | -$number = (int)$monitor['count(id)']; |
|
43 | +$number = (int) $monitor['count(id)']; |
|
44 | 44 | |
45 | 45 | $monitor = $db->fetchRow('select count(distinct page) as pages from temprawopti where optidate is not null and isbn<>""'); |
46 | -$pageNb = (int)$monitor['pages']; |
|
46 | +$pageNb = (int) $monitor['pages']; |
|
47 | 47 | |
48 | 48 | $newText = <<<EOF |
49 | 49 | <div style="background:#EBF6E9;border:2px solid grey;padding:10px;border-radius:10px;"> |
@@ -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 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | if (preg_match('#^(PATTERNINITIAL|PATTERNURL|PATTERNAND|PATTERNCOMMA|PATTERNBIBABREV|PATTERNPUNCTUATION)$#', $tok, $matches) > 0) { |
73 | 73 | |
74 | - $shortpattern = str_replace('PATTERN','', $tok); |
|
74 | + $shortpattern = str_replace('PATTERN', '', $tok); |
|
75 | 75 | $res['pattern'] .= ' '.$shortpattern; // PATTERNAND -> AND |
76 | 76 | if (in_array($matches[1], ['PATTERNCOMMA', 'PATTERNPUNCTUATION']) || empty($matches[1])) { |
77 | 77 | $res['value'][] = '*'; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $modText = preg_replace_callback_array( |
129 | 129 | [ |
130 | 130 | // URL |
131 | - '#\bhttps?://[^ \]]+#i' => function ($match) { |
|
131 | + '#\bhttps?://[^ \]]+#i' => function($match) { |
|
132 | 132 | // '#https?\:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+\#]*[\w\-\@?^=%&/~\+#])?#' |
133 | 133 | $this->tokenValue['URL'][] = $match[0]; |
134 | 134 | |
@@ -136,26 +136,26 @@ discard block |
||
136 | 136 | }, |
137 | 137 | // BIBABREV : "dir.", "trad.", "(dir.)", "[dir.]", etc. |
138 | 138 | // TODO: regex flaw : "(" not evaluated in BIBABREV. Example : "(dir.)" |
139 | - '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function ($match) { |
|
139 | + '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function($match) { |
|
140 | 140 | $this->tokenValue['BIBABREV'][] = $match[0]; // [1] = dir |
141 | 141 | |
142 | 142 | return ' PATTERNBIBABREV '; |
143 | 143 | }, |
144 | 144 | // AND |
145 | - '# (et|and|&|with|avec|e) #i' => function ($match) { |
|
145 | + '# (et|and|&|with|avec|e) #i' => function($match) { |
|
146 | 146 | $this->tokenValue['AND'][] = $match[0]; |
147 | 147 | |
148 | 148 | return ' PATTERNAND '; |
149 | 149 | }, |
150 | 150 | // COMMA |
151 | - '#,#' => function () { |
|
151 | + '#,#' => function() { |
|
152 | 152 | return ' PATTERNCOMMA '; |
153 | 153 | }, |
154 | 154 | // INITIAL : 2) convert letter ("A.") or junior ("Jr.") or senior ("Sr.") |
155 | 155 | // extract initial before "." converted in PUNCTUATION |
156 | 156 | // Note : \b word boundary match between "L" and "'Amour" in "L'Amour" (for [A-Z]\b) |
157 | 157 | // \b([A-Z]\. |[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)+ for grouping "A. B." in same INITIAL ? |
158 | - "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function ($match) { |
|
158 | + "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function($match) { |
|
159 | 159 | $this->tokenValue['INITIAL'][] = $match[0]; |
160 | 160 | |
161 | 161 | return ' PATTERNINITIAL '; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function __construct(QueueInterface $queueAdapter, ?bool $verbose = false) |
51 | 51 | { |
52 | 52 | $this->queueAdapter = $queueAdapter; |
53 | - $this->verbose = (bool)$verbose; |
|
53 | + $this->verbose = (bool) $verbose; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function run(?int $limit = 10000) |
@@ -138,8 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | private function onlineIsbnSearch(string $isbn, ?string $isbn10 = null) |
140 | 140 | { |
141 | - online: |
|
142 | - if ($this->verbose) { |
|
141 | + online : if ($this->verbose) { |
|
143 | 142 | echo "sleep 10...\n"; |
144 | 143 | } |
145 | 144 | sleep(10); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | [ |
95 | 95 | 'page' => $title ?? '', |
96 | 96 | 'verify' => date("Y-m-d H:i:s"), |
97 | - 'altered' => (int)$stat, |
|
97 | + 'altered' => (int) $stat, |
|
98 | 98 | ] |
99 | 99 | ); |
100 | 100 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | - return (int)round(($count - $found) / count($data) * 100); |
|
152 | + return (int) round(($count - $found) / count($data) * 100); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | } |