Passed
Branch master (ee24dc)
by Dispositif
03:19 queued 39s
created
src/Infrastructure/SMS.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     {
42 42
         $sender = getenv('BOT_NAME') ?? '';
43 43
         $message = sprintf('%s : %s', $sender, $message);
44
-        $url = getenv('FREE_SMS_URL') . urlencode($message);
44
+        $url = getenv('FREE_SMS_URL').urlencode($message);
45 45
 
46 46
         $response = $this->client->get($url, ['timeout' => 120]);
47 47
 
Please login to merge, or discard this patch.
src/Application/WikiBotConfig.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 class WikiBotConfig
32 32
 {
33 33
     public const VERSION = '1.1';
34
-    public const WATCHPAGE_FILENAME = __DIR__ . '/resources/watch_pages.json';
34
+    public const WATCHPAGE_FILENAME = __DIR__.'/resources/watch_pages.json';
35 35
     public const EXIT_ON_CHECK_WATCHPAGE = false;
36 36
     // do not stop if they play with {stop} on bot talk page
37 37
     public const BLACKLIST_EDITOR = ['OrlodrimBot'];
@@ -88,9 +88,8 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $text = WikiTextUtil::removeHTMLcomments($text);
90 90
         $botName = $botName ?: self::getBotName();
91
-        $denyReg = (empty($botName)) ? '' :
92
-            '|\{\{bots ?\| ?(optout|deny)\=[^\}]*' . preg_quote($botName, '#') . '[^\}]*\}\}';
93
-        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}' . $denyReg . ')#i', $text) > 0;
91
+        $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}';
92
+        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0;
94 93
     }
95 94
 
96 95
     protected static function getBotOwner()
@@ -144,7 +143,7 @@  discard block
 block discarded – undo
144 143
 
145 144
     protected function getBotTalkPageTitle(): string
146 145
     {
147
-        return self::TALK_PAGE_PREFIX . $this::getBotName();
146
+        return self::TALK_PAGE_PREFIX.$this::getBotName();
148 147
     }
149 148
 
150 149
     /**
@@ -255,8 +254,8 @@  discard block
 block discarded – undo
255 254
      */
256 255
     public function minutesSinceLastEdit(string $title): int
257 256
     {
258
-        $time = $this->getTimestamp($title);  // 2011-09-02T16:31:13Z
257
+        $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z
259 258
 
260
-        return (int)round((time() - strtotime($time)) / 60);
259
+        return (int) round((time() - strtotime($time)) / 60);
261 260
     }
262 261
 }
Please login to merge, or discard this patch.
src/Application/CLI/wikiScanProcess.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 
59 59
 
60 60
 // utilise une liste d'import wstat.fr
61
- echo "Liste d'après wstat.fr\n";
61
+    echo "Liste d'après wstat.fr\n";
62 62
 $list = PageList::FromFile(__DIR__.'/../resources/importISBN_nov.txt');
63 63
 new ScanWiki2DB($wiki, new DbAdapter(), new WikiBotConfig($wiki), $list, 0);
64 64
 
