Completed
Push — master ( 511693...0349ad )
by Dispositif
04:19
created
src/Domain/OuvrageOptimize.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         if (count($res) >= 2 && empty($auteur2)) {
163 163
             // delete author-params
164 164
             array_map(
165
-                function ($param) {
165
+                function($param) {
166 166
                     $this->unsetParam($param);
167 167
                 },
168 168
                 ['auteur', 'auteurs', 'prénom1', 'nom1']
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
         // todo detect duplication ouvrage/plume dans externalTemplate ?
600 600
         if (!empty($this->getParam('plume'))) {
601 601
             $plumeValue = $this->getParam('plume');
602
-            $this->ouvrage->externalTemplates[] = (object)[
602
+            $this->ouvrage->externalTemplates[] = (object) [
603 603
                 'template' => 'plume',
604 604
                 '1' => $plumeValue,
605 605
                 'raw' => '{{nobr|. {{plume}}}}',
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
             // todo bug {{citation bloc}} si "=" ou "|" dans texte de citation
615 615
             // Legacy : use {{début citation}} ... {{fin citation}}
616 616
             if (preg_match('#[=|]#', $extrait) > 0) {
617
-                $this->ouvrage->externalTemplates[] = (object)[
617
+                $this->ouvrage->externalTemplates[] = (object) [
618 618
                     'template' => 'début citation',
619 619
                     '1' => '',
620 620
                     'raw' => '{{début citation}}'.$extrait.'{{fin citation}}',
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                 $this->notCosmetic = true;
624 624
             } else {
625 625
                 // StdClass
626
-                $this->ouvrage->externalTemplates[] = (object)[
626
+                $this->ouvrage->externalTemplates[] = (object) [
627 627
                     'template' => 'citation bloc',
628 628
                     '1' => $extrait,
629 629
                     'raw' => '{{extrait|'.$extrait.'}}',
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
         // "commentaire=bla" => {{Commentaire biblio|1=bla}}
640 640
         if (!empty($this->getParam('commentaire'))) {
641 641
             $commentaire = $this->getParam('commentaire');
642
-            $this->ouvrage->externalTemplates[] = (object)[
642
+            $this->ouvrage->externalTemplates[] = (object) [
643 643
                 'template' => 'commentaire biblio',
644 644
                 '1' => $commentaire,
645 645
                 'raw' => '{{commentaire biblio|'.$commentaire.'}}',
Please login to merge, or discard this patch.
src/Domain/Publisher/BnfMapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Infrastructure/DbAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
 
152 152
             // No page to edit
153 153
             $rows = $pageInfo->fetchAll();
154
-            if(empty($rows)){
154
+            if (empty($rows)) {
155 155
                 return "[]";
156 156
             }
157 157
 
Please login to merge, or discard this patch.
src/Application/WikiPageAction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function getRedirect(): ?string
114 114
     {
115 115
         if ($this->getText() && preg_match('/^#REDIRECT(?:ION)? ?\[\[([^]]+)]]/i', $this->getText(), $matches)) {
116
-            return (string)trim($matches[1]);
116
+            return (string) trim($matches[1]);
117 117
         }
118 118
 
119 119
         return null;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @return bool
148 148
      * @throws Exception
149 149
      */
150
-    public function createPage(string $text, ?EditInfo $editInfo=null): bool
150
+    public function createPage(string $text, ?EditInfo $editInfo = null): bool
151 151
     {
152 152
         if (!empty($this->page->getRevisions()->getLatest())) {
153 153
             throw new \Exception('That page already exists');
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         ) {
229 229
             foreach ($matches[0] as $num => $mention) {
230 230
                 $lang = $matches['lang'][$num] ?? '';
231
-                if(!empty($lang)){
231
+                if (!empty($lang)) {
232 232
                     $lang = Language::all2wiki($lang);
233 233
                 }
234 234
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $parser = new TagParser(); // todo ParserFactory
291 291
         $refs = $parser->importHtml($text)->getRefValues(); // []
292 292
 
293
-        return (array)$refs;
293
+        return (array) $refs;
294 294
     }
295 295
 
296 296
     /**
Please login to merge, or discard this patch.
src/Application/Examples/EditProcess.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -169,17 +169,17 @@
 block discarded – undo
169 169
 
170 170
         pageEdit:
171 171
 
172
-        try{
172
+        try {
173 173
             $editInfo = new EditInfo($miniSummary, $this->minorFlag, $this->botFlag);
174 174
             $success = $page->editPage(Normalizer::normalize($this->wikiText), $editInfo);
175
-        }catch (\Throwable $e){
175
+        } catch (\Throwable $e) {
176 176
             // Invalid CSRF token.
177
-            if(strpos($e->getMessage(), 'Invalid CSRF token') !== false ) {
177
+            if (strpos($e->getMessage(), 'Invalid CSRF token') !== false) {
178 178
                 echo "*** Invalid CSRF token \n";
179 179
                 sleep(60);
180 180
                 $this->wikiLogin();
181 181
                 goto pageEdit;
182
-            }else{
182
+            } else {
183 183
                 dump($e); // todo log
184 184
                 sleep(60);
185 185
                 return false;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,14 +172,14 @@
 block discarded – undo
172 172
         try{
173 173
             $editInfo = new EditInfo($miniSummary, $this->minorFlag, $this->botFlag);
174 174
             $success = $page->editPage(Normalizer::normalize($this->wikiText), $editInfo);
175
-        }catch (\Throwable $e){
175
+        } catch (\Throwable $e){
176 176
             // Invalid CSRF token.
177 177
             if(strpos($e->getMessage(), 'Invalid CSRF token') !== false ) {
178 178
                 echo "*** Invalid CSRF token \n";
179 179
                 sleep(60);
180 180
                 $this->wikiLogin();
181 181
                 goto pageEdit;
182
-            }else{
182
+            } else{
183 183
                 dump($e); // todo log
184 184
                 sleep(60);
185 185
                 return false;
Please login to merge, or discard this patch.