Passed
Push — master ( 9ad278...1bcf8b )
by Dispositif
08:55
created
src/Infrastructure/PageList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
             }
59 59
         }
60 60
 
61
-        return new PageList((array)$titles);
61
+        return new PageList((array) $titles);
62 62
     }
63 63
 
64 64
     /**
Please login to merge, or discard this patch.
src/Application/AbstractBotTaskWorker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
 abstract class AbstractBotTaskWorker
25 25
 {
26
-    const TASK_BOT_FLAG               = false;
26
+    const TASK_BOT_FLAG = false;
27 27
     const SLEEP_AFTER_EDITION                 = 60;
28 28
     const MINUTES_DELAY_AFTER_LAST_HUMAN_EDIT = 15;
29 29
     const CHECK_EDIT_CONFLICT                 = true;
30
-    const ARTICLE_ANALYZED_FILENAME   = __DIR__.'/resources/article_edited.txt';
30
+    const ARTICLE_ANALYZED_FILENAME = __DIR__.'/resources/article_edited.txt';
31 31
     const SKIP_LASTEDIT_BY_BOT       = true;
32 32
     const SKIP_NOT_IN_MAIN_WIKISPACE = true;
33 33
 
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
         $this->defaultTaskname = $bot->taskName;
86 86
 
87 87
         $analyzed = @file(static::ARTICLE_ANALYZED_FILENAME, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
88
-        $this->pastAnalyzed = ($analyzed !== false ) ? $analyzed : [];
88
+        $this->pastAnalyzed = ($analyzed !== false) ? $analyzed : [];
89 89
 
90 90
         // @throw exception on "Invalid CSRF token"
91
-        $this->run();//todo delete that and use (Worker)->run($duration) or process management
91
+        $this->run(); //todo delete that and use (Worker)->run($duration) or process management
92 92
     }
93 93
 
94 94
     protected function setUpInConstructor(): void
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
     protected function titleProcess(string $title): void
133 133
     {
134 134
         echo "---------------------\n";
135
-        echo date('d-m-Y H:i'). ' '. Color::BG_CYAN."  $title ".Color::NORMAL."\n";
135
+        echo date('d-m-Y H:i').' '.Color::BG_CYAN."  $title ".Color::NORMAL."\n";
136 136
         sleep(1);
137 137
 
138
-        if(in_array($title, $this->pastAnalyzed)) {
138
+        if (in_array($title, $this->pastAnalyzed)) {
139 139
             echo "Skip : déjà analysé\n";
140 140
             return;
141 141
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         $this->titleBotFlag = static::TASK_BOT_FLAG;
145 145
 
146 146
         $text = $this->getText($title);
147
-        if( static::SKIP_LASTEDIT_BY_BOT && $this->pageAction->getLastEditor() === getenv('BOT_NAME') ) {
147
+        if (static::SKIP_LASTEDIT_BY_BOT && $this->pageAction->getLastEditor() === getenv('BOT_NAME')) {
148 148
             echo "Skip : déjà édité par le bot\n";
149 149
             return;
150 150
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         }
260 260
 
261 261
         dump($result);
262
-        echo "Sleep ".(string)static::SLEEP_AFTER_EDITION."\n";
262
+        echo "Sleep ".(string) static::SLEEP_AFTER_EDITION."\n";
263 263
         sleep(static::SLEEP_AFTER_EDITION);
264 264
     }
265 265
 
Please login to merge, or discard this patch.
src/Application/OuvrageEditWorker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     const EDIT_SIGNALEMENT = true;
40 40
 
41
-    const CITATION_LIMIT         = 150;
41
+    const CITATION_LIMIT = 150;
42 42
     const DELAY_BOTFLAG_SECONDS    = 20;
43 43
     const DELAY_NO_BOTFLAG_SECONDS = 50;
44 44
     const ERROR_MSG_TEMPLATE       = __DIR__.'/templates/message_errors.wiki';
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         }
129 129
 
130 130
         // Page supprimée ?
131
-        if($page->getLastRevision() === null) {
131
+        if ($page->getLastRevision() === null) {
132 132
             $this->log->warning("SKIP : page supprimée !\n");
133 133
             $this->db->deleteArticle($title);
134 134
 
Please login to merge, or discard this patch.
src/Application/Examples/botstats.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,25 +33,25 @@  discard block
 block discarded – undo
33 33
 $data = [];
34 34
 
35 35
 $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is null and edited is null');
36
-$data['not analyzed citation'] = (int)$monitor['count(id)'];
36
+$data['not analyzed citation'] = (int) $monitor['count(id)'];
37 37
 
38 38
 $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate is not null');
39
-$data['analyzed citation'] = (int)$monitor['count(id)'];
39
+$data['analyzed citation'] = (int) $monitor['count(id)'];
40 40
 
41 41
 $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where skip=1 and edited is null'); //  ?
42
-$data['skip pages'] = (int)$monitor['n'];
42
+$data['skip pages'] = (int) $monitor['n'];
43 43
 
44 44
 $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where edited is true');
45
-$data['edited pages'] = (int)$monitor['n'];
45
+$data['edited pages'] = (int) $monitor['n'];
46 46
 
47 47
 $monitor = $db->fetchRow('select count(id) from page_ouvrages where optidate > SUBDATE(NOW(),1)');
48
-$data['analyzed citation 24H'] = (int)$monitor['count(id)'];
48
+$data['analyzed citation 24H'] = (int) $monitor['count(id)'];
49 49
 
50 50
 $monitor = $db->fetchRow('select count(id) as n from page_ouvrages where edited > SUBDATE(NOW(),1)');
51
-$data['edited citations 24H'] = (int)$monitor['n'];
51
+$data['edited citations 24H'] = (int) $monitor['n'];
52 52
 
53 53
 $monitor = $db->fetchRow('select count(distinct page) as n from page_ouvrages where edited > SUBDATE(NOW(),1)');
54
-$data['edited pages 24H'] = (int)$monitor['n'];
54
+$data['edited pages 24H'] = (int) $monitor['n'];
55 55
 
56 56
 $monitor = $db->fetchRow('SELECT count(distinct A.page) FROM page_ouvrages A
57 57
                 WHERE A.notcosmetic=1 AND A.opti IS NOT NULL
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                         )
69 69
                     AND A.page = B.page
70 70
                     )');
71
-$data['waiting pages'] = (int)$monitor['count(distinct A.page)'];
71
+$data['waiting pages'] = (int) $monitor['count(distinct A.page)'];
72 72
 
73 73
 $data['currentdate'] = DateUtil::dateEnglish2french((new DateTime())->format('j F Y \à H\:i').' (CEST)');
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 $monitWiki = '';
81
-if(!empty($monitor)) {
81
+if (!empty($monitor)) {
82 82
     foreach ($monitor as $monit) {
83 83
         // % = "%"
84 84
         $edited = new DateTime($monit['edited']);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             "<tr><td>%s &#37;</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",
87 87
             $monit['altered'] ?? '?',
88 88
             $edited->format('d-m-Y'),
89
-            str_replace(' ','_', $monit['page']),
89
+            str_replace(' ', '_', $monit['page']),
90 90
             $monit['page'] ?? '??',
91 91
             $monit['version']
92 92
         );
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 wiki;
124 124
 
125 125
 $wikiText = str_replace('#monitor#', $monitWiki, $wikiText);
126
-foreach($data as $key => $dat){
126
+foreach ($data as $key => $dat) {
127 127
     $wikiText = str_replace('#'.$key.'#', $dat, $wikiText);
128 128
 }
129 129
 
Please login to merge, or discard this patch.