Please login to merge, or discard this patch.
src/Application/OuvrageEdit/Validators/PageValidatorComposite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     {
41 41
         foreach ($this->validators as $validator) {
42 42
             if (!$validator instanceof ValidatorInterface) {
43
-                throw new RuntimeException(get_class($validator) . ' must implement ValidatorInterface.');
43
+                throw new RuntimeException(get_class($validator).' must implement ValidatorInterface.');
44 44
             }
45 45
             if ($validator->validate() === false) {
46 46
                 return false;
Please login to merge, or discard this patch.
src/Application/OuvrageEdit/OuvrageEditWorker.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public const DELAY_BOTFLAG_SECONDS = 60;
48 48
     public const DELAY_NO_BOTFLAG_SECONDS = 60;
49 49
     public const DELAY_MINUTES_AFTER_HUMAN_EDIT = 10;
50
-    public const ERROR_MSG_TEMPLATE = __DIR__ . '/templates/message_errors.wiki';
50
+    public const ERROR_MSG_TEMPLATE = __DIR__.'/templates/message_errors.wiki';
51 51
 
52 52
     /**
53 53
      * @var PageWorkStatus
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         while (true) {
96 96
             echo "\n-------------------------------------\n\n";
97
-            echo date("Y-m-d H:i:s") . " ";
97
+            echo date("Y-m-d H:i:s")." ";
98 98
             $this->log->info($this->memory->getMemory(true));
99 99
             $this->pageProcess();
100 100
             sleep(2); // précaution boucle infinie
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         try {
129 129
             $this->wikiPageAction = ServiceFactory::wikiPageAction($this->pageWorkStatus->getTitle()); // , true ?
130 130
         } catch (Exception $e) {
131
-            $this->log->warning("*** WikiPageAction error : " . $this->pageWorkStatus->getTitle() . " \n");
131
+            $this->log->warning("*** WikiPageAction error : ".$this->pageWorkStatus->getTitle()." \n");
132 132
             sleep(20);
133 133
 
134 134
             return false;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
     protected function printTitle(string $title): void
166 166
     {
167
-        echo Color::BG_CYAN . $title . Color::NORMAL . " \n";
167
+        echo Color::BG_CYAN.$title.Color::NORMAL." \n";
168 168
     }
169 169
 
170 170
     protected function checkArticleLabels($title): void
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
 
238 238
     protected function printDebug(array $data)
239 239
     {
240
-        $this->log->debug('origin: ' . $data['raw']);
241
-        $this->log->debug('completed: ' . $data['opti']);
242
-        $this->log->debug('modifs: ' . $data['modifs']);
243
-        $this->log->debug('version: ' . $data['version']);
240
+        $this->log->debug('origin: '.$data['raw']);
241
+        $this->log->debug('completed: '.$data['opti']);
242
+        $this->log->debug('modifs: '.$data['modifs']);
243
+        $this->log->debug('version: '.$data['version']);
244 244
     }
245 245
 
246 246
     protected function editPage(): bool
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 $this->log->alert("*** Invalid CSRF token \n");
262 262
                 throw new Exception('Invalid CSRF token', $e->getCode(), $e);
263 263
             } else {
264
-                $this->log->warning('Exception in editPage() ' . $e->getMessage());
264
+                $this->log->warning('Exception in editPage() '.$e->getMessage());
265 265
                 sleep(10);
266 266
 
267 267
                 return false;
@@ -283,16 +283,16 @@  discard block
 block discarded – undo
283 283
                 $this->sendOuvrageErrorsOnTalkPage($pageOuvrageCollection, $this->log);
284 284
             }
285 285
         } catch (Throwable $e) {
286
-            $this->log->warning('Exception in editPage() ' . $e->getMessage());
286
+            $this->log->warning('Exception in editPage() '.$e->getMessage());
287 287
             unset($e);
288 288
         }
289 289
 
290 290
         if (!$this->pageWorkStatus->botFlag) {
291
-            $this->log->debug("sleep " . self::DELAY_NO_BOTFLAG_SECONDS);
291
+            $this->log->debug("sleep ".self::DELAY_NO_BOTFLAG_SECONDS);
292 292
             sleep(self::DELAY_NO_BOTFLAG_SECONDS);
293 293
         }
294 294
         if ($this->pageWorkStatus->botFlag) {
295
-            $this->log->debug("sleep " . self::DELAY_BOTFLAG_SECONDS);
295
+            $this->log->debug("sleep ".self::DELAY_BOTFLAG_SECONDS);
296 296
             sleep(self::DELAY_BOTFLAG_SECONDS);
297 297
         }
298 298
     }
Please login to merge, or discard this patch.
src/Application/OuvrageEdit/Validators/CitationValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             || $this->isTextCreatingError($this->ouvrageData['raw'])
55 55
         ) {
56 56
             $this->log->notice("SKIP: template avec commentaire HTML ou modèle problématique.");
57
-            $this->db->skipRow((int)$this->ouvrageData['id']);
57
+            $this->db->skipRow((int) $this->ouvrageData['id']);
58 58
 
59 59
             return false;
60 60
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $find = mb_strpos($this->wikiText, $this->ouvrageData['raw']);
77 77
         if ($find === false) {
78 78
             $this->log->notice("String non trouvée.");
79
-            $this->db->skipRow((int)$this->ouvrageData['id']);
79
+            $this->db->skipRow((int) $this->ouvrageData['id']);
80 80
 
81 81
             return false;
82 82
         }
Please login to merge, or discard this patch.
src/Application/ExternLink/RecentChangeWorker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@
 block discarded – undo
41 41
 
42 42
     public function trackUser(string $user): void
43 43
     {
44
-        echo "**** TRACK " . $user . "*****\n";
44
+        echo "**** TRACK ".$user."*****\n";
45 45
 
46 46
         $titles = $this->getLastEditsbyUser($user);
47 47
 
48 48
         // filter titles already in edited.txt
49 49
         $edited = file(self::ALREADY_EDITED_PATH, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
50 50
         $filtered = array_diff($titles, $edited);
51
-        $list = new PageList( $filtered ); // TODO PageList factory in App ?
52
-        echo ">" . $list->count() . " dans liste\n";
51
+        $list = new PageList($filtered); // TODO PageList factory in App ?
52
+        echo ">".$list->count()." dans liste\n";
53 53
 
54 54
         $this->consumeList($list);
55 55
     }
Please login to merge, or discard this patch.
src/Application/Http/ExternHttpClient.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
         // idn_to_ascii('teßt.com',IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46)
59 59
         // checkdnsrr($string, "A") // check DNS record
60 60
         if (!self::isHttpURL($url)) {
61
-            throw new DomainException('URL not compatible : ' . $url);
61
+            throw new DomainException('URL not compatible : '.$url);
62 62
         }
63 63
         $response = $this->client->get($url);
64 64
 
65 65
         if (200 !== $response->getStatusCode()) {
66
-            echo 'HTTP error ' . $response->getStatusCode();
67
-            $this->log->error('HTTP error ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase());
66
+            echo 'HTTP error '.$response->getStatusCode();
67
+            $this->log->error('HTTP error '.$response->getStatusCode().' '.$response->getReasonPhrase());
68 68
 
69 69
             return null;
70 70
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public static function isHttpURL(string $url): bool
83 83
     {
84
-        return (bool)preg_match('#^https?://[^ ]+$#i', $url);
84
+        return (bool) preg_match('#^https?://[^ ]+$#i', $url);
85 85
     }
86 86
 
87 87
     /**
@@ -103,19 +103,19 @@  discard block
 block discarded – undo
103 103
         $charset = $this->extractCharset($html) ?? 'WINDOWS-1252';
104 104
 
105 105
         if (empty($charset)) {
106
-            throw new DomainException('normalized html error and no charset found : ' . $url);
106
+            throw new DomainException('normalized html error and no charset found : '.$url);
107 107
         }
108 108
         try {
109 109
             $html2 = iconv($charset, 'UTF-8//TRANSLIT', $html);
110 110
             if (false === $html2) {
111
-                throw new DomainException("error iconv : $charset to UTF-8 on " . $url);
111
+                throw new DomainException("error iconv : $charset to UTF-8 on ".$url);
112 112
             }
113 113
             $html2 = Normalizer::normalize($html2);
114 114
             if (!is_string($html2)) {
115
-                throw new DomainException("error normalizer : $charset to UTF-8 on " . $url);
115
+                throw new DomainException("error normalizer : $charset to UTF-8 on ".$url);
116 116
             }
117 117
         } catch (Throwable $e) {
118
-            throw new DomainException("error converting : $charset to UTF-8 on " . $url, $e->getCode(), $e);
118
+            throw new DomainException("error converting : $charset to UTF-8 on ".$url, $e->getCode(), $e);
119 119
         }
120 120
 
121 121
         return $html2;
Please login to merge, or discard this patch.
src/Application/OuvrageComplete/Handlers/GoogleBooksHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
             return OuvrageFactory::GoogleFromIsbn($this->isbn);
40 40
         } catch (Throwable $e) {
41
-            $this->logger->warning("*** ERREUR GOOGLE Isbn Search ***" . $e->getMessage());
41
+            $this->logger->warning("*** ERREUR GOOGLE Isbn Search ***".$e->getMessage());
42 42
             if (strpos($e->getMessage(), 'Could not resolve host: www.googleapis.com') === false) {
43 43
                 throw $e;
44 44
             }
Please login to merge, or discard this patch.