@@ -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 |
@@ -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; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | { |
60 | 60 | // Style "auto1234" |
61 | 61 | if (empty($this->getParam('périodique') || empty($this->getParam('date')))) { |
62 | - return 'auto'.(string)random_int(1000, 9999); |
|
62 | + return 'auto'.(string) random_int(1000, 9999); |
|
63 | 63 | } |
64 | 64 | // Style "LeMonde15022017" |
65 | 65 | $periodique = str_replace( |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $id .= ($this->getParam('nom'.$i)) ?? $this->getParam('auteur'.$i) ?? ''; |
52 | 52 | } |
53 | 53 | |
54 | - return $id . ($this->getParam('année') ?? ''); |
|
54 | + return $id.($this->getParam('année') ?? ''); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $string .= "\n"; |
95 | 95 | } |
96 | 96 | |
97 | - return $string . '}}'; |
|
97 | + return $string.'}}'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | // Gestion alias |
270 | 270 | if (!$this->isValidParamName($name)) { |
271 | 271 | // hack : 1 => "ouvrage collectif" |
272 | - $name = (string)$name; |
|
272 | + $name = (string) $name; |
|
273 | 273 | $this->log[] = "parameter $name not found"; |
274 | 274 | |
275 | 275 | // todo keep there |