@@ -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 '; |
@@ -87,7 +87,7 @@ |
||
87 | 87 | return null; |
88 | 88 | } |
89 | 89 | if (preg_match('/[^0-9]?([12][0-9]{3})[^0-9]?/', $details['publish_date'], $matches) > 0) { |
90 | - return (string)$matches[1]; |
|
90 | + return (string) $matches[1]; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return null; |
@@ -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 | ); |
@@ -22,9 +22,9 @@ |
||
22 | 22 | if (200 !== $response->getStatusCode()) { |
23 | 23 | die('not 200 response'); |
24 | 24 | } |
25 | -try{ |
|
25 | +try { |
|
26 | 26 | $newText = $response->getBody()->getContents(); |
27 | -}catch (\Throwable $e){ |
|
27 | +} catch (\Throwable $e) { |
|
28 | 28 | dump($e); |
29 | 29 | die; |
30 | 30 | } |
@@ -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 | /** |
@@ -74,7 +74,7 @@ |
||
74 | 74 | return null; |
75 | 75 | } |
76 | 76 | |
77 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
77 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
78 | 78 | |
79 | 79 | if (0 === $nbResults) { |
80 | 80 | return null; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $editInfo = new EditInfo(static::BOT_TALK_SUMMARY); |
54 | 54 | $success = $page->addToBottomOfThePage($addText, $editInfo); |
55 | 55 | |
56 | - return (bool)$success; |
|
56 | + return (bool) $success; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $to = ($toEditor) ? sprintf('@%s : ', $toEditor) : ''; // {{notif}} |
69 | 69 | $sentence = TextUtil::mb_ucfirst($this->getRandomSentence()); |
70 | - if(!$sentence){ |
|
70 | + if (!$sentence) { |
|
71 | 71 | throw new \Exception('no sentence'); |
72 | 72 | } |
73 | 73 | $addText = sprintf('%s%s%s --~~~~', $identation, $to, $sentence); |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | private function getRandomSentence(): ?string |
79 | 79 | { |
80 | 80 | $sentences = file(self::BOT_TALK_FILE); |
81 | - if(!$sentences){ |
|
81 | + if (!$sentences) { |
|
82 | 82 | return null; |
83 | 83 | } |
84 | - return (string)trim($sentences[array_rand($sentences)]); |
|
84 | + return (string) trim($sentences[array_rand($sentences)]); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function getRedirect(): ?string |
96 | 96 | { |
97 | 97 | if (preg_match('/^#REDIRECT(?:ION)? ?\[\[([^]]+)]]/i', $this->getText(), $matches)) { |
98 | - return (string)trim($matches[1]); |
|
98 | + return (string) trim($matches[1]); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return null; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $parser = new TagParser(); // todo ParserFactory |
228 | 228 | $refs = $parser->importHtml($text)->getRefValues(); // [] |
229 | 229 | |
230 | - return (array)$refs; |
|
230 | + return (array) $refs; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |