@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | throw new ConfigException('Pas de phrases disponibles'); |
107 | 107 | } |
108 | 108 | |
109 | - return (string)trim($sentences[array_rand($sentences)]); |
|
109 | + return (string) trim($sentences[array_rand($sentences)]); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | private function generateVoteInsertionText(): ?string |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $html = $this->getAdminScoreHtml(); |
268 | 268 | |
269 | 269 | if (!empty($html) && preg_match('#<th>Total</th>[^<]*<th>(\d+)</th>#', $html, $matches)) { |
270 | - return (int)$matches[1]; |
|
270 | + return (int) $matches[1]; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | return null; |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $channel->basic_qos(null, 1, null); |
37 | 37 | // callback to $this->msgProcess(). |
38 | 38 | // TODO check Rector refac |
39 | - $channel->basic_consume(static::QUEUE_NAME, '', false, false, false, false, function (\PhpAmqpLib\Message\AMQPMessage $msg) : void { |
|
39 | + $channel->basic_consume(static::QUEUE_NAME, '', false, false, false, false, function(\PhpAmqpLib\Message\AMQPMessage $msg) : void { |
|
40 | 40 | $this->msgProcess($msg); |
41 | 41 | }); |
42 | 42 |
@@ -124,8 +124,7 @@ |
||
124 | 124 | } |
125 | 125 | if (isset($this->summary->memo['count lien brisé'])) { |
126 | 126 | $suffix .= ', ⚠️️️lien brisé'; //⚠️ |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function minutesSinceLastEdit(string $title): int |
208 | 208 | { |
209 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
209 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
210 | 210 | |
211 | - return (int)round((time() - strtotime($time)) / 60); |
|
211 | + return (int) round((time() - strtotime($time)) / 60); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -224,8 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | $text = WikiTextUtil::removeHTMLcomments($text); |
226 | 226 | $botName = $botName ?: getenv('BOT_NAME'); |
227 | - $denyReg = (empty($botName)) ? '' : |
|
228 | - '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}'; |
|
227 | + $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}'; |
|
229 | 228 | return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0; |
230 | 229 | } |
231 | 230 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $row['id'], |
112 | 112 | $this->raw |
113 | 113 | ) |
114 | - );; |
|
114 | + ); ; |
|
115 | 115 | $this->queueAdapter->skipRow((int) $row['id']); |
116 | 116 | sleep(10); |
117 | 117 | continue; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | private function sendCompleted() |
321 | 321 | { |
322 | 322 | $isbn13 = $this->ouvrage->getParam('isbn'); |
323 | - if(!empty($isbn)) { |
|
323 | + if (!empty($isbn)) { |
|
324 | 324 | $isbn13 = substr($isbn13, 0, 19); |
325 | 325 | } |
326 | 326 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | 'modifs' => mb_substr(implode(',', $this->getSummaryLog()), 0, 250), |
333 | 333 | 'notcosmetic' => ($this->notCosmetic) ? 1 : 0, |
334 | 334 | 'major' => ($this->major) ? 1 : 0, |
335 | - 'isbn' => substr($isbn13,0,19), |
|
335 | + 'isbn' => substr($isbn13, 0, 19), |
|
336 | 336 | 'version' => WikiBotConfig::VERSION ?? null, |
337 | 337 | ]; |
338 | 338 | $this->log->info('finalData', $finalData); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $data = $this->getFileData(); |
56 | 56 | $this->lastDate = new DateTime($data['date'], new DateTimeZone(static::REBOOT_TIMEZONE)); |
57 | - $this->count = (int)$data['count']; |
|
57 | + $this->count = (int) $data['count']; |
|
58 | 58 | |
59 | 59 | // Today reboot date/time of the quota |
60 | 60 | $todayBoot = new DateTime(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | try { |
78 | 78 | $json = file_get_contents(static::JSON_FILENAME); |
79 | - $array = (array)json_decode($json, true, 512, JSON_THROW_ON_ERROR); |
|
79 | + $array = (array) json_decode($json, true, 512, JSON_THROW_ON_ERROR); |
|
80 | 80 | } catch (Throwable $e) { |
81 | 81 | throw new ConfigException('Error on Google Quota file : reading or JSON malformed.'); |
82 | 82 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'titre' => $volume->title, |
53 | 53 | 'sous-titre' => $this->filterSubtitle($volume), |
54 | 54 | 'année' => $this->convertDate2Year($volume->publishedDate), |
55 | - 'pages totales' => (string)$volume->pageCount ?? null, |
|
55 | + 'pages totales' => (string) $volume->pageCount ?? null, |
|
56 | 56 | 'isbn' => $this->convertIsbn($volume), |
57 | 57 | 'présentation en ligne' => $this->presentationEnLigne($volume), |
58 | 58 | 'lire en ligne' => $this->lireEnLigne($volume), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return null; |
100 | 100 | } |
101 | 101 | if (preg_match('/[^0-9]?([12]\d{3})[^0-9]?/', $data, $matches) > 0) { |
102 | - return (string)$matches[1]; |
|
102 | + return (string) $matches[1]; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return null; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | // so isbn-13 replace isbn-10 |
119 | 119 | // todo refac algo (if 2x isbn13?) |
120 | 120 | $isbn = null; |
121 | - $ids = (array)$volume->industryIdentifiers; |
|
121 | + $ids = (array) $volume->industryIdentifiers; |
|
122 | 122 | foreach ($ids as $id) { |
123 | 123 | if (!isset($isbn) && in_array($id->type, ['ISBN_10', 'ISBN_13'])) { |
124 | 124 | $isbn = $id->identifier; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->xml = $xml; |
41 | 41 | |
42 | 42 | // skip multi-records |
43 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
43 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
44 | 44 | if (1 !== $nbResults) { |
45 | 45 | echo "BNF : $nbResults records (skip)\n"; |
46 | 46 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $res = []; |
127 | 127 | foreach ($elements as $element) { |
128 | 128 | if (isset($element) && $element instanceof SimpleXMLElement) { |
129 | - $res[] = (string)$element; |
|
129 | + $res[] = (string) $element; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | { |
195 | 195 | $raw = $this->xpath2string('//mxc:datafield[@tag="215"]/mxc:subfield[@code="a"]'); |
196 | 196 | if (!empty($raw) && preg_match('#(\d{2,}) p\.#', $raw, $matches) > 0) { |
197 | - return (string)$matches[1]; |
|
197 | + return (string) $matches[1]; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | return null; |
@@ -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 | return in_array($name, $this->parametersByOrder) |