@@ -53,7 +53,7 @@ |
||
53 | 53 | ['{{Ouvrage |
54 | 54 | | langue=fr |
55 | 55 | }}', |
56 | - "\n | ", |
|
56 | + "\n | ", |
|
57 | 57 | ], |
58 | 58 | ]; |
59 | 59 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'titre' => $volume->title, |
41 | 41 | 'sous-titre' => $this->filterSubtitle($volume), |
42 | 42 | 'année' => $this->convertDate2Year($volume->publishedDate), |
43 | - 'pages totales' => (string)$volume->pageCount ?? null, |
|
43 | + 'pages totales' => (string) $volume->pageCount ?? null, |
|
44 | 44 | 'isbn' => $this->convertIsbn($volume), |
45 | 45 | 'présentation en ligne' => $this->presentationEnLigne($volume), |
46 | 46 | 'lire en ligne' => $this->lireEnLigne($volume), |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return null; |
74 | 74 | } |
75 | 75 | if (preg_match('/[^0-9]?([12][0-9]{3})[^0-9]?/', $data, $matches) > 0) { |
76 | - return (string)$matches[1]; |
|
76 | + return (string) $matches[1]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return null; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | // so isbn-13 replace isbn-10 |
93 | 93 | // todo refac algo (if 2x isbn13?) |
94 | 94 | $isbn = null; |
95 | - $ids = (array)$volume->industryIdentifiers; |
|
95 | + $ids = (array) $volume->industryIdentifiers; |
|
96 | 96 | foreach ($ids as $id) { |
97 | 97 | if (!isset($isbn) && in_array($id->type, ['ISBN_10', 'ISBN_13'])) { |
98 | 98 | $isbn = $id->identifier; |
@@ -76,7 +76,7 @@ |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | // note : multi-records filtered in BnFMapper |
79 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
79 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
80 | 80 | if (0 === $nbResults) { |
81 | 81 | return null; |
82 | 82 | } |
@@ -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 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | } |
26 | 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 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public function getRedirect(): ?string |
124 | 124 | { |
125 | 125 | if ($this->getText() && preg_match('/^#REDIRECT(?:ION)? ?\[\[([^]]+)]]/i', $this->getText(), $matches)) { |
126 | - return (string)trim($matches[1]); |
|
126 | + return (string) trim($matches[1]); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return null; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $parser = new TagParser(); // todo ParserFactory |
302 | 302 | $refs = $parser->importHtml($text)->getRefValues(); // [] |
303 | 303 | |
304 | - return (array)$refs; |
|
304 | + return (array) $refs; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -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'])); |
@@ -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 '; |
@@ -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 | } |