@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | $data = []; |
33 | 33 | |
34 | 34 | $monitor = $db->fetchRow('select count(id) from page_ouvrages 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 page_ouvrages 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 page_ouvrages 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 page_ouvrages 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 page_ouvrages 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 page_ouvrages 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 page_ouvrages 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 page_ouvrages 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 | ); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | wiki; |
120 | 120 | |
121 | 121 | $wikiText = str_replace('#monitor#', $monitWiki, $wikiText); |
122 | -foreach($data as $key => $dat){ |
|
122 | +foreach ($data as $key => $dat) { |
|
123 | 123 | $wikiText = str_replace('#'.$key.'#', $dat, $wikiText); |
124 | 124 | } |
125 | 125 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | sleep(60 * 60 * 3); |
37 | 37 | echo "Wake up\n"; |
38 | 38 | } |
39 | - if(strpos($e->getMessage(), 'Quota Google') !== false){ |
|
39 | + if (strpos($e->getMessage(), 'Quota Google') !== false) { |
|
40 | 40 | echo "Google Quota dépassé : sleep 6h\n"; |
41 | 41 | sleep(60 * 60 * 6); |
42 | 42 | echo "Wake up\n"; |
@@ -50,5 +50,5 @@ discard block |
||
50 | 50 | } |
51 | 51 | unset($process); |
52 | 52 | echo "Sleep 10 min\n"; |
53 | - sleep(60*10); |
|
53 | + sleep(60 * 10); |
|
54 | 54 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @var AbstractWikiTemplate |
55 | 55 | */ |
56 | - try{ |
|
56 | + try { |
|
57 | 57 | $tplObject = WikiTemplateFactory::create($tplName); |
58 | - }catch (Throwable $e){ |
|
58 | + } catch (Throwable $e) { |
|
59 | 59 | unset($e); |
60 | 60 | continue; |
61 | 61 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ) { |
191 | 191 | array_walk( |
192 | 192 | $matches, |
193 | - function (&$value) { |
|
193 | + function(&$value) { |
|
194 | 194 | $value = str_replace(['CURLYBRACKETO', 'CURLYBRACKETC'], ['{', '}'], $value); |
195 | 195 | } |
196 | 196 | ); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | try{ |
57 | 57 | $tplObject = WikiTemplateFactory::create($tplName); |
58 | - }catch (Throwable $e){ |
|
58 | + } catch (Throwable $e){ |
|
59 | 59 | unset($e); |
60 | 60 | continue; |
61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $editInfo = new EditInfo(static::BOT_TALK_SUMMARY); |
64 | 64 | $success = $page->addToBottomOfThePage($addText, $editInfo); |
65 | 65 | |
66 | - return (bool)$success; |
|
66 | + return (bool) $success; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | throw new ConfigException('Pas de phrases disponibles pour TalkBot'); |
132 | 132 | } |
133 | 133 | |
134 | - return (string)trim($sentences[array_rand($sentences)]); |
|
134 | + return (string) trim($sentences[array_rand($sentences)]); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function hasWarning(): bool |
25 | 25 | { |
26 | - return (bool)$this->warning; |
|
26 | + return (bool) $this->warning; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->xml = $xml; |
41 | 41 | |
42 | 42 | // skip multi-records |
43 | - $nbResults = (int)$xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
43 | + $nbResults = (int) $xml->xpath('//srw:numberOfRecords[1]')[0] ?? 0; |
|
44 | 44 | if (1 !== $nbResults) { |
45 | 45 | echo "BNF : $nbResults records (skip)\n"; |
46 | 46 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $res = []; |
124 | 124 | foreach ($elements as $element) { |
125 | 125 | if (isset($element) && $element instanceof SimpleXMLElement) { |
126 | - $res[] = (string)$element; |
|
126 | + $res[] = (string) $element; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | $raw = $this->xpath2string('//mxc:datafield[@tag="215"]/mxc:subfield[@code="a"]'); |
193 | 193 | if (!empty($raw) && preg_match('#([0-9]{2,}) p\.#', $raw, $matches) > 0) { |
194 | - return (string)$matches[1]; |
|
194 | + return (string) $matches[1]; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return null; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $data = $mapper->process($page->getData()); |
32 | 32 | |
33 | 33 | if (isset($data['consulté le'])) { |
34 | - $data['consulté le'] = '11-04-2020';// unit testing date... |
|
34 | + $data['consulté le'] = '11-04-2020'; // unit testing date... |
|
35 | 35 | } |
36 | 36 | $this::assertSame($expected, $data); |
37 | 37 | } |
@@ -194,7 +194,7 @@ |
||
194 | 194 | return null; |
195 | 195 | } |
196 | 196 | $str = str_replace([''',''', ''', "\n", " ", "|", "é"], ["'","'", "'", '', ' ', '/', |
197 | - "é"], $str); |
|
197 | + "é"], $str); |
|
198 | 198 | |
199 | 199 | return html_entity_decode($str); |
200 | 200 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $page .= '–'.$meta['citation_lastpage']; |
182 | 182 | } |
183 | 183 | |
184 | - return (string)$page; |
|
184 | + return (string) $page; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return null; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($str === null) { |
194 | 194 | return null; |
195 | 195 | } |
196 | - $str = str_replace([''',''', ''', "\n", " ", "|", "é"], ["'","'", "'", '', ' ', '/', |
|
196 | + $str = str_replace([''', ''', ''', "\n", " ", "|", "é"], ["'", "'", "'", '', ' ', '/', |
|
197 | 197 | "é"], $str); |
198 | 198 | |
199 | 199 | return html_entity_decode($str); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | class AbstractWikiTemplateTest extends TestCase |
18 | 18 | { |
19 | - public function testIsValidForEdit(){ |
|
19 | + public function testIsValidForEdit() { |
|
20 | 20 | $article = WikiTemplateFactory::create('article'); |
21 | 21 | $article->hydrate( |
22 | 22 | [ |