Passed
Push — master ( 860b7e...86fe81 )
by Dispositif
03:31
created
src/Domain/ExternLink/ExternHttpErrorLogic.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class ExternHttpErrorLogic
20 20
 {
21
-    final public const LOG_REQUEST_ERROR = __DIR__ . '/../../Application/resources/external_request_error.log';
21
+    final public const LOG_REQUEST_ERROR = __DIR__.'/../../Application/resources/external_request_error.log';
22 22
     protected const LOOSE = true;
23 23
 
24 24
     public function __construct(
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
             return $url;
41 41
         }
42 42
         if (preg_match('#400 Bad Request#i', $errorMessage)) {
43
-            $this->log->warning('400 Bad Request : ' . $url);
43
+            $this->log->warning('400 Bad Request : '.$url);
44 44
 
45 45
             return $url;
46 46
         }
47 47
         if (preg_match('#(403 Forbidden|403 Access Forbidden)#i', $errorMessage)) {
48
-            $this->log->warning('403 Forbidden : ' . $url);
48
+            $this->log->warning('403 Forbidden : '.$url);
49 49
             // TODO return blankLienWeb without consulté le=...
50 50
 
51 51
             return $url;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             return $url;
60 60
         }
61 61
         if (preg_match('#401 (Unauthorized|Authorization Required)#i', $errorMessage)) {
62
-            $this->log->notice('401 Unauthorized : skip ' . $url);
62
+            $this->log->notice('401 Unauthorized : skip '.$url);
63 63
 
64 64
             return $url;
65 65
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         // "URL rejected: No host part in the URL (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
105 105
         // "cURL error 28: Connection timed out after 20005 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
106 106
         //"cURL error 28: Connection timed out after 20005 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
107
-        $this->log->notice('erreur non gérée sur extractWebData: "' . $errorMessage . "\" URL: " . $url);
107
+        $this->log->notice('erreur non gérée sur extractWebData: "'.$errorMessage."\" URL: ".$url);
108 108
 
109 109
         //file_put_contents(self::LOG_REQUEST_ERROR, $this->domain."\n", FILE_APPEND);
110 110
 
Please login to merge, or discard this patch.
src/Domain/ExternLink/ExternRefTransformer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
     use SummaryExternTrait, PublisherLogicTrait;
36 36
 
37 37
     final public const HTTP_REQUEST_LOOP_DELAY = 10;
38
-    final public const SKIP_DOMAIN_FILENAME = __DIR__ . '/../resources/config_skip_domain.txt';
38
+    final public const SKIP_DOMAIN_FILENAME = __DIR__.'/../resources/config_skip_domain.txt';
39 39
     final public const REPLACE_404 = true;
40 40
     final public const REPLACE_410 = true;
41
-    final public const CONFIG_PRESSE = __DIR__ . '/../resources/config_presse.yaml';
42
-    final public const CONFIG_NEWSPAPER_JSON = __DIR__ . '/../resources/data_newspapers.json';
43
-    final public const CONFIG_SCIENTIFIC_JSON = __DIR__ . '/../resources/data_scientific_domain.json';
44
-    final public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__ . '/../resources/data_scientific_wiki.json';
41
+    final public const CONFIG_PRESSE = __DIR__.'/../resources/config_presse.yaml';
42
+    final public const CONFIG_NEWSPAPER_JSON = __DIR__.'/../resources/data_newspapers.json';
43
+    final public const CONFIG_SCIENTIFIC_JSON = __DIR__.'/../resources/data_scientific_domain.json';
44
+    final public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__.'/../resources/data_scientific_wiki.json';
45 45
 
46 46
     public bool $skipSiteBlacklisted = true;
47 47
     public bool $skipRobotNoIndex = true;
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
         }
94 94
         $this->registrableDomain = $this->urlChecker->getRegistrableDomain($url); // hack
95 95
         if ($this->isSiteBlackListed()) {
96
-            $this->log->debug('Site blacklisted : ' . $this->registrableDomain);
96
+            $this->log->debug('Site blacklisted : '.$this->registrableDomain);
97 97
             return $url;
98 98
         }
99 99
 
100 100
         if (!$this->validateConfigWebDomain($this->registrableDomain)) {
101
-            $this->log->debug('Domain not validate by config : ' . $this->registrableDomain);
101
+            $this->log->debug('Domain not validate by config : '.$this->registrableDomain);
102 102
             return $url;
103 103
         }
104 104
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     protected function isSiteBlackListed(): bool
151 151
     {
152 152
         if ($this->skipSiteBlacklisted && in_array($this->registrableDomain, $this->skip_domain)) {
153
-            $this->log->notice("Skip web site " . $this->registrableDomain);
153
+            $this->log->notice("Skip web site ".$this->registrableDomain);
154 154
             return true;
155 155
         }
156 156
         return false;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $this->config[$domain] = is_array($this->config[$domain]) ? $this->config[$domain] : [];
169 169
 
170 170
         if ($this->config[$domain] === 'deactivated' || isset($this->config[$domain]['deactivated'])) {
171
-            $this->log->info("Domain " . $domain . " disabled\n");
171
+            $this->log->info("Domain ".$domain." disabled\n");
172 172
 
173 173
             return false;
174 174
         }
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     protected function logDebugConfigWebDomain(string $domain): void
180 180
     {
181 181
         if (!isset($this->config[$domain])) {
182
-            $this->log->debug("Domain " . $domain . " non configuré");
182
+            $this->log->debug("Domain ".$domain." non configuré");
183 183
         } else {
184
-            $this->log->debug("Domain " . $domain . " configuré");
184
+            $this->log->debug("Domain ".$domain." configuré");
185 185
         }
186 186
     }
187 187
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         if ($pageData === []
208 208
             || (empty($pageData['JSON-LD']) && empty($pageData['meta']))
209 209
         ) {
210
-            $this->log->notice('No metadata : ' . $url);
210
+            $this->log->notice('No metadata : '.$url);
211 211
 
212 212
             return true;
213 213
         }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     protected function emptyMapData(array $mapData, string $url): bool
223 223
     {
224 224
         if ($mapData === [] || empty($mapData['url']) || empty($mapData['titre'])) {
225
-            $this->log->info('Mapping incomplet : ' . $url);
225
+            $this->log->info('Mapping incomplet : '.$url);
226 226
 
227 227
             return true;
228 228
         }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
         $template = WikiTemplateFactory::create($templateName);
277 277
         $template->userSeparator = " |";
278
-        $this->summary->memo['count ' . $templateName] = 1 + ($this->summary->memo['count ' . $templateName] ?? 0);
278
+        $this->summary->memo['count '.$templateName] = 1 + ($this->summary->memo['count '.$templateName] ?? 0);
279 279
 
280 280
         return $template;
281 281
     }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         $templateOptimized = $optimizer->getOptiTemplate();
332 332
 
333 333
         $serialized = $templateOptimized->serialize(true);
334
-        $this->log->info('Serialized 444: ' . $serialized . "\n");
334
+        $this->log->info('Serialized 444: '.$serialized."\n");
335 335
         return $serialized;
336 336
     }
337 337
 
Please login to merge, or discard this patch.
src/Domain/WikiOptimizer/Handlers/LocationHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
 class LocationHandler extends AbstractOuvrageHandler
20 20
 {
21
-    final public const TRANSLATE_CITY_FR = __DIR__ . '/../../resources/traduction_ville.csv';
21
+    final public const TRANSLATE_CITY_FR = __DIR__.'/../../resources/traduction_ville.csv';
22 22
 
23 23
     /**
24 24
      * @var PageListInterface
Please login to merge, or discard this patch.
src/Domain/WikiOptimizer/OuvrageOptimize.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 {
36 36
     final public const CONVERT_GOOGLEBOOK_TEMPLATE = false; // change OuvrageOptimizeTest !!
37 37
     final public const WIKI_LANGUAGE = 'fr';
38
-    final public const PUBLISHER_FRWIKI_FILENAME = __DIR__ . '/../resources/data_editors_wiki.json';
38
+    final public const PUBLISHER_FRWIKI_FILENAME = __DIR__.'/../resources/data_editors_wiki.json';
39 39
 
40 40
     /**
41 41
      * @var OptiStatus
Please login to merge, or discard this patch.
src/Domain/ExternLink/DeadLinkTransformer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
                 if ($webarchiveDTO->getArchiver() === '[[Internet Archive]]') {
57 57
                     $this->log->notice('
Please login to merge, or discard this patch.
src/Domain/ExternLink/SummaryExternTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
             $this->summary->memo['sites'][] = $this->externalPage->getPrettyDomainName(); // ???
33 33
         }
34 34
         if (isset($mapData['accès url'])) {
35
-            $this->log->debug('accès 
Please login to merge, or discard this patch.
src/Infrastructure/InternetArchiveAdapter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         return new WebarchiveDTO(
46 46
             self::ARCHIVER_NAME,
47 47
             $url,
48
-            (string)$archiveData['url'],
48
+            (string) $archiveData['url'],
49 49
             $iaDateOrNull
50 50
         );
51 51
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     protected function requestInternetArchiveApi(string $url, ?DateTimeInterface $date = null): array
54 54
     {
55 55
         $response = $this->client->get(
56
-            'https://archive.org/wayback/available?timestamp=' . self::SEARCH_CLOSEST_TIMESTAMP . '&url=' . urlencode($url),
56
+            'https://archive.org/wayback/available?timestamp='.self::SEARCH_CLOSEST_TIMESTAMP.'&url='.urlencode($url),
57 57
             [
58 58
                 'timeout' => 20,
59 59
                 'allow_redirects' => true,
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
         }
104 104
         $iaDateTime = new DateTime();
105 105
         $iaDateTime->setDate(
106
-            (int)substr($iaTimestamp, 0, 4),
107
-            (int)substr($iaTimestamp, 4, 2),
108
-            (int)substr($iaTimestamp, 6, 2)
106
+            (int) substr($iaTimestamp, 0, 4),
107
+            (int) substr($iaTimestamp, 4, 2),
108
+            (int) substr($iaTimestamp, 6, 2)
109 109
         );
110 110
         $iaDateTime->setTime(
111
-            (int)substr($iaTimestamp, 8, 2),
112
-            (int)substr($iaTimestamp, 10, 2),
113
-            (int)substr($iaTimestamp, 12, 2)
111
+            (int) substr($iaTimestamp, 8, 2),
112
+            (int) substr($iaTimestamp, 10, 2),
113
+            (int) substr($iaTimestamp, 12, 2)
114 114
         );
115 115
 
116 116
         return $iaDateTime;
Please login to merge, or discard this patch.
src/Application/AbstractRefBotWorker.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function hasWarning(): bool
26 26
     {
27
-        return (bool)$this->warning;
27
+        return (bool) $this->warning;
28 28
     }
29 29
 
30 30
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $refs = array_slice($refs, 0, self::MAX_REFS_PROCESSED_IN_ARTICLE, true);
56 56
 
57 57
         foreach ($refs as $ref) {
58
-            $refContent = WikiTextUtil::stripFinalPoint(trim((string)$ref[1]));
58
+            $refContent = WikiTextUtil::stripFinalPoint(trim((string) $ref[1]));
59 59
 
60 60
             $newRefContent = $this->processRefContent($refContent);
61 61
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
     protected function replaceRefInText(array $ref, string $replace, string $text)
71 71
     {
72 72
         // Pas de changement
73
-        if (WikiTextUtil::stripFinalPoint(trim($replace)) === WikiTextUtil::stripFinalPoint(trim((string)$ref[1]))) {
73
+        if (WikiTextUtil::stripFinalPoint(trim($replace)) === WikiTextUtil::stripFinalPoint(trim((string) $ref[1]))) {
74 74
             return $text;
75 75
         }
76 76
         $replace = $this->addFinalPeriod($ref[0], $replace);
77
-        $result = str_replace($ref[1], $replace, (string)$ref[0]);
77
+        $result = str_replace($ref[1], $replace, (string) $ref[0]);
78 78
         $this->printDiff($ref[0], $result);
79 79
 
80 80
         return str_replace($ref[0], $result, $text);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     protected function addFinalPeriod($ref, string $replace): string
87 87
     {
88
-        if (preg_match('#</ref>#', (string)$ref)) {
88
+        if (preg_match('#</ref>#', (string) $ref)) {
89 89
             $replace .= '.';
90 90
         }
91 91
         return $replace;
Please login to merge, or discard this patch.
src/Application/CLI/lastExternRefProcess.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@
 block discarded – undo
56 56
 $titles = $list->getPageTitles();
57 57
 unset($list);
58 58
 //echo count($titles)." titles\n";
59
-$edited = file(__DIR__ . '/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
59
+$edited = file(__DIR__.'/../resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
60 60
 $filtered = array_diff($titles, $edited);
61 61
 $list = new PageList($filtered);
62
-echo ">" . $list->count() . " dans liste\n";
62
+echo ">".$list->count()." dans liste\n";
63 63
 
64 64
 
65 65
 $httpClient = ServiceFactory::getHttpClient();
Please login to merge, or discard this patch.