@@ -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 '; |
@@ -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 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | echo "$title \n"; |
35 | 35 | |
36 | 36 | $pageAction = new WikiPageAction($wiki, $title); |
37 | - if($pageAction->getNs() !== 0 ) { |
|
37 | + if ($pageAction->getNs() !== 0) { |
|
38 | 38 | throw new \Exception("La page n'est pas dans Main (ns!==0)"); |
39 | 39 | } |
40 | 40 | $text = $pageAction->getText(); |
@@ -88,7 +88,7 @@ |
||
88 | 88 | // const TRADE = '™'; // ™ |
89 | 89 | // const REG = '®'; // ® |
90 | 90 | // const COPY = '©'; // © |
91 | - const ALL_SPACES = "\xE2\x80\xAF|\xC2\xAD|\xC2\xA0|\\s"; // Used in regexps. Better than \s |
|
91 | + const ALL_SPACES = "\xE2\x80\xAF|\xC2\xAD|\xC2\xA0|\\s"; // Used in regexps. Better than \s |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * UTF8 first letter in upper case. |
@@ -111,7 +111,7 @@ |
||
111 | 111 | { |
112 | 112 | // Style "auto1234" |
113 | 113 | if (empty($this->getParam('périodique') || empty($this->getParam('date')))) { |
114 | - return 'auto'.(string)rand(1000, 9999); |
|
114 | + return 'auto'.(string) rand(1000, 9999); |
|
115 | 115 | } |
116 | 116 | // Style "LeMonde15022017" |
117 | 117 | $periodique = str_replace( |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | public function process($data): array |
24 | 24 | { |
25 | - if(!isset($data['JSON-LD'])) { |
|
25 | + if (!isset($data['JSON-LD'])) { |
|
26 | 26 | return []; |
27 | 27 | } |
28 | 28 | $data = $data['JSON-LD']; |