@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Task; |
| 4 | 4 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @inheritDoc |
| 15 | 15 | */ |
| 16 | - public function run() : TaskResult { |
|
| 16 | + public function run () : TaskResult { |
|
| 17 | 17 | $this->getLogger()->info( 'Starting task ClosePages' ); |
| 18 | 18 | |
| 19 | 19 | $pages = $this->getPagesList(); |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return PageRiconferma[] |
| 45 | 45 | */ |
| 46 | - protected function getPagesList() : array { |
|
| 46 | + protected function getPagesList () : array { |
|
| 47 | 47 | $allPages = $this->getDataProvider()->getOpenPages(); |
| 48 | - $ret = []; |
|
| 48 | + $ret = [ ]; |
|
| 49 | 49 | foreach ( $allPages as $page ) { |
| 50 | 50 | if ( time() > $page->getEndTimestamp() ) { |
| 51 | - $ret[] = $page; |
|
| 51 | + $ret[ ] = $page; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | return $ret; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @param PageRiconferma $page |
| 59 | 59 | */ |
| 60 | - protected function addVoteCloseText( PageRiconferma $page ) { |
|
| 60 | + protected function addVoteCloseText ( PageRiconferma $page ) { |
|
| 61 | 61 | $content = $page->getContent(); |
| 62 | 62 | $beforeReg = '!è necessario ottenere una maggioranza .+ votanti\.!'; |
| 63 | 63 | $newContent = preg_replace( $beforeReg, '$0' . "\n" . $page->getOutcomeText(), $content ); |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | * @param PageRiconferma[] $pages |
| 76 | 76 | * @see UpdatesAround::addToMainPage() |
| 77 | 77 | */ |
| 78 | - protected function removeFromMainPage( array $pages ) { |
|
| 78 | + protected function removeFromMainPage ( array $pages ) { |
|
| 79 | 79 | $this->getLogger()->info( |
| 80 | 80 | 'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | $mainPage = $this->getConfig()->get( 'ric-main-page' ); |
| 84 | 84 | $content = $this->getController()->getPageContent( $mainPage ); |
| 85 | - $translations = []; |
|
| 85 | + $translations = [ ]; |
|
| 86 | 86 | foreach ( $pages as $page ) { |
| 87 | 87 | $translations[ '{{' . $page->getTitle() . '}}' ] = ''; |
| 88 | 88 | } |
@@ -100,17 +100,17 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param PageRiconferma[] $pages |
| 102 | 102 | */ |
| 103 | - protected function addToArchive( array $pages ) { |
|
| 103 | + protected function addToArchive ( array $pages ) { |
|
| 104 | 104 | $this->getLogger()->info( |
| 105 | 105 | 'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $simple = $votes = []; |
|
| 108 | + $simple = $votes = [ ]; |
|
| 109 | 109 | foreach ( $pages as $page ) { |
| 110 | 110 | if ( $page->isVote() ) { |
| 111 | - $votes[] = $page; |
|
| 111 | + $votes[ ] = $page; |
|
| 112 | 112 | } else { |
| 113 | - $simple[] = $page; |
|
| 113 | + $simple[ ] = $page; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -127,21 +127,21 @@ discard block |
||
| 127 | 127 | * @param string $archiveTitle |
| 128 | 128 | * @param array $pages |
| 129 | 129 | */ |
| 130 | - private function reallyAddToArchive( string $archiveTitle, array $pages ) { |
|
| 130 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ) { |
|
| 131 | 131 | $curTitle = "$archiveTitle/" . date( 'Y' ); |
| 132 | 132 | |
| 133 | 133 | $append = ''; |
| 134 | - $archivedList = []; |
|
| 134 | + $archivedList = [ ]; |
|
| 135 | 135 | foreach ( $pages as $page ) { |
| 136 | 136 | $append .= '{{' . $page->getTitle() . "}}\n"; |
| 137 | - $archivedList[] = $page->getUserNum(); |
|
| 137 | + $archivedList[ ] = $page->getUserNum(); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if ( count( $archivedList ) > 1 ) { |
| 141 | 141 | $last = array_pop( $archivedList ); |
| 142 | 142 | $userNums = implode( ', ', $archivedList ) . " e $last"; |
| 143 | 143 | } else { |
| 144 | - $userNums = $archivedList[0]; |
|
| 144 | + $userNums = $archivedList[ 0 ]; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $summary = strtr( |
@@ -162,14 +162,13 @@ discard block |
||
| 162 | 162 | * @param PageRiconferma $page |
| 163 | 163 | * @see CreatePages::updateBasePage() |
| 164 | 164 | */ |
| 165 | - protected function updateBasePage( PageRiconferma $page ) { |
|
| 165 | + protected function updateBasePage ( PageRiconferma $page ) { |
|
| 166 | 166 | $this->getLogger()->info( "Updating base page for $page" ); |
| 167 | 167 | |
| 168 | 168 | $current = $this->getController()->getPageContent( $page->getBaseTitle() ); |
| 169 | 169 | |
| 170 | 170 | $outcomeText = $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ? |
| 171 | - 'non riconfermato' : |
|
| 172 | - 'riconfermato'; |
|
| 171 | + 'non riconfermato' : 'riconfermato'; |
|
| 173 | 172 | $text = $page->isVote() ? "votazione: $outcomeText" : 'riconferma tacita'; |
| 174 | 173 | |
| 175 | 174 | $newContent = str_replace( 'riconferma in corso', $text, $current ); |
@@ -186,13 +185,13 @@ discard block |
||
| 186 | 185 | * @param PageRiconferma[] $pages |
| 187 | 186 | * @see UpdatesAround::addVote() |
| 188 | 187 | */ |
| 189 | - protected function updateVote( array $pages ) { |
|
| 188 | + protected function updateVote ( array $pages ) { |
|
| 190 | 189 | $votePage = $this->getConfig()->get( 'ric-vote-page' ); |
| 191 | 190 | $content = $this->getController()->getPageContent( $votePage ); |
| 192 | 191 | |
| 193 | - $titles = []; |
|
| 192 | + $titles = [ ]; |
|
| 194 | 193 | foreach ( $pages as $page ) { |
| 195 | - $titles[] = preg_quote( $page->getTitle() ); |
|
| 194 | + $titles[ ] = preg_quote( $page->getTitle() ); |
|
| 196 | 195 | } |
| 197 | 196 | |
| 198 | 197 | $titleReg = implode( '|', array_map( 'preg_quote', $titles ) ); |
@@ -215,7 +214,7 @@ discard block |
||
| 215 | 214 | $summary = preg_replace_callback( |
| 216 | 215 | '!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!', |
| 217 | 216 | function ( $matches ) { |
| 218 | - return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] ); |
|
| 217 | + return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] ); |
|
| 219 | 218 | }, |
| 220 | 219 | $summary |
| 221 | 220 | ); |
@@ -233,7 +232,7 @@ discard block |
||
| 233 | 232 | * @param array $pages |
| 234 | 233 | * @see UpdatesAround::addNews() |
| 235 | 234 | */ |
| 236 | - protected function updateNews( array $pages ) { |
|
| 235 | + protected function updateNews ( array $pages ) { |
|
| 237 | 236 | $simpleAmount = $voteAmount = 0; |
| 238 | 237 | foreach ( $pages as $page ) { |
| 239 | 238 | if ( $page->isVote() ) { |
@@ -253,12 +252,12 @@ discard block |
||
| 253 | 252 | $simpleReg = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!'; |
| 254 | 253 | $voteReg = '!(\| *riconferme[ _]voto[ _]amministratori *= *)(\d+)!'; |
| 255 | 254 | |
| 256 | - $simpleMatches = $voteMatches = []; |
|
| 255 | + $simpleMatches = $voteMatches = [ ]; |
|
| 257 | 256 | preg_match( $simpleReg, $content, $simpleMatches ); |
| 258 | 257 | preg_match( $voteReg, $content, $voteMatches ); |
| 259 | 258 | |
| 260 | - $newSimp = (int)$simpleMatches[2] - $simpleAmount ?: ''; |
|
| 261 | - $newVote = (int)$voteMatches[2] - $voteAmount ?: ''; |
|
| 259 | + $newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: ''; |
|
| 260 | + $newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: ''; |
|
| 262 | 261 | $newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content ); |
| 263 | 262 | $newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent ); |
| 264 | 263 | |
@@ -269,7 +268,7 @@ discard block |
||
| 269 | 268 | $summary = preg_replace_callback( |
| 270 | 269 | '!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!', |
| 271 | 270 | function ( $matches ) { |
| 272 | - return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] ); |
|
| 271 | + return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] ); |
|
| 273 | 272 | }, |
| 274 | 273 | $summary |
| 275 | 274 | ); |
@@ -288,22 +287,22 @@ discard block |
||
| 288 | 287 | * |
| 289 | 288 | * @param PageRiconferma[] $pages |
| 290 | 289 | */ |
| 291 | - protected function updateAdminList( array $pages ) { |
|
| 290 | + protected function updateAdminList ( array $pages ) { |
|
| 292 | 291 | $listTitle = $this->getConfig()->get( 'admins-list' ); |
| 293 | 292 | $newContent = $this->getController()->getPageContent( $listTitle ); |
| 294 | 293 | $newDate = date( 'Ymd', strtotime( '+1 year' ) ); |
| 295 | 294 | |
| 296 | - $riconfNames = $removeNames = []; |
|
| 295 | + $riconfNames = $removeNames = [ ]; |
|
| 297 | 296 | foreach ( $pages as $page ) { |
| 298 | 297 | $user = $page->getUser(); |
| 299 | 298 | $reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!"; |
| 300 | 299 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
| 301 | 300 | // Remove the line |
| 302 | 301 | $newContent = preg_replace( $reg, '', $newContent ); |
| 303 | - $removeNames[] = $user; |
|
| 302 | + $removeNames[ ] = $user; |
|
| 304 | 303 | } else { |
| 305 | 304 | $newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent ); |
| 306 | - $riconfNames[] = $user; |
|
| 305 | + $riconfNames[ ] = $user; |
|
| 307 | 306 | } |
| 308 | 307 | } |
| 309 | 308 | |
@@ -311,7 +310,7 @@ discard block |
||
| 311 | 310 | $lastUser = array_pop( $riconfNames ); |
| 312 | 311 | $riconfList = implode( ', ', $riconfNames ) . " e $lastUser"; |
| 313 | 312 | } elseif ( $riconfNames ) { |
| 314 | - $riconfList = $riconfNames[0]; |
|
| 313 | + $riconfList = $riconfNames[ 0 ]; |
|
| 315 | 314 | } else { |
| 316 | 315 | $riconfList = 'nessuno'; |
| 317 | 316 | } |
@@ -320,7 +319,7 @@ discard block |
||
| 320 | 319 | $lastUser = array_pop( $removeNames ); |
| 321 | 320 | $removeList = implode( ', ', $removeNames ) . " e $lastUser"; |
| 322 | 321 | } elseif ( $removeNames ) { |
| 323 | - $removeList = $removeNames[0]; |
|
| 322 | + $removeList = $removeNames[ 0 ]; |
|
| 324 | 323 | } else { |
| 325 | 324 | $removeList = 'nessuno'; |
| 326 | 325 | } |
@@ -345,13 +344,13 @@ discard block |
||
| 345 | 344 | /** |
| 346 | 345 | * @param PageRiconferma[] $pages |
| 347 | 346 | */ |
| 348 | - protected function updateCUList( array $pages ) { |
|
| 347 | + protected function updateCUList ( array $pages ) { |
|
| 349 | 348 | $cuListTitle = $this->getConfig()->get( 'cu-list-title' ); |
| 350 | 349 | $listTitle = $this->getConfig()->get( 'list-title' ); |
| 351 | 350 | $admins = json_decode( $this->getController()->getPageContent( $listTitle ), true ); |
| 352 | 351 | $newContent = $this->getController()->getPageContent( $cuListTitle ); |
| 353 | 352 | |
| 354 | - $riconfNames = $removeNames = []; |
|
| 353 | + $riconfNames = $removeNames = [ ]; |
|
| 355 | 354 | foreach ( $pages as $page ) { |
| 356 | 355 | $user = $page->getUser(); |
| 357 | 356 | if ( array_key_exists( 'checkuser', $admins[ $user ] ) ) { |
@@ -359,10 +358,10 @@ discard block |
||
| 359 | 358 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
| 360 | 359 | // Remove the line |
| 361 | 360 | $newContent = preg_replace( $reg, '', $newContent ); |
| 362 | - $removeNames[] = $user; |
|
| 361 | + $removeNames[ ] = $user; |
|
| 363 | 362 | } else { |
| 364 | 363 | $newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent ); |
| 365 | - $riconfNames[] = $user; |
|
| 364 | + $riconfNames[ ] = $user; |
|
| 366 | 365 | } |
| 367 | 366 | } |
| 368 | 367 | } |
@@ -375,7 +374,7 @@ discard block |
||
| 375 | 374 | $lastUser = array_pop( $riconfNames ); |
| 376 | 375 | $riconfList = implode( ', ', $riconfNames ) . " e $lastUser"; |
| 377 | 376 | } elseif ( $riconfNames ) { |
| 378 | - $riconfList = $riconfNames[0]; |
|
| 377 | + $riconfList = $riconfNames[ 0 ]; |
|
| 379 | 378 | } else { |
| 380 | 379 | $riconfList = 'nessuno'; |
| 381 | 380 | } |
@@ -384,7 +383,7 @@ discard block |
||
| 384 | 383 | $lastUser = array_pop( $removeNames ); |
| 385 | 384 | $removeList = implode( ', ', $removeNames ) . " e $lastUser"; |
| 386 | 385 | } elseif ( $removeNames ) { |
| 387 | - $removeList = $removeNames[0]; |
|
| 386 | + $removeList = $removeNames[ 0 ]; |
|
| 388 | 387 | } else { |
| 389 | 388 | $removeList = 'nessuno'; |
| 390 | 389 | } |
@@ -408,17 +407,17 @@ discard block |
||
| 408 | 407 | /** |
| 409 | 408 | * @param PageRiconferma[] $pages |
| 410 | 409 | */ |
| 411 | - protected function updateBurList( array $pages ) { |
|
| 410 | + protected function updateBurList ( array $pages ) { |
|
| 412 | 411 | $listTitle = $this->getConfig()->get( 'list-title' ); |
| 413 | 412 | $admins = json_decode( $this->getController()->getPageContent( $listTitle ), true ); |
| 414 | 413 | |
| 415 | - $remove = []; |
|
| 414 | + $remove = [ ]; |
|
| 416 | 415 | foreach ( $pages as $page ) { |
| 417 | 416 | $user = $page->getUser(); |
| 418 | 417 | if ( array_key_exists( 'bureaucrat', $admins[ $user ] ) && |
| 419 | 418 | $page->getOutcome() & PageRiconferma::OUTCOME_FAIL |
| 420 | 419 | ) { |
| 421 | - $remove[] = $user; |
|
| 420 | + $remove[ ] = $user; |
|
| 422 | 421 | } |
| 423 | 422 | } |
| 424 | 423 | |
@@ -436,7 +435,7 @@ discard block |
||
| 436 | 435 | $lastUser = array_pop( $remove ); |
| 437 | 436 | $removeList = implode( ', ', $remove ) . " e $lastUser"; |
| 438 | 437 | } else { |
| 439 | - $removeList = $remove[0]; |
|
| 438 | + $removeList = $remove[ 0 ]; |
|
| 440 | 439 | } |
| 441 | 440 | |
| 442 | 441 | $summary = strtr( |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Task; |
| 4 | 4 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @inheritDoc |
| 16 | 16 | */ |
| 17 | - public function run() : TaskResult { |
|
| 17 | + public function run () : TaskResult { |
|
| 18 | 18 | $this->getLogger()->info( 'Starting task StartVote' ); |
| 19 | 19 | |
| 20 | 20 | $pages = $this->getDataProvider()->getOpenPages(); |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @param PageRiconferma[] $pages |
| 34 | 34 | */ |
| 35 | - protected function processPages( array $pages ) { |
|
| 36 | - $actualPages = []; |
|
| 35 | + protected function processPages ( array $pages ) { |
|
| 36 | + $actualPages = [ ]; |
|
| 37 | 37 | foreach ( $pages as $page ) { |
| 38 | 38 | if ( $page->hasOpposition() && !$page->isVote() ) { |
| 39 | 39 | $this->openVote( $page ); |
| 40 | - $actualPages[] = $page; |
|
| 40 | + $actualPages[ ] = $page; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param PageRiconferma $page |
| 56 | 56 | */ |
| 57 | - protected function openVote( PageRiconferma $page ) { |
|
| 57 | + protected function openVote ( PageRiconferma $page ) { |
|
| 58 | 58 | $this->getLogger()->info( "Starting vote on $page" ); |
| 59 | 59 | |
| 60 | 60 | $content = $page->getContent(); |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | * @see ClosePages::updateVote() |
| 94 | 94 | * @see UpdatesAround::addVote() |
| 95 | 95 | */ |
| 96 | - protected function updateVotePage( array $pages ) { |
|
| 96 | + protected function updateVotePage ( array $pages ) { |
|
| 97 | 97 | $votePage = $this->getConfig()->get( 'ric-vote-page' ); |
| 98 | 98 | $content = $this->getController()->getPageContent( $votePage ); |
| 99 | 99 | |
| 100 | - $titles = []; |
|
| 100 | + $titles = [ ]; |
|
| 101 | 101 | foreach ( $pages as $page ) { |
| 102 | - $titles[] = preg_quote( $page->getTitle() ); |
|
| 102 | + $titles[ ] = preg_quote( $page->getTitle() ); |
|
| 103 | 103 | } |
| 104 | 104 | $titleReg = implode( '|', array_map( 'preg_quote', $titles ) ); |
| 105 | 105 | $search = "!^\*.+ La \[\[($titleReg)\|procedura]] termina.+\n!gm"; |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | $newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 ); |
| 123 | 123 | } else { |
| 124 | 124 | // Start section |
| 125 | - $matches = []; |
|
| 125 | + $matches = [ ]; |
|
| 126 | 126 | if ( preg_match( $introReg, $content, $matches ) === false ) { |
| 127 | 127 | throw new TaskException( 'Intro not found in vote page' ); |
| 128 | 128 | } |
| 129 | 129 | $beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m'; |
| 130 | 130 | // Replace semicolon with full stop |
| 131 | 131 | $newLines = substr( $newLines, 0, -2 ) . ".\n"; |
| 132 | - $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 ); |
|
| 132 | + $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 ); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $summary = strtr( |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $summary = preg_replace_callback( |
| 140 | 140 | '!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!', |
| 141 | 141 | function ( $matches ) { |
| 142 | - return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] ); |
|
| 142 | + return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] ); |
|
| 143 | 143 | }, |
| 144 | 144 | $summary |
| 145 | 145 | ); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @see UpdatesAround::addNews() |
| 161 | 161 | * @see ClosePages::updateNews() |
| 162 | 162 | */ |
| 163 | - protected function updateNews( int $amount ) { |
|
| 163 | + protected function updateNews ( int $amount ) { |
|
| 164 | 164 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
| 165 | 165 | $newsPage = $this->getConfig()->get( 'ric-news-page' ); |
| 166 | 166 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $regTac = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!'; |
| 169 | 169 | $regVot = '!(\| *riconferme[ _]voto[ _]amministratori *= *)(\d+)!'; |
| 170 | 170 | |
| 171 | - $tacMatches = $votMatches = []; |
|
| 171 | + $tacMatches = $votMatches = [ ]; |
|
| 172 | 172 | if ( preg_match( $regTac, $content, $tacMatches ) === false ) { |
| 173 | 173 | throw new TaskException( 'Param "tacite" not found in news page' ); |
| 174 | 174 | } |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | throw new TaskException( 'Param "voto" not found in news page' ); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $newTac = (int)$tacMatches[2] - $amount ?: ''; |
|
| 180 | - $newVot = (int)$votMatches[2] + $amount ?: ''; |
|
| 179 | + $newTac = (int)$tacMatches[ 2 ] - $amount ?: ''; |
|
| 180 | + $newVot = (int)$votMatches[ 2 ] + $amount ?: ''; |
|
| 181 | 181 | |
| 182 | 182 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
| 183 | 183 | $newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent ); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $summary = preg_replace_callback( |
| 190 | 190 | '!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!', |
| 191 | 191 | function ( $matches ) { |
| 192 | - return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] ); |
|
| 192 | + return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] ); |
|
| 193 | 193 | }, |
| 194 | 194 | $summary |
| 195 | 195 | ); |