@@ -19,7 +19,7 @@ |
||
19 | 19 | const MODEL_NAME = 'lien web'; |
20 | 20 | |
21 | 21 | const REQUIRED_PARAMETERS |
22 | - = [ |
|
22 | + = [ |
|
23 | 23 | // 'langue' => '', // suggéré |
24 | 24 | // 'auteur1' => '', // suggéré |
25 | 25 | 'titre' => '', // required |
@@ -53,7 +53,7 @@ |
||
53 | 53 | ['{{Ouvrage |
54 | 54 | | langue=fr |
55 | 55 | }}', |
56 | - "\n | ", |
|
56 | + "\n | ", |
|
57 | 57 | ], |
58 | 58 | ]; |
59 | 59 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'titre' => $volume->title, |
41 | 41 | 'sous-titre' => $this->filterSubtitle($volume), |
42 | 42 | 'année' => $this->convertDate2Year($volume->publishedDate), |
43 | - 'pages totales' => (string)$volume->pageCount ?? null, |
|
43 | + 'pages totales' => (string) $volume->pageCount ?? null, |
|
44 | 44 | 'isbn' => $this->convertIsbn($volume), |
45 | 45 | 'présentation en ligne' => $this->presentationEnLigne($volume), |
46 | 46 | 'lire en ligne' => $this->lireEnLigne($volume), |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return null; |
74 | 74 | } |
75 | 75 | if (preg_match('/[^0-9]?([12][0-9]{3})[^0-9]?/', $data, $matches) > 0) { |
76 | - return (string)$matches[1]; |
|
76 | + return (string) $matches[1]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return null; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | // so isbn-13 replace isbn-10 |
93 | 93 | // todo refac algo (if 2x isbn13?) |
94 | 94 | $isbn = null; |
95 | - $ids = (array)$volume->industryIdentifiers; |
|
95 | + $ids = (array) $volume->industryIdentifiers; |
|
96 | 96 | foreach ($ids as $id) { |
97 | 97 | if (!isset($isbn) && in_array($id->type, ['ISBN_10', 'ISBN_13'])) { |
98 | 98 | $isbn = $id->identifier; |
@@ -76,7 +76,7 @@ |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | // note : multi-records filtered in BnFMapper |
79 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
79 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
80 | 80 | if (0 === $nbResults) { |
81 | 81 | return null; |
82 | 82 | } |
@@ -23,9 +23,9 @@ |
||
23 | 23 | if (200 !== $response->getStatusCode()) { |
24 | 24 | die('not 200 response'); |
25 | 25 | } |
26 | -try{ |
|
26 | +try { |
|
27 | 27 | $newText = $response->getBody()->getContents(); |
28 | -}catch (Throwable $e){ |
|
28 | +} catch (Throwable $e) { |
|
29 | 29 | dump($e); |
30 | 30 | die; |
31 | 31 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | } |
26 | 26 | try{ |
27 | 27 | $newText = $response->getBody()->getContents(); |
28 | -}catch (Throwable $e){ |
|
28 | +} catch (Throwable $e){ |
|
29 | 29 | dump($e); |
30 | 30 | die; |
31 | 31 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->xml = $xml; |
42 | 42 | |
43 | 43 | // skip multi-records |
44 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
44 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
45 | 45 | if (1 !== $nbResults) { |
46 | 46 | echo "BNF : $nbResults records (skip)\n"; |
47 | 47 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $res = []; |
102 | 102 | foreach ($elements as $element) { |
103 | 103 | if (isset($element) && $element instanceof SimpleXMLElement) { |
104 | - $res[] = (string)$element; |
|
104 | + $res[] = (string) $element; |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $raw = $this->xpath2string('//mxc:datafield[@tag="215"]/mxc:subfield[@code="a"]'); |
124 | 124 | if (!empty($raw) && preg_match('#([0-9]{2,}) p\.#', $raw, $matches) > 0) { |
125 | - return (string)$matches[1]; |
|
125 | + return (string) $matches[1]; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | return null; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $raw = $this->xpath2string('//srw:recordIdentifier[1]/text()'); |
206 | 206 | |
207 | 207 | if ($raw && preg_match('#ark:/[0-9]+/cb([0-9]+)#', $raw, $matches) > 0) { |
208 | - return (string)$matches[1]; |
|
208 | + return (string) $matches[1]; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | return null; |
@@ -221,7 +221,7 @@ |
||
221 | 221 | */ |
222 | 222 | public function minutesSinceLastEdit(string $title): int |
223 | 223 | { |
224 | - $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
224 | + $time = $this->getTimestamp($title); // 2011-09-02T16:31:13Z |
|
225 | 225 | |
226 | 226 | return (int) round((time() - strtotime($time)) / 60); |
227 | 227 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public function getRedirect(): ?string |
124 | 124 | { |
125 | 125 | if ($this->getText() && preg_match('/^#REDIRECT(?:ION)? ?\[\[([^]]+)]]/i', $this->getText(), $matches)) { |
126 | - return (string)trim($matches[1]); |
|
126 | + return (string) trim($matches[1]); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return null; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $parser = new TagParser(); // todo ParserFactory |
302 | 302 | $refs = $parser->importHtml($text)->getRefValues(); // [] |
303 | 303 | |
304 | - return (array)$refs; |
|
304 | + return (array) $refs; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | $data = []; |
33 | 33 | |
34 | 34 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate is null and edited is null'); |
35 | -$data['not analyzed citation'] = (int)$monitor['count(id)']; |
|
35 | +$data['not analyzed citation'] = (int) $monitor['count(id)']; |
|
36 | 36 | |
37 | 37 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate is not null'); |
38 | -$data['analyzed citation'] = (int)$monitor['count(id)']; |
|
38 | +$data['analyzed citation'] = (int) $monitor['count(id)']; |
|
39 | 39 | |
40 | 40 | $monitor = $db->fetchRow('select count(distinct page) as n from temprawopti where skip=1 and edited is null'); |
41 | -$data['skip pages'] = (int)$monitor['n']; |
|
41 | +$data['skip pages'] = (int) $monitor['n']; |
|
42 | 42 | |
43 | 43 | $monitor = $db->fetchRow('select count(distinct page) as n from temprawopti where edited is true'); |
44 | -$data['edited pages'] = (int)$monitor['n']; |
|
44 | +$data['edited pages'] = (int) $monitor['n']; |
|
45 | 45 | |
46 | 46 | $monitor = $db->fetchRow('select count(id) from temprawopti where optidate > SUBDATE(NOW(),1)'); |
47 | -$data['analyzed citation 24H'] = (int)$monitor['count(id)']; |
|
47 | +$data['analyzed citation 24H'] = (int) $monitor['count(id)']; |
|
48 | 48 | |
49 | 49 | $monitor = $db->fetchRow('select count(id) as n from temprawopti where edited > SUBDATE(NOW(),1)'); |
50 | -$data['edited citations 24H'] = (int)$monitor['n']; |
|
50 | +$data['edited citations 24H'] = (int) $monitor['n']; |
|
51 | 51 | |
52 | 52 | $monitor = $db->fetchRow('select count(distinct page) as n from temprawopti where edited > SUBDATE(NOW(),1)'); |
53 | -$data['edited pages 24H'] = (int)$monitor['n']; |
|
53 | +$data['edited pages 24H'] = (int) $monitor['n']; |
|
54 | 54 | |
55 | 55 | $monitor = $db->fetchRow('SELECT count(distinct A.page) FROM TempRawOpti A |
56 | 56 | WHERE notcosmetic=1. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ) |
66 | 66 | AND A.page = B.page |
67 | 67 | )'); |
68 | -$data['waiting pages'] = (int)$monitor['count(distinct A.page)']; |
|
68 | +$data['waiting pages'] = (int) $monitor['count(distinct A.page)']; |
|
69 | 69 | |
70 | 70 | $data['currentdate'] = DateUtil::dateEnglish2french((new DateTime())->format('j F Y \à H\:i').' (CEST)'); |
71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | $monitWiki = ''; |
78 | -if(!empty($monitor)) { |
|
78 | +if (!empty($monitor)) { |
|
79 | 79 | foreach ($monitor as $monit) { |
80 | 80 | // % = "%" |
81 | 81 | $edited = new DateTime($monit['edited']); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | "<tr><td>%s %</td><td>%s</td><td>[https://fr.wikipedia.org/w/index.php?title=%s&action=history histo]</td><td>[[%s]]</td><td>%s</td></tr>\n", |
84 | 84 | $monit['altered'] ?? '?', |
85 | 85 | $edited->format('d-m-Y'), |
86 | - str_replace(' ','_', $monit['page']), |
|
86 | + str_replace(' ', '_', $monit['page']), |
|
87 | 87 | $monit['page'] ?? '??', |
88 | 88 | $monit['version'] |
89 | 89 | ); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | wiki; |
123 | 123 | |
124 | 124 | $wikiText = str_replace('#monitor#', $monitWiki, $wikiText); |
125 | -foreach($data as $key => $dat){ |
|
125 | +foreach ($data as $key => $dat) { |
|
126 | 126 | $wikiText = str_replace('#'.$key.'#', $dat, $wikiText); |
127 | 127 | } |
128 | 128 |