@@ -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; |
@@ -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 | } |
@@ -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 |