Passed
Push — master ( 6c70b1...2f16d6 )
by Dispositif
02:31
created
src/Application/RecentChangeWorker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@
 block discarded – undo
35 35
 
36 36
     public function trackUser(string $user): void
37 37
     {
38
-        echo "**** TRACK " . $user . "*****\n";
38
+        echo "**** TRACK ".$user."*****\n";
39 39
 
40 40
         $titles = $this->getLastEditsbyUser($user);
41 41
 
42 42
         // filter titles already in edited.txt
43 43
         $edited = file(__DIR__.'/resources/article_externRef_edited.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
44 44
         $filtered = array_diff($titles, $edited);
45
-        $list = new PageList( $filtered );
46
-        echo ">" . $list->count() . " dans liste\n";
45
+        $list = new PageList($filtered);
46
+        echo ">".$list->count()." dans liste\n";
47 47
 
48 48
         $this->consumeList($list);
49 49
     }
Please login to merge, or discard this patch.
src/Application/Http/ExternHttpClient.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
         // idn_to_ascii('teßt.com',IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46)
61 61
         // checkdnsrr($string, "A") // check DNS record
62 62
         if (!self::isHttpURL($url)) {
63
-            throw new DomainException('URL not compatible : ' . $url);
63
+            throw new DomainException('URL not compatible : '.$url);
64 64
         }
65 65
         $response = $this->client->get($url);
66 66
 
67 67
         if (200 !== $response->getStatusCode()) {
68
-            echo 'HTTP error ' . $response->getStatusCode();
69
-            $this->log->error('HTTP error ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase());
68
+            echo 'HTTP error '.$response->getStatusCode();
69
+            $this->log->error('HTTP error '.$response->getStatusCode().' '.$response->getReasonPhrase());
70 70
 
71 71
             return null;
72 72
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public static function isHttpURL(string $url): bool
84 84
     {
85
-        return (bool)preg_match('#^https?://[^ ]+$#i', $url);
85
+        return (bool) preg_match('#^https?://[^ ]+$#i', $url);
86 86
     }
87 87
 
88 88
     /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $charset = $this->extractCharset($html) ?? 'WINDOWS-1252';
105 105
 
106 106
         if (empty($charset)) {
107
-            throw new DomainException('normalized html error and no charset found : ' . $url);
107
+            throw new DomainException('normalized html error and no charset found : '.$url);
108 108
         }
109 109
         try {
110 110
             $html2 = iconv($charset, 'UTF-8//TRANSLIT', $html);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 return '';
114 114
             }
115 115
         } catch (Throwable $e) {
116
-            throw new DomainException("error converting : $charset to UTF-8 on " . $url, $e->getCode(), $e);
116
+            throw new DomainException("error converting : $charset to UTF-8 on ".$url, $e->getCode(), $e);
117 117
         }
118 118
 
119 119
         return $html2;
Please login to merge, or discard this patch.
src/Application/Examples/testExternLink.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     // Attention : pas de post-processing (sanitize title, etc.)
38 38
     $result = $trans->process($url, $summary);
39 39
 } catch (Exception $e) {
40
-    $result = "EXCEPTION ". $e->getMessage().$e->getFile().$e->getLine();
40
+    $result = "EXCEPTION ".$e->getMessage().$e->getFile().$e->getLine();
41 41
 }
42 42
 
43 43
 echo $result."\n";
Please login to merge, or discard this patch.
src/Domain/ExternLink/ExternPage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     )
70 70
     {
71 71
         if (!ExternHttpClient::isHttpURL($url)) {
72
-            throw new Exception('string is not an URL ' . $url);
72
+            throw new Exception('string is not an URL '.$url);
73 73
         }
74 74
         $this->url = $url;
75 75
         $this->html = $html;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         try {
191 191
             if (!ExternHttpClient::isHttpURL($this->url)) {
192
-                throw new Exception('string is not an URL ' . $this->url);
192
+                throw new Exception('string is not an URL '.$this->url);
193 193
             }
194 194
             if (!$this->domainParser instanceof InternetDomainParserInterface) {
195 195
                 $this->log->notice('InternetDomainParser is not set');
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             return $this->domainParser->getRegistrableDomainFromURL($this->url);
201 201
         } catch (Exception $e) {
202 202
             if ($this->log !== null) {
203
-                $this->log->warning('InternetDomainParser->getRegistrableDomainFromURL NULL ' . $this->url);
203
+                $this->log->warning('InternetDomainParser->getRegistrableDomainFromURL NULL '.$this->url);
204 204
             }
205 205
             throw new Exception('InternetDomainParser->getRegistrableDomainFromURL NULL', $e->getCode(), $e);
206 206
         }
Please login to merge, or discard this patch.
src/Domain/ExternLink/ExternPageFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     /**
24 24
      * @throws Exception
25 25
      */
26
-    public static function fromURL($url, ExternHttpClientInterface $httpClient,LoggerInterface $logger = null): ExternPage
26
+    public static function fromURL($url, ExternHttpClientInterface $httpClient, LoggerInterface $logger = null): ExternPage
27 27
     {
28 28
         if (!ExternHttpClient::isHttpURL($url)) {
29 29
             throw new Exception('string is not an URL '.$url);
Please login to merge, or discard this patch.
src/Domain/ExternLink/ExternHttpClientInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,5 +11,5 @@
 block discarded – undo
11 11
 
12 12
 interface ExternHttpClientInterface
13 13
 {
14
-    public function getHTML(string $url, ?bool $normalized=false): ?string;
14
+    public function getHTML(string $url, ?bool $normalized = false): ?string;
15 15
 }
Please login to merge, or discard this patch.
src/Application/ExternRefWorker.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public const SLEEP_AFTER_EDITION = 15; // sec
26 26
     public const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 10; // minutes
27 27
     public const CHECK_EDIT_CONFLICT = true;
28
-    public const ARTICLE_ANALYZED_FILENAME = __DIR__ . '/resources/article_externRef_edited.txt';
28
+    public const ARTICLE_ANALYZED_FILENAME = __DIR__.'/resources/article_externRef_edited.txt';
29 29
     public const SKIP_ADQ = false;
30 30
     public const SKIP_LASTEDIT_BY_BOT = false;
31 31
     public const CITATION_NUMBER_ON_FIRE = 15;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             $result = $this->transformer->process($refContent, $this->summary);
73 73
         } catch (Throwable $e) {
74 74
             echo "** Problème détecté 234242\n";
75
-            $this->log->critical($e->getMessage() . " " . $e->getFile() . ":" . $e->getLine());
75
+            $this->log->critical($e->getMessage()." ".$e->getFile().":".$e->getLine());
76 76
 
77 77
             // TODO : parse $e->message pour traitement, taskName, botflag...
78 78
             return $refContent;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 
85 85
         // Gestion semi-auto : todo CONDITION POURRI FAUSSE $this->transformer->skipUnauthorised
86 86
 
87
-        echo Color::BG_LIGHT_RED . "--" . Color::NORMAL . " " . $refContent . "\n";
88
-        echo Color::BG_LIGHT_GREEN . "++" . Color::NORMAL . " $result \n\n";
87
+        echo Color::BG_LIGHT_RED."--".Color::NORMAL." ".$refContent."\n";
88
+        echo Color::BG_LIGHT_GREEN."++".Color::NORMAL." $result \n\n";
89 89
 
90 90
         if (!$this->autoOrYesConfirmation('Conserver cette modif ?')) {
91 91
             return $refContent;
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         $prefixSummary = ($this->summary->isBotFlag()) ? 'bot ' : '';
117 117
         $suffix = '';
118 118
         if (isset($this->summary->memo['count article'])) {
119
-            $suffix .= ' ' . $this->summary->memo['count article'] . 'x {article}';
119
+            $suffix .= ' '.$this->summary->memo['count article'].'x {article}';
120 120
         }
121 121
         if (isset($this->summary->memo['count lien web'])) {
122
-            $suffix .= ' ' . $this->summary->memo['count lien web'] . 'x {lien web}';
122
+            $suffix .= ' '.$this->summary->memo['count lien web'].'x {lien web}';
123 123
         }
124 124
         if (isset($this->summary->memo['presse'])) {
125 125
             $suffix .= ' 
Please login to merge, or discard this patch.
src/Domain/ExternLink/ExternRefTransformer.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 class ExternRefTransformer implements ExternRefTransformerInterface
34 34
 {
35 35
     public const HTTP_REQUEST_LOOP_DELAY = 10;
36
-    public const LOG_REQUEST_ERROR = __DIR__ . '/../../Application/resources/external_request_error.log'; // todo move
37
-    public const SKIP_DOMAIN_FILENAME = __DIR__ . '/../resources/config_skip_domain.txt';
36
+    public const LOG_REQUEST_ERROR = __DIR__.'/../../Application/resources/external_request_error.log'; // todo move
37
+    public const SKIP_DOMAIN_FILENAME = __DIR__.'/../resources/config_skip_domain.txt';
38 38
     public const REPLACE_404 = true;
39
-    public const CONFIG_PRESSE = __DIR__ . '/../resources/config_presse.yaml';
40
-    public const CONFIG_NEWSPAPER_JSON = __DIR__ . '/../resources/data_newspapers.json';
41
-    public const CONFIG_SCIENTIFIC_JSON = __DIR__ . '/../resources/data_scientific_domain.json';
42
-    public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__ . '/../resources/data_scientific_wiki.json';
39
+    public const CONFIG_PRESSE = __DIR__.'/../resources/config_presse.yaml';
40
+    public const CONFIG_NEWSPAPER_JSON = __DIR__.'/../resources/data_newspapers.json';
41
+    public const CONFIG_SCIENTIFIC_JSON = __DIR__.'/../resources/data_scientific_domain.json';
42
+    public const CONFIG_SCIENTIFIC_WIKI_JSON = __DIR__.'/../resources/data_scientific_wiki.json';
43 43
     public const ROBOT_NOINDEX_WHITELIST = ['legifrance.gouv.fr'];
44 44
 
45 45
     public $skipSiteBlacklisted = true;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $this->url = $url;
149 149
         if (!ExternHttpClient::isHttpURL($url)) {
150
-            $this->log->debug('Skip : not a valid URL : ' . $url);
150
+            $this->log->debug('Skip : not a valid URL : '.$url);
151 151
             return false;
152 152
         }
153 153
 
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
             return false;
156 156
         }
157 157
         if (!ExternHttpClient::isHttpURL($url)) {
158
-            throw new Exception('string is not an URL ' . $url);
158
+            throw new Exception('string is not an URL '.$url);
159 159
         }
160 160
         try {
161 161
             $this->domain = (new InternetDomainParser())->getRegistrableDomainFromURL($url);
162 162
         } catch (Exception $e) {
163
-            $this->log->warning('Skip : not a valid URL : ' . $url);
163
+            $this->log->warning('Skip : not a valid URL : '.$url);
164 164
             return false;
165 165
         }
166 166
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $this->summary->memo['sites'][] = $this->externalPage->getPrettyDomainName();
196 196
         }
197 197
         if (isset($mapData['accès url'])) {
198
-            $this->log->notice('accès 
Please login to merge, or discard this patch.