@@ -32,7 +32,7 @@ |
||
| 32 | 32 | try { |
| 33 | 33 | $result = $trans->process($url, $summary); |
| 34 | 34 | } catch (\Exception $e) { |
| 35 | - echo "EXCEPTION ". $e->getMessage().$e->getFile().$e->getLine(); |
|
| 35 | + echo "EXCEPTION ".$e->getMessage().$e->getFile().$e->getLine(); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | echo $result."\n"; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | private $options = []; |
| 38 | 38 | |
| 39 | - public function __construct(LoggerInterface $log, ?array $options=[]) |
|
| 39 | + public function __construct(LoggerInterface $log, ?array $options = []) |
|
| 40 | 40 | { |
| 41 | 41 | $this->log = $log; |
| 42 | 42 | $this->options = $options; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $mapJson['DATA-TYPE'] = 'JSON-LD+META'; |
| 74 | 74 | } |
| 75 | 75 | // récupère "accès url" de OpenGraph (prévaut sur JSON:'isAccessibleForFree' |
| 76 | - if(isset($mapMeta['accès url']) ){ |
|
| 76 | + if (isset($mapMeta['accès url'])) { |
|
| 77 | 77 | $mapJson['accès url'] = $mapMeta['accès url']; |
| 78 | 78 | $mapJson['DATA-TYPE'] = 'JSON-LD+META'; |
| 79 | 79 | } |
@@ -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 | |
@@ -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 | } |
@@ -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) |