Passed
Push — master ( 86fe81...69b6a3 )
by Dispositif
02:31
created
src/Application/OuvrageEdit/Validators/PageValidatorComposite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     {
45 45
         foreach ($this->validators as $validator) {
46 46
             if (!$validator instanceof ValidatorInterface) {
47
-                throw new RuntimeException($validator::class . ' must implement ValidatorInterface.');
47
+                throw new RuntimeException($validator::class.' must implement ValidatorInterface.');
48 48
             }
49 49
             if (!$validator->validate()) {
50 50
                 return false;
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
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $find = mb_strpos($this->wikiText, (string) $this->ouvrageData['raw']);
73 73
         if ($find === false) {
74 74
             $this->log->notice("String non trouvée.");
75
-            $this->db->skipRow((int)$this->ouvrageData['id']);
75
+            $this->db->skipRow((int) $this->ouvrageData['id']);
76 76
 
77 77
             return false;
78 78
         }
Please login to merge, or discard this patch.
src/Application/OuvrageEdit/OuvrageEditSummaryTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
         $prefix = ($this->pageWorkStatus->botFlag) ? 'bot ' : '';
72 72
         $prefix .= (empty($this->pageWorkStatus->errorWarning)) ? '' : ' ⚠️'; // AdQ, BA
73 73
 
74
-        return $prefix . ((empty($this->pageWorkStatus->featured_article)) ? '' : ' ☆');
74
+        return $prefix.((empty($this->pageWorkStatus->featured_article)) ? '' : ' ☆');
75 75
     }
76 76
 
77 77
     /**
Please login to merge, or discard this patch.
src/Application/WikiPageAction.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $this->page = $wiki->newPageGetter()->getFromTitle($title);
55 55
             $this->ns = $this->page->getPageIdentifier()->getTitle()->getNs();
56 56
         } catch (Throwable $e) {
57
-            throw new Exception('Erreur construct WikiPageAction ' . $e->getMessage() . $e->getFile() . $e->getLine(), $e->getCode(), $e);
57
+            throw new Exception('Erreur construct WikiPageAction '.$e->getMessage().$e->getFile().$e->getLine(), $e->getCode(), $e);
58 58
         }
59 59
     }
60 60
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         // "{{en}} {{zh}} {{ouvrage...}}"
74 74
         // todo test U
75 75
         if (preg_match_all(
76
-            '#(?<langTemp>{{[a-z][a-z]}} ?{{[a-z][a-z]}}) ?' . preg_quote($tplOrigin, '#') . '#i',
76
+            '#(?<langTemp>{{[a-z][a-z]}} ?{{[a-z][a-z]}}) ?'.preg_quote($tplOrigin, '#').'#i',
77 77
             $text,
78 78
             $matches
79 79
         )
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         // hack // todo: autres patterns {{en}} ?
88 88
         // OK : {{en}} \n {{ouvrage}}
89 89
         if (preg_match_all(
90
-                "#(?<langTemp>{{(?<lang>[a-z][a-z])}} *\n?)?" . preg_quote($tplOrigin, '#') . '#i',
90
+                "#(?<langTemp>{{(?<lang>[a-z][a-z])}} *\n?)?".preg_quote($tplOrigin, '#').'#i',
91 91
                 $text,
92 92
                 $matches
93 93
             ) > 0
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 // example : {{en}} {{template|lang=ru}}
103 103
                 if (!empty($lang) && self::SKIP_LANG_INDICATOR !== $lang
104 104
                     && preg_match('#langue *=#', $tplReplace)
105
-                    && !preg_match('#langue *= ?' . $lang . '#i', $tplReplace)
105
+                    && !preg_match('#langue *= ?'.$lang.'#i', $tplReplace)
106 106
                     && !preg_match('#\| ?langue *= ?\n?\|#', $tplReplace)
107 107
                 ) {
108 108
                     echo sprintf(
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 // FIX dirty : {{en}} mais langue= avec value non définie sur new template...
126 126
                 if (!empty($lang) && preg_match('#\| ?(langue *=) ?\n? ?\|#', $tplReplace, $matchLangue) > 0) {
127 127
                     $previousTpl = $tplReplace;
128
-                    $tplReplace = str_replace($matchLangue[1], 'langue=' . $lang, $tplReplace);
128
+                    $tplReplace = str_replace($matchLangue[1], 'langue='.$lang, $tplReplace);
129 129
                     //dump('origin', $tplOrigin);
130 130
                     $text = str_replace($previousTpl, $tplReplace, $text);
131 131
                 }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                 // replace {template} and {{lang}} {template}
141 141
                 $text = str_replace($mention, $tplReplace, $text);
142 142
                 $text = str_replace(
143
-                    $matches['langTemp'][$num] . $tplReplace,
143
+                    $matches['langTemp'][$num].$tplReplace,
144 144
                     $tplReplace,
145 145
                     $text
146 146
                 ); // si 1er replace global sans
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     public function getRedirect(): ?string
211 211
     {
212 212
         if ($this->getText() && preg_match('/^#REDIRECT(?:ION)? ?\[\[([^]]+)]]/i', $this->getText(), $matches)) {
213
-            return (string)trim($matches[1]);
213
+            return (string) trim($matches[1]);
214 214
         }
215 215
 
216 216
         return null;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             throw new Exception('That page does not exist');
260 260
         }
261 261
         $oldText = $this->getText();
262
-        $newText = $oldText . "\n" . $addText;
262
+        $newText = $oldText."\n".$addText;
263 263
 
264 264
         return $this->editPage($newText, $editInfo);
265 265
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             throw new Exception('That page does not exist');
316 316
         }
317 317
         $oldText = $this->getText();
318
-        $newText = $addText . $oldText;
318
+        $newText = $addText.$oldText;
319 319
 
320 320
         return $this->editPage($newText, $editInfo);
321 321
     }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         foreach ($refs as $ref) {
344 344
             if (preg_match(
345 345
                     '#(?<url>https?://(?:www\.)?lemonde\.fr/[^ \]]+)#i',
346
-                    (string)$ref,
346
+                    (string) $ref,
347 347
                     $matches
348 348
                 ) > 0
349 349
             ) {
Please login to merge, or discard this patch.
src/Application/CLI/Monitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use Mediawiki\Api\MediawikiFactory;
17 17
 use Normalizer;
18 18
 
19
-include __DIR__ . '/../myBootstrap.php';
19
+include __DIR__.'/../myBootstrap.php';
20 20
 
21 21
 $process = new Monitor();
22 22
 $process->run();
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             [
98 98
                 'page' => $title ?? '',
99 99
                 'verify' => date("Y-m-d H:i:s"),
100
-                'altered' => (int)$stat,
100
+                'altered' => (int) $stat,
101 101
             ]
102 102
         );
103 103
     }
@@ -147,6 +147,6 @@  discard block
 block discarded – undo
147 147
 
148 148
         }
149 149
 
150
-        return (int)round(($count - $found) / count($data) * 100);
150
+        return (int) round(($count - $found) / count($data) * 100);
151 151
     }
152 152
 }
Please login to merge, or discard this patch.
src/Domain/ExternLink/Validators/RobotNoIndexValidator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
         if (
37 37
             !empty($robots)
38 38
             && (
39
-                stripos((string)$robots, 'noindex') !== false
40
-                || stripos((string)$robots, 'none') !== false
39
+                stripos((string) $robots, 'noindex') !== false
40
+                || stripos((string) $robots, 'none') !== false
41 41
             )
42 42
         ) {
43
-            $this->log->notice('robots NOINDEX : ' . $this->url);
43
+            $this->log->notice('robots NOINDEX : '.$this->url);
44 44
 
45 45
             if (empty($this->pageData['meta']['prettyDomainName'])) {
46
-                $this->log->warning('No prettyDomainName for ' . $this->url);
46
+                $this->log->warning('No prettyDomainName for '.$this->url);
47 47
 
48 48
                 return true;
49 49
             }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     protected function isNoIndexDomainWhitelisted(?string $prettyDomain): bool
58 58
     {
59 59
         if (in_array($prettyDomain ?? '', $this->noindexWhitelist)) {
60
-            $this->log->notice('ROBOT_NOINDEX_WHITELIST ' . $prettyDomain);
60
+            $this->log->notice('ROBOT_NOINDEX_WHITELIST '.$prettyDomain);
61 61
 
62 62
             return true;
63 63
         }
Please login to merge, or discard this patch.
src/Domain/Publisher/BnfMapper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $this->xml = $xml;
38 38
 
39 39
         // skip multi-records
40
-        $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0;
40
+        $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0;
41 41
         if (1 !== $nbResults) {
42 42
             return [];
43 43
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $res = [];
122 122
         foreach ($elements as $element) {
123 123
             if (isset($element) && $element instanceof SimpleXMLElement) {
124
-                $res[] = (string)$element;
124
+                $res[] = (string) $element;
125 125
             }
126 126
         }
127 127
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
         $raw = $this->xpath2string('//mxc:datafield[@tag="215"]/mxc:subfield[@code="a"]');
187 187
         if (!empty($raw) && preg_match('#(\d{2,}) p\.#', $raw, $matches) > 0) {
188
-            return (string)$matches[1];
188
+            return (string) $matches[1];
189 189
         }
190 190
 
191 191
         return null;
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 = '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'];
@@ -97,9 +97,8 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $text = WikiTextUtil::removeHTMLcomments($text);
99 99
         $botName = $botName ?: self::getBotName();
100
-        $denyReg = (empty($botName)) ? '' :
101
-            '|\{\{bots ?\| ?(optout|deny)\=[^\}]*' . preg_quote($botName, '#') . '[^\}]*\}\}';
102
-        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}' . $denyReg . ')#i', $text) > 0;
100
+        $denyReg = (empty($botName)) ? '' : '|\{\{bots ?\| ?(optout|deny)\=[^\}]*'.preg_quote($botName, '#').'[^\}]*\}\}';
101
+        return preg_match('#({{nobots}}|{{bots ?\| ?(optout|deny) ?= ?all ?}}'.$denyReg.')#i', $text) > 0;
103 102
     }
104 103
 
105 104
     protected static function getBotOwner()
@@ -155,7 +154,7 @@  discard block
 block discarded – undo
155 154
 
156 155
     protected function getBotTalkPageTitle(): string
157 156
     {
158
-        return self::TALK_PAGE_PREFIX . $this::getBotName();
157
+        return self::TALK_PAGE_PREFIX.$this::getBotName();
159 158
     }
160 159
 
161 160
     /**
@@ -266,8 +265,8 @@  discard block
 block discarded – undo
266 265
      */
267 266
     public function minutesSinceLastEdit(string $title): int
268 267
     {
269
-        $time = $this->getTimestamp($title);  // 2011-09-02T16:31:13Z
268
+        $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z
270 269
 
271
-        return (int)round((time() - strtotime($time)) / 60);
270
+        return (int) round((time() - strtotime($time)) / 60);
272 271
     }
273 272
 }
Please login to merge, or discard this patch.
src/Infrastructure/InternetDomainParser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class InternetDomainParser implements InternetDomainParserInterface
23 23
 {
24
-    private const PATH_CACHE_PUBLIC_SUFFIX_LIST = __DIR__ . '/resources/public_suffix_list.dat';
24
+    private const PATH_CACHE_PUBLIC_SUFFIX_LIST = __DIR__.'/resources/public_suffix_list.dat';
25 25
 
26 26
     private readonly Rules $rules;
27 27
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public static function extractSubdomainString(string $httpURL): string
56 56
     {
57 57
         if (!HttpUtil::isHttpURL($httpURL)) {
58
-            throw new Exception('string is not an URL ' . $httpURL);
58
+            throw new Exception('string is not an URL '.$httpURL);
59 59
         }
60 60
 
61 61
         return parse_url($httpURL, PHP_URL_HOST);
Please login to merge, or discard this patch.