Passed
Push — master ( 69b6a3...2b67eb )
by Dispositif
02:36
created
src/Infrastructure/Monitor/Stats.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Stats
20 20
 {
21
-    protected const DEFAULT_FILEPATH = __DIR__ . '/../../../log/stats.db';
21
+    protected const DEFAULT_FILEPATH = __DIR__.'/../../../log/stats.db';
22 22
     protected const MAX_TAG_LENGTH = 100;
23 23
 
24 24
     protected SQLite3 $db;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         try {
77 77
             // upsert :)
78 78
             return $this->sqliteExecWriteOrWait(
79
-                'INSERT INTO ' . $table . ' (tag) VALUES("' . $tag . '") ON CONFLICT(tag) DO UPDATE SET num=num+1'
79
+                'INSERT INTO '.$table.' (tag) VALUES("'.$tag.'") ON CONFLICT(tag) DO UPDATE SET num=num+1'
80 80
             );
81 81
         } catch (Exception $e) {
82 82
             return false;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $tag = $this->formatTag($tag);
109 109
         try {
110 110
             return $this->sqliteExecWriteOrWait(
111
-                'INSERT OR REPLACE INTO tagnum (tag,num) VALUES("' . $tag . '", ' . $num . ')'
111
+                'INSERT OR REPLACE INTO tagnum (tag,num) VALUES("'.$tag.'", '.$num.')'
112 112
             );
113 113
         } catch (Exception $e) {
114 114
             return false;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $tag = $this->formatTag($tag);
121 121
         try {
122 122
             return $this->sqliteExecWriteOrWait(
123
-                'INSERT INTO tagnum (tag) VALUES("' . $tag . '") ON CONFLICT(tag) DO UPDATE SET num=num-1'
123
+                'INSERT INTO tagnum (tag) VALUES("'.$tag.'") ON CONFLICT(tag) DO UPDATE SET num=num-1'
124 124
             );
125 125
         } catch (Exception $e) {
126 126
             return false;
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
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 {
32 32
     protected const USER_RC_LIMIT = 100;
33 33
     protected const TASK_NAME = '
Please login to merge, or discard this patch.
src/Application/WikiBotConfig.php 1 patch
Spacing   +10 added lines, -11 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 = '2.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'];
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @var DateTimeImmutable
57 57
      */
58 58
     protected $lastCheckStopDate;
59
-    protected SMSInterface|null $SMSClient;
59
+    protected SMSInterface | null $SMSClient;
60 60
     protected $mediawikiFactory;
61 61
     protected ?string $gitCommitHash = null;
62 62
 
@@ -90,9 +90,8 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $text = WikiTextUtil::removeHTMLcomments($text);
92 92
         $botName = $botName ?: self::getBotName();
93
-        $denyReg = (empty($botName)) ? '' :
94
-            '|\{\{bots ?\| ?(optout|deny)\=[^\}]*' . preg_quote($botName, '#') . '[^\}]*\}\}';
95
-        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}' . $denyReg . ')#i', $text) > 0;
93
+        $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}';
94
+        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0;
96 95
     }
97 96
 
98 97
     /**
@@ -127,12 +126,12 @@  discard block
 block discarded – undo
127 126
         if ($this->gitCommitHash) {
128 127
             return $this->gitCommitHash;
129 128
         }
130
-        $path = __DIR__ . '/../../.git/';
129
+        $path = __DIR__.'/../../.git/';
131 130
         if (!file_exists($path)) {
132 131
             return null;
133 132
         }
134
-        $head = trim(substr(file_get_contents($path . 'HEAD'), 4));
135
-        $hash = trim(file_get_contents(sprintf($path . $head)));
133
+        $head = trim(substr(file_get_contents($path.'HEAD'), 4));
134
+        $hash = trim(file_get_contents(sprintf($path.$head)));
136 135
         $this->gitCommitHash = $hash; // cached
137 136
 
138 137
         return $hash;
@@ -190,7 +189,7 @@  discard block
 block discarded – undo
190 189
 
191 190
     protected function getBotTalkPageTitle(): string
192 191
     {
193
-        return self::TALK_PAGE_PREFIX . $this::getBotName();
192
+        return self::TALK_PAGE_PREFIX.$this::getBotName();
194 193
     }
195 194
 
196 195
     protected function sendSMSandFunnyTalk(string $lastEditor, ?bool $botTalk): void
@@ -290,8 +289,8 @@  discard block
 block discarded – undo
290 289
      */
