@@ -21,7 +21,7 @@ discard block |
||
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 | /** @var Rules */ |
27 | 27 | private $rules; |
@@ -55,7 +55,7 @@ discard block |
||
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); |
@@ -35,15 +35,15 @@ |
||
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 | } |
@@ -25,7 +25,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 .= ' |
@@ -60,13 +60,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -37,7 +37,7 @@ |
||
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"; |
@@ -11,5 +11,5 @@ |
||
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 | } |