@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | $auteur1 = $this->ouvrage->getParam('auteur') ?? ''; |
30 | 30 | $auteur1 .= $this->ouvrage->getParam('auteurs') ?? ''; |
31 | 31 | $auteur1 .= $this->ouvrage->getParam('prénom1') ?? ''; |
32 | - $auteur1 .= ' ' . $this->ouvrage->getParam('nom1') ?? ''; |
|
32 | + $auteur1 .= ' '.$this->ouvrage->getParam('nom1') ?? ''; |
|
33 | 33 | $auteur1 = trim($auteur1); |
34 | 34 | // of authors 2 |
35 | 35 | $auteur2 = $this->ouvrage->getParam('auteur2') ?? ''; |
36 | 36 | $auteur2 .= $this->ouvrage->getParam('prénom2') ?? ''; |
37 | - $auteur2 .= ' ' . $this->ouvrage->getParam('nom2') ?? ''; |
|
37 | + $auteur2 .= ' '.$this->ouvrage->getParam('nom2') ?? ''; |
|
38 | 38 | $auteur2 = trim($auteur2); |
39 | 39 | |
40 | 40 | // skip if wikilink in author |
@@ -45,21 +45,21 @@ discard block |
||
45 | 45 | $machine = new PredictAuthors(); |
46 | 46 | $res = $machine->predictAuthorNames($auteur1); |
47 | 47 | |
48 | - if (1 === count((array)$res)) { |
|
48 | + if (1 === count((array) $res)) { |
|
49 | 49 | // auteurs->auteur? |
50 | 50 | return; |
51 | 51 | } |
52 | 52 | // Many authors... and empty "auteur2" |
53 | - if (count((array)$res) >= 2 && empty($auteur2)) { |
|
53 | + if (count((array) $res) >= 2 && empty($auteur2)) { |
|
54 | 54 | // delete author-params |
55 | 55 | array_map( |
56 | - function ($param) { |
|
56 | + function($param) { |
|
57 | 57 | $this->ouvrage->unsetParam($param); |
58 | 58 | }, |
59 | 59 | ['auteur', 'auteurs', 'prénom1', 'nom1'] |
60 | 60 | ); |
61 | 61 | // iterate and edit new values |
62 | - $count = count((array)$res); |
|
62 | + $count = count((array) $res); |
|
63 | 63 | for ($i = 0; $i < $count; ++$i) { |
64 | 64 | $this->ouvrage->setParam(sprintf('auteur%s', $i + 1), $res[$i]); |
65 | 65 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | private function isEditionYear(string $str): bool |
66 | 66 | { |
67 | - return preg_match('#^\d{4}$#', $str) && (int)$str > 1700 && (int)$str < 2025; |
|
67 | + return preg_match('#^\d{4}$#', $str) && (int) $str > 1700 && (int) $str < 2025; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | private function correctReimpressionByParam(string $param): void |
@@ -71,7 +71,7 @@ |
||
71 | 71 | return; |
72 | 72 | } |
73 | 73 | $newTitle = preg_replace( |
74 | - '#[- ]*(vidéo|site de|site|sur) ?' . $siteName . '$#i', |
|
74 | + '#[- ]*(vidéo|site de|site|sur) ?'.$siteName.'$#i', |
|
75 | 75 | '', |
76 | 76 | $this->template->getParam('titre') |
77 | 77 | ); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
59 | - $this->optiStatus->addSummaryLog('++' . $param); |
|
59 | + $this->optiStatus->addSummaryLog('++'.$param); |
|
60 | 60 | $this->optiStatus->setMajor(true); |
61 | 61 | $this->optiStatus->setNotCosmetic(true); |
62 | 62 | } |
@@ -62,10 +62,10 @@ |
||
62 | 62 | */ |
63 | 63 | private function concatParamsAuteur1(OuvrageTemplate $ouvrage, ?int $num = 1): ?string |
64 | 64 | { |
65 | - $auteur = $ouvrage->getParam('auteur' . $num) ?? ''; |
|
66 | - $prenom = $ouvrage->getParam('prénom' . $num) ?? ''; |
|
67 | - $nom = $ouvrage->getParam('nom' . $num) ?? ''; |
|
65 | + $auteur = $ouvrage->getParam('auteur'.$num) ?? ''; |
|
66 | + $prenom = $ouvrage->getParam('prénom'.$num) ?? ''; |
|
67 | + $nom = $ouvrage->getParam('nom'.$num) ?? ''; |
|
68 | 68 | |
69 | - return trim($auteur . ' ' . $prenom . ' ' . $nom); |
|
69 | + return trim($auteur.' '.$prenom.' '.$nom); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 | } |
@@ -48,7 +48,7 @@ |
||
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']; |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 '; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | /** |
41 | 41 | * @param mixed[] $options |
42 | 42 | */ |
43 | - public function __construct(private readonly LoggerInterface $log, private readonly ?array $options = []) |
|
43 | + public function __construct(private readonly LoggerInterface $log, private readonly ? array $options = []) |
|
44 | 44 | { |
45 | 45 | } |
46 | 46 |