Passed
Push — master ( a766ea...cd664b )
by Dispositif
03:23
created
src/Infrastructure/GoogleApiQuota.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $data = $this->getFileData();
51 51
         $this->lastDate = new DateTime($data['date'], new DateTimeZone(static::REBOOT_TIMEZONE));
52
-        $this->count = (int)$data['count'];
52
+        $this->count = (int) $data['count'];
53 53
 
54 54
         // Today reboot date/time of the quota
55 55
         $todayBoot = new DateTime();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         try {
72 72
             $json = file_get_contents(static::JSON_FILENAME);
73
-            $array = (array)json_decode($json, true, 512, JSON_THROW_ON_ERROR);
73
+            $array = (array) json_decode($json, true, 512, JSON_THROW_ON_ERROR);
74 74
         } catch (Throwable) {
75 75
             throw new ConfigException('Error on Google Quota file : reading or JSON malformed.');
76 76
         }
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 (!ExternHttpClient::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.
src/Infrastructure/DbAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     /**
49 49
      * @throws Exception
50 50
      */
51
-    public function insertPageOuvrages(array $datas): bool|array
51
+    public function insertPageOuvrages(array $datas): bool | array
52 52
     {
53 53
         // check if article already in db
54 54
         $page = $datas[0]['page'];
Please login to merge, or discard this patch.
src/Domain/ExternLink/ExternHttpErrorLogic.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 class ExternHttpErrorLogic
16 16
 {
17
-    public const LOG_REQUEST_ERROR = __DIR__ . '/../../Application/resources/external_request_error.log';
17
+    public const LOG_REQUEST_ERROR = __DIR__.'/../../Application/resources/external_request_error.log';
18 18
 
19 19
     public function __construct(private readonly LoggerInterface $log = new NullLogger())
20 20
     {
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
             }
41 41
             return $url;
42 42
         } elseif (preg_match('#401 Unauthorized#i', $errorMessage)) {
43
-            $this->log->notice('401 Unauthorized : skip ' . $url);
43
+            $this->log->notice('401 Unauthorized : skip '.$url);
44 44
 
45 45
             return $url;
46 46
         } else {
47 47
             //  autre : ne pas générer de {lien brisé}, car peut-être 404 temporaire
48
-            $this->log->warning('erreur sur extractWebData ' . $errorMessage);
48
+            $this->log->warning('erreur sur extractWebData '.$errorMessage);
49 49
 
50 50
             //file_put_contents(self::LOG_REQUEST_ERROR, $this->domain."\n", FILE_APPEND);
51 51
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $text = str_replace(['https://', 'http://', 'www.'], '', $url);
74 74
         if (strlen($text) > 30) {
75
-            $text = substr($text, 0, 30) . '…';
75
+            $text = substr($text, 0, 30).'…';
76 76
         }
77 77
 
78 78
         return $text;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     protected function log403(string $url): void
82 82
     {
83
-        $this->log->warning('403 Forbidden : ' . $url);
84
-        file_put_contents(self::LOG_REQUEST_ERROR, '403 Forbidden : ' . $url . "\n", FILE_APPEND);
83
+        $this->log->warning('403 Forbidden : '.$url);
84
+        file_put_contents(self::LOG_REQUEST_ERROR, '403 Forbidden : '.$url."\n", FILE_APPEND);
85 85
     }
86 86
 }
87 87
\ No newline at end of file
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/Domain/ExternLink/ExternPage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     )
55 55
     {
56 56
         if (!ExternHttpClient::isHttpURL($url)) {
57
-            throw new Exception('string is not an URL ' . $url);
57
+            throw new Exception('string is not an URL '.$url);
58 58
         }
59 59
         $this->url = $url;
60 60
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     {
171 171
         try {
172 172
             if (!ExternHttpClient::isHttpURL($this->url)) {
173
-                throw new Exception('string is not an URL ' . $this->url);
173
+                throw new Exception('string is not an URL '.$this->url);
174 174
             }
175 175
             if (!$this->domainParser instanceof InternetDomainParserInterface) {
176 176
                 $this->log->notice('InternetDomainParser is not set');
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             return $this->domainParser->getRegistrableDomainFromURL($this->url);
182 182
         } catch (Exception $e) {
183 183
             if ($this->log !== null) {
184
-                $this->log->warning('InternetDomainParser->getRegistrableDomainFromURL NULL ' . $this->url);
184
+                $this->log->warning('InternetDomainParser->getRegistrableDomainFromURL NULL '.$this->url);
185 185
             }
186 186
             throw new Exception('InternetDomainParser->getRegistrableDomainFromURL NULL', $e->getCode(), $e);
187 187
         }
Please login to merge, or discard this patch.
src/Domain/ExternLink/RobotsRulesTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                 || stripos((string) $robots, 'none') !== false
28 28
             )
29 29
         ) {
30
-            $this->log->notice('robots NOINDEX : ' . $url);
30
+            $this->log->notice('robots NOINDEX : '.$url);
31 31
 
32 32
             return !$this->isNoIndexDomainWhitelisted($pageData['meta']['prettyDomainName']);
33 33
         }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     protected function isNoIndexDomainWhitelisted(?string $prettyDomain): bool
39 39
     {
40 40
         if (in_array($prettyDomain ?? '', $this->noindexWhitelist)) {
41
-            $this->log->notice('ROBOT_NOINDEX_WHITELIST ' . $prettyDomain);
41
+            $this->log->notice('ROBOT_NOINDEX_WHITELIST '.$prettyDomain);
42 42
 
43 43
             return true;
44 44
         }
Please login to merge, or discard this patch.
src/Domain/ExternLink/CheckURL.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $this->url = $url;
50 50
         $this->registrableDomain = null;
51 51
         if (!ExternHttpClient::isHttpURL($url)) {
52
-            $this->log->debug('Skip : not a valid URL : ' . $url);
52
+            $this->log->debug('Skip : not a valid URL : '.$url);
53 53
             return false;
54 54
         }
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             return false;
58 58
         }
59 59
         if (!ExternHttpClient::isHttpURL($url)) {
60
-            throw new Exception('string is not an URL ' . $url);
60
+            throw new Exception('string is not an URL '.$url);
61 61
         }
62 62
 
63 63
         $this->findRegistrableDomain();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         try {
80 80
             $this->registrableDomain = $this->internetDomainParser->getRegistrableDomainFromURL($this->url);
81 81
         } catch (Exception) {
82
-            $this->log->warning('Skip : not a valid URL : ' . $this->url);
82
+            $this->log->warning('Skip : not a valid URL : '.$this->url);
83 83
             return null;
84 84
         }
85 85
         return $this->registrableDomain;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     protected function hasForbiddenFilenameExtension(): bool
94 94
     {
95
-        return (bool)preg_match(
95
+        return (bool) preg_match(
96 96
             '#\.(pdf|jpg|jpeg|gif|png|xls|xlsx|xlr|xml|xlt|txt|csv|js|docx|exe|gz|zip|ini|movie|mp3|mp4|ogg|raw|rss|tar|tgz|wma)$#i',
97 97
             $this->url
98 98
         );
Please login to merge, or discard this patch.
src/Domain/Predict/TypoTokenizer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         // PUNCTUATION conversion
50 50
         $punctuationColl = array_filter(
51 51
             TextUtil::ALL_PUNCTUATION,
52
-            function ($value) {
52
+            function($value) {
53 53
                 // skip punctuation chars from mixed names (example : "Pierre-Marie L'Anglois")
54 54
                 return !in_array($value, ["'", '-', '-']);
55 55
             }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             }
69 69
             if (preg_match('#^(PATTERNINITIAL|PATTERNURL|PATTERNAND|PATTERNCOMMA|PATTERNBIBABREV|PATTERNPUNCTUATION)$#', (string) $tok, $matches) > 0) {
70 70
 
71
-                $shortpattern = str_replace('PATTERN','', (string) $tok);
71
+                $shortpattern = str_replace('PATTERN', '', (string) $tok);
72 72
                 $res['pattern'] .= ' '.$shortpattern; // PATTERNAND -> AND
73 73
                 if (in_array($matches[1], ['PATTERNCOMMA', 'PATTERNPUNCTUATION']) || empty($matches[1])) {
74 74
                     $res['value'][] = '*';
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         return preg_replace_callback_array(
124 124
             [
125 125
                 // URL
126
-                '#\bhttps?://[^ \]]+#i' => function ($match): string {
126
+                '#\bhttps?://[^ \]]+#i' => function($match): string {
127 127
                     // '#https?\:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+\#]*[\w\-\@?^=%&/~\+#])?#'
128 128
                     $this->tokenValue['URL'][] = $match[0];
129 129
 
@@ -131,26 +131,26 @@  discard block
 block discarded – undo
131 131
                 },
132 132
                 // BIBABREV : "dir.", "trad.", "(dir.)", "[dir.]", etc.
133 133
                 // TODO: regex flaw : "(" not evaluated in BIBABREV. Example : "(dir.)"
134
-                '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function ($match): string {
134
+                '#\b[(\[]?(collectif|coll\.|dir\.|trad\.|coord\.|ill\.)[)\]]?#i' => function($match): string {
135 135
                     $this->tokenValue['BIBABREV'][] = $match[0]; // [1] = dir
136 136
 
137 137
                     return ' PATTERNBIBABREV ';
138 138
                 },
139 139
                 // AND
140
-                '# (et|and|&|with|avec|e) #i' => function ($match): string {
140
+                '# (et|and|&|with|avec|e) #i' => function($match): string {
141 141
                     $this->tokenValue['AND'][] = $match[0];
142 142
 
143 143
                     return ' PATTERNAND ';
144 144
                 },
145 145
                 // COMMA
146
-                '#,#' => function (): string {
146
+                '#,#' => function(): string {
147 147
                     return ' PATTERNCOMMA ';
148 148
                 },
149 149
                 // INITIAL : 2) convert letter ("A.") or junior ("Jr.") or senior ("Sr.")
150 150
                 // extract initial before "." converted in PUNCTUATION
151 151
                 // Note : \b word boundary match between "L" and "'Amour" in "L'Amour"  (for [A-Z]\b)
152 152
                 // \b([A-Z]\. |[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)+ for grouping "A. B." in same INITIAL ?
153
-                "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function ($match): string {
153
+                "#\b([A-Z]\.|[A-Z] |JR|Jr\.|Jr\b|Sr\.|Sr\b)#" => function($match): string {
154 154
                     $this->tokenValue['INITIAL'][] = $match[0];
155 155
 
156 156
                     return ' PATTERNINITIAL ';
Please login to merge, or discard this patch.