291 290
     public function minutesSinceLastEdit(string $title): int
292 291
     {
293
-        $time = $this->getTimestamp($title);  // 2011-09-02T16:31:13Z
292
+        $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z
294 293
 
295
-        return (int)round((time() - strtotime($time)) / 60);
294
+        return (int) round((time() - strtotime($time)) / 60);
296 295
     }
297 296
 }
Please login to merge, or discard this patch.
src/Application/AbstractBotTaskWorker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
     public const SLEEP_AFTER_EDITION = 60;
33 33
     public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 15;
34 34
     public const CHECK_EDIT_CONFLICT = true;
35
-    public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/resources/article_edited.txt';
35
+    public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/resources/article_edited.txt';
36 36
     public const SKIP_LASTEDIT_BY_BOT = true;
37 37
     public const SKIP_NOT_IN_MAIN_WIKISPACE = true;
38 38
     public const SKIP_ADQ = true;
39 39
     public const THROTTLE_DELAY_AFTER_EACH_TITLE = 1; //secs
40
-    protected const GIT_COMMIT_HASH_PATH = __DIR__ . '/resources/commithash.txt';
40
+    protected const GIT_COMMIT_HASH_PATH = __DIR__.'/resources/commithash.txt';
41 41
 
42 42
     /**
43 43
      * @var PageListInterface
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $this->initializePastAnalyzedTitles();
94 94
 
95 95
         // @throw exception on "Invalid CSRF token"
96
-        $this->run();//todo delete that and use (Worker)->run($duration) or process management
96
+        $this->run(); //todo delete that and use (Worker)->run($duration) or process management
97 97
     }
98 98
 
99 99
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     final public function run(): void
105 105
     {
106
-        $this->log->notice('*** New BotTaskWorker: ' . $this->defaultTaskname, ['stats' => 'bottaskworker.instance']);
106
+        $this->log->notice('*** New BotTaskWorker: '.$this->defaultTaskname, ['stats' => 'bottaskworker.instance']);
107 107
         $this->log->notice(sprintf(
108 108
             '*** Bot: %s - commit: %s',
109 109
             $this->bot::getBotName(),
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         }
218 218
 
219 219
         $this->log->notice($result ? '>> OK' : '>>  NOCHANGE');
220
-        $this->log->debug("Sleep " . static::SLEEP_AFTER_EDITION);
220
+        $this->log->debug("Sleep ".static::SLEEP_AFTER_EDITION);
221 221
         sleep(static::SLEEP_AFTER_EDITION);
222 222
     }
223 223
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $commitHashFromFile = @file_get_contents(self::GIT_COMMIT_HASH_PATH);
242 242
         if ($commitHash && $commitHashFromFile !== $commitHash) {
243 243
             file_put_contents(self::GIT_COMMIT_HASH_PATH, $commitHash);
244
-            $taskname = sprintf('[%s] %s', substr($commitHash, 0, 6), $taskname, );
244
+            $taskname = sprintf('[%s] %s', substr($commitHash, 0, 6), $taskname,);
245 245
         }
246 246
 
247 247
         return $taskname;
Please login to merge, or discard this patch.
src/Application/CLI/externRefProcess.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,23 +54,23 @@
 block discarded – undo
54 54
     $list = new PageList([trim($argv[1])]);
55 55
 
56 56
     // delete Title from edited.txt
57
-    $file = __DIR__ . '/../resources/article_externRef_edited.txt';
57
+    $file = __DIR__.'/../resources/article_externRef_edited.txt';
58 58
     $text = file_get_contents($file);
59
-    $newText = str_replace(trim($argv[1]) . "\n", '', $text);
59
+    $newText = str_replace(trim($argv[1])."\n", '', $text);
60 60
     if (!empty($text) && $text !== $newText) {
61 61
         @file_put_contents($file, $newText);
62 62
     }
63
-    $botConfig->setTaskName('
Please login to merge, or discard this patch.