@@ -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\Subtask; |
| 4 | 4 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @inheritDoc |
| 18 | 18 | */ |
| 19 | - public function runInternal(): int { |
|
| 19 | + public function runInternal (): int { |
|
| 20 | 20 | $failed = $this->getFailures(); |
| 21 | 21 | if ( !$failed ) { |
| 22 | 22 | return TaskResult::STATUS_NOTHING; |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return PageRiconferma[] |
| 43 | 43 | */ |
| 44 | - private function getFailures(): array { |
|
| 45 | - $ret = []; |
|
| 44 | + private function getFailures (): array { |
|
| 45 | + $ret = [ ]; |
|
| 46 | 46 | $allPages = $this->getDataProvider()->getPagesToClose(); |
| 47 | 47 | foreach ( $allPages as $page ) { |
| 48 | 48 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
| 49 | - $ret[] = $page; |
|
| 49 | + $ret[ ] = $page; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | return $ret; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @param User[] $users |
| 57 | 57 | */ |
| 58 | - protected function updateBurList( array $users ): void { |
|
| 58 | + protected function updateBurList ( array $users ): void { |
|
| 59 | 59 | $this->getLogger()->info( 'Updating bur list. Removing: ' . implode( ', ', $users ) ); |
| 60 | 60 | $remList = RegexUtils::regexFromArray( '!', ...$users ); |
| 61 | 61 | $burList = $this->getPage( $this->getOpt( 'bur-list-title' ) ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param PageRiconferma[] $pages |
| 80 | 80 | */ |
| 81 | - protected function requestRemoval( array $pages ): void { |
|
| 81 | + protected function requestRemoval ( array $pages ): void { |
|
| 82 | 82 | $this->getLogger()->info( 'Requesting flag removal for: ' . implode( ', ', $pages ) ); |
| 83 | 83 | |
| 84 | 84 | $metaWiki = $this->getWikiGroup()->getCentralWiki(); |
@@ -115,21 +115,21 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @param PageRiconferma[] $pages |
| 117 | 117 | */ |
| 118 | - protected function updateAnnunci( array $pages ): void { |
|
| 118 | + protected function updateAnnunci ( array $pages ): void { |
|
| 119 | 119 | $this->getLogger()->info( 'Updating annunci' ); |
| 120 | 120 | $section = 1; |
| 121 | 121 | |
| 122 | - $names = []; |
|
| 122 | + $names = [ ]; |
|
| 123 | 123 | $text = ''; |
| 124 | 124 | foreach ( $pages as $page ) { |
| 125 | 125 | $user = $page->getUserName(); |
| 126 | - $names[] = $user; |
|
| 126 | + $names[ ] = $user; |
|
| 127 | 127 | $text .= $this->msg( 'annunci-text' )->params( [ '$user' => $user ] )->text(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** @var string $curMonth */ |
| 131 | 131 | $curMonth = date( 'F' ); |
| 132 | - $month = ucfirst( Message::MONTHS[$curMonth] ); |
|
| 132 | + $month = ucfirst( Message::MONTHS[ $curMonth ] ); |
|
| 133 | 133 | |
| 134 | 134 | $annunciPage = $this->getPage( $this->getOpt( 'annunci-page-title' ) ); |
| 135 | 135 | $content = $annunciPage->getContent( $section ); |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @param PageRiconferma[] $pages |
| 159 | 159 | */ |
| 160 | - protected function updateUltimeNotizie( array $pages ): void { |
|
| 160 | + protected function updateUltimeNotizie ( array $pages ): void { |
|
| 161 | 161 | $this->getLogger()->info( 'Updating ultime notizie' ); |
| 162 | 162 | $notiziePage = $this->getPage( $this->getOpt( 'ultimenotizie-page-title' ) ); |
| 163 | 163 | |
| 164 | - $names = []; |
|
| 164 | + $names = [ ]; |
|
| 165 | 165 | $text = ''; |
| 166 | 166 | $msg = $this->msg( 'ultimenotizie-text' ); |
| 167 | 167 | foreach ( $pages as $page ) { |
| 168 | 168 | $user = $page->getUserName(); |
| 169 | - $names[] = $user; |
|
| 169 | + $names[ ] = $user; |
|
| 170 | 170 | $text .= $msg->params( [ '$user' => $user, '$title' => $page->getTitle() ] )->text(); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @param PageRiconferma[] $pages |
| 196 | 196 | */ |
| 197 | - protected function updateTimeline( array $pages ): void { |
|
| 197 | + protected function updateTimeline ( array $pages ): void { |
|
| 198 | 198 | $this->getLogger()->info( 'Updating timeline' ); |
| 199 | 199 | $timelinePage = $this->getPage( $this->getOpt( 'timeline-page-title' ) ); |
| 200 | 200 | $content = $timelinePage->getContent(); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @param PageRiconferma[] $pages |
| 224 | 224 | */ |
| 225 | - private function updateCronologia( array $pages ): void { |
|
| 225 | + private function updateCronologia ( array $pages ): void { |
|
| 226 | 226 | $this->getLogger()->info( 'Updating cronologia' ); |
| 227 | 227 | $timelinePage = $this->getPage( $this->getOpt( 'cronologia-page-title' ) ); |
| 228 | 228 | $content = $timelinePage->getContent(); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @param PageRiconferma[] $pages |
| 251 | 251 | */ |
| 252 | - private function blockOnPrivate( array $pages ): void { |
|
| 252 | + private function blockOnPrivate ( array $pages ): void { |
|
| 253 | 253 | $this->getLogger()->info( 'Blocking on private wiki: ' . implode( ', ', $pages ) ); |
| 254 | 254 | |
| 255 | 255 | $privWiki = $this->getWikiGroup()->getPrivateWiki(); |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | * @param PageRiconferma[] $pages |
| 267 | 267 | * @return User[] |
| 268 | 268 | */ |
| 269 | - private function getFailedBureaucrats( array $pages ): array { |
|
| 270 | - $ret = []; |
|
| 269 | + private function getFailedBureaucrats ( array $pages ): array { |
|
| 270 | + $ret = [ ]; |
|
| 271 | 271 | foreach ( $pages as $page ) { |
| 272 | 272 | $user = $this->getUser( $page->getUserName() ); |
| 273 | 273 | if ( $user->inGroup( 'bureaucrat' ) ) { |
| 274 | - $ret[] = $user; |
|
| 274 | + $ret[ ] = $user; |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | return $ret; |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @inheritDoc |
| 15 | 15 | */ |
| 16 | - public function runInternal(): int { |
|
| 16 | + public function runInternal (): int { |
|
| 17 | 17 | $pages = $this->getDataProvider()->getPagesToClose(); |
| 18 | 18 | |
| 19 | 19 | if ( !$pages ) { |
@@ -32,18 +32,18 @@ discard block |
||
| 32 | 32 | * @param PageRiconferma[] $pages |
| 33 | 33 | * @see OpenUpdates::addToMainPage() |
| 34 | 34 | */ |
| 35 | - protected function removeFromMainPage( array $pages ): void { |
|
| 35 | + protected function removeFromMainPage ( array $pages ): void { |
|
| 36 | 36 | $this->getLogger()->info( |
| 37 | 37 | 'Removing from main: ' . implode( ', ', $pages ) |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | $mainPage = $this->getPage( $this->getOpt( 'main-page-title' ) ); |
| 41 | - $remove = []; |
|
| 41 | + $remove = [ ]; |
|
| 42 | 42 | foreach ( $pages as $page ) { |
| 43 | 43 | // Order matters here. It's not guaranteed that there'll be a newline, but avoid |
| 44 | 44 | // regexps for that single character. |
| 45 | - $remove[] = '{{' . $page->getTitle() . "}}\n"; |
|
| 46 | - $remove[] = '{{' . $page->getTitle() . '}}'; |
|
| 45 | + $remove[ ] = '{{' . $page->getTitle() . "}}\n"; |
|
| 46 | + $remove[ ] = '{{' . $page->getTitle() . '}}'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $newContent = str_replace( $remove, '', $mainPage->getContent() ); |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param PageRiconferma[] $pages |
| 74 | 74 | */ |
| 75 | - protected function addToArchive( array $pages ): void { |
|
| 75 | + protected function addToArchive ( array $pages ): void { |
|
| 76 | 76 | $this->getLogger()->info( |
| 77 | 77 | 'Adding to archive: ' . implode( ', ', $pages ) |
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | - $simple = $votes = []; |
|
| 80 | + $simple = $votes = [ ]; |
|
| 81 | 81 | foreach ( $pages as $page ) { |
| 82 | 82 | if ( $page->isVote() ) { |
| 83 | - $votes[] = $page; |
|
| 83 | + $votes[ ] = $page; |
|
| 84 | 84 | } else { |
| 85 | - $simple[] = $page; |
|
| 85 | + $simple[ ] = $page; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | * @param string $archiveTitle |
| 104 | 104 | * @param PageRiconferma[] $pages |
| 105 | 105 | */ |
| 106 | - private function reallyAddToArchive( string $archiveTitle, array $pages ): void { |
|
| 106 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ): void { |
|
| 107 | 107 | $archivePage = $this->getPage( "$archiveTitle/" . date( 'Y' ) ); |
| 108 | 108 | $existed = $archivePage->exists(); |
| 109 | 109 | |
| 110 | 110 | $append = "\n"; |
| 111 | - $archivedList = []; |
|
| 111 | + $archivedList = [ ]; |
|
| 112 | 112 | foreach ( $pages as $page ) { |
| 113 | 113 | $append .= '{{' . $page->getTitle() . "}}\n"; |
| 114 | - $archivedList[] = $page->getUserNum(); |
|
| 114 | + $archivedList[ ] = $page->getUserNum(); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $summary = $this->msg( 'close-archive-summary' ) |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @param string $archiveTitle |
| 134 | 134 | */ |
| 135 | - private function addArchiveYear( string $archiveTitle ): void { |
|
| 135 | + private function addArchiveYear ( string $archiveTitle ): void { |
|
| 136 | 136 | $page = $this->getPage( $archiveTitle ); |
| 137 | 137 | $year = date( 'Y' ); |
| 138 | 138 | |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @inheritDoc |
| 16 | 16 | */ |
| 17 | - public function runInternal(): int { |
|
| 17 | + public function runInternal (): int { |
|
| 18 | 18 | $pages = $this->getDataProvider()->getPagesToClose(); |
| 19 | 19 | |
| 20 | 20 | if ( !$pages ) { |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | * @param PageRiconferma[] $pages |
| 37 | 37 | * @see OpenUpdates::addToVotazioni() |
| 38 | 38 | */ |
| 39 | - protected function updateVotazioni( array $pages ): void { |
|
| 39 | + protected function updateVotazioni ( array $pages ): void { |
|
| 40 | 40 | $this->getLogger()->info( |
| 41 | 41 | 'Updating votazioni: ' . implode( ', ', $pages ) |
| 42 | 42 | ); |
| 43 | 43 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
| 44 | 44 | |
| 45 | - $users = []; |
|
| 45 | + $users = [ ]; |
|
| 46 | 46 | foreach ( $pages as $page ) { |
| 47 | - $users[] = $this->getUser( $page->getUserName() ); |
|
| 47 | + $users[ ] = $this->getUser( $page->getUserName() ); |
|
| 48 | 48 | } |
| 49 | 49 | $usersReg = RegexUtils::regexFromArray( '!', ...$users ); |
| 50 | 50 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param PageRiconferma[] $pages |
| 66 | 66 | * @see OpenUpdates::addToNews() |
| 67 | 67 | */ |
| 68 | - protected function updateNews( array $pages ): void { |
|
| 68 | + protected function updateNews ( array $pages ): void { |
|
| 69 | 69 | $simpleAmount = $voteAmount = 0; |
| 70 | 70 | foreach ( $pages as $page ) { |
| 71 | 71 | if ( $page->isVote() ) { |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $simpleMatches = $newsPage->getMatch( $simpleReg ); |
| 86 | 86 | $voteMatches = $newsPage->getMatch( $voteReg ); |
| 87 | 87 | |
| 88 | - $newSimp = ( (int)$simpleMatches[2] - $simpleAmount ) ?: ''; |
|
| 89 | - $newVote = ( (int)$voteMatches[2] - $voteAmount ) ?: ''; |
|
| 88 | + $newSimp = ( (int)$simpleMatches[ 2 ] - $simpleAmount ) ?: ''; |
|
| 89 | + $newVote = ( (int)$voteMatches[ 2 ] - $voteAmount ) ?: ''; |
|
| 90 | 90 | $newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $newsPage->getContent() ); |
| 91 | 91 | $newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent ); |
| 92 | 92 | |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @param bool[] $outcomes |
| 106 | 106 | */ |
| 107 | - protected function updateAdminList( array $outcomes ): void { |
|
| 107 | + protected function updateAdminList ( array $outcomes ): void { |
|
| 108 | 108 | $this->getLogger()->info( 'Updating admin list' ); |
| 109 | 109 | $adminsPage = $this->getPage( $this->getOpt( 'admins-list-title' ) ); |
| 110 | 110 | $newContent = $adminsPage->getContent(); |
| 111 | 111 | |
| 112 | - $riconfNames = $removeNames = []; |
|
| 112 | + $riconfNames = $removeNames = [ ]; |
|
| 113 | 113 | foreach ( $outcomes as $username => $confirmed ) { |
| 114 | 114 | $user = $this->getUser( $username ); |
| 115 | 115 | $userReg = $user->getRegex( '!' ); |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | '${1}{{subst:#timel:Ymd}}|' . $nextDate . '$2', |
| 125 | 125 | $newContent |
| 126 | 126 | ); |
| 127 | - $riconfNames[] = $username; |
|
| 127 | + $riconfNames[ ] = $username; |
|
| 128 | 128 | } else { |
| 129 | 129 | $newContent = preg_replace( $reg, '', $newContent ); |
| 130 | - $removeNames[] = $username; |
|
| 130 | + $removeNames[ ] = $username; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -153,21 +153,21 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * @param bool[] $outcomes |
| 155 | 155 | */ |
| 156 | - protected function updateCUList( array $outcomes ): void { |
|
| 156 | + protected function updateCUList ( array $outcomes ): void { |
|
| 157 | 157 | $this->getLogger()->info( 'Updating CU list.' ); |
| 158 | 158 | $cuList = $this->getPage( $this->getOpt( 'cu-list-title' ) ); |
| 159 | 159 | $newContent = $cuList->getContent(); |
| 160 | 160 | |
| 161 | - $riconfNames = $removeNames = []; |
|
| 161 | + $riconfNames = $removeNames = [ ]; |
|
| 162 | 162 | foreach ( $outcomes as $user => $confirmed ) { |
| 163 | 163 | $userReg = $this->getUser( $user )->getRegex( '!' ); |
| 164 | 164 | $reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!"; |
| 165 | 165 | if ( $confirmed ) { |
| 166 | 166 | $newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent ); |
| 167 | - $riconfNames[] = $user; |
|
| 167 | + $riconfNames[ ] = $user; |
|
| 168 | 168 | } else { |
| 169 | 169 | $newContent = preg_replace( $reg, '', $newContent ); |
| 170 | - $removeNames[] = $user; |
|
| 170 | + $removeNames[ ] = $user; |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | * @param PageRiconferma[] $pages |
| 198 | 198 | * @return bool[] |
| 199 | 199 | */ |
| 200 | - private function getGroupOutcomes( string $group, array $pages ): array { |
|
| 201 | - $ret = []; |
|
| 200 | + private function getGroupOutcomes ( string $group, array $pages ): array { |
|
| 201 | + $ret = [ ]; |
|
| 202 | 202 | foreach ( $pages as $page ) { |
| 203 | 203 | $user = $this->getUser( $page->getUserName() ); |
| 204 | 204 | if ( $user->inGroup( $group ) ) { |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @inheritDoc |
| 15 | 15 | */ |
| 16 | - public function runInternal(): int { |
|
| 16 | + public function runInternal (): int { |
|
| 17 | 17 | $pages = $this->getDataProvider()->getPagesToClose(); |
| 18 | 18 | |
| 19 | 19 | if ( !$pages ) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @param PageRiconferma $page |
| 37 | 37 | */ |
| 38 | - protected function addVoteCloseText( PageRiconferma $page ): void { |
|
| 38 | + protected function addVoteCloseText ( PageRiconferma $page ): void { |
|
| 39 | 39 | $content = $page->getContent(); |
| 40 | 40 | $beforeReg = '!è necessario ottenere una maggioranza .+ votanti\.!u'; |
| 41 | 41 | $newContent = preg_replace( $beforeReg, '$0' . "\n" . $page->getOutcomeText(), $content ); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param PageRiconferma $page |
| 51 | 51 | * @see CreatePages::updateBasePage() |
| 52 | 52 | */ |
| 53 | - protected function updateBasePage( PageRiconferma $page ): void { |
|
| 53 | + protected function updateBasePage ( PageRiconferma $page ): void { |
|
| 54 | 54 | $this->getLogger()->info( "Updating base page for $page" ); |
| 55 | 55 | |
| 56 | 56 | if ( $page->getNum() === 1 ) { |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | $current = $basePage->getContent(); |
| 63 | 63 | |
| 64 | 64 | $outcomeText = ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) ? |
| 65 | - 'non riconfermato' : |
|
| 66 | - 'riconfermato'; |
|
| 65 | + 'non riconfermato' : 'riconfermato'; |
|
| 67 | 66 | $text = $page->isVote() ? "votazione di riconferma: $outcomeText" : 'riconferma tacita'; |
| 68 | 67 | |
| 69 | 68 | $newContent = preg_replace( '/^(#: *)(votazione di )?riconferma in corso/m', '$1' . $text, $current ); |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @inheritDoc |
| 15 | 15 | */ |
| 16 | - public function runInternal(): int { |
|
| 16 | + public function runInternal (): int { |
|
| 17 | 17 | $pages = $this->getDataProvider()->getCreatedPages(); |
| 18 | 18 | |
| 19 | 19 | if ( !$pages ) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param PageRiconferma[] $pages |
| 37 | 37 | */ |
| 38 | - protected function addToMainPage( array $pages ): void { |
|
| 38 | + protected function addToMainPage ( array $pages ): void { |
|
| 39 | 39 | $this->getLogger()->info( |
| 40 | 40 | 'Adding the following to main: ' . implode( ', ', $pages ) |
| 41 | 41 | ); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param PageRiconferma[] $pages |
| 70 | 70 | */ |
| 71 | - protected function addToVotazioni( array $pages ): void { |
|
| 71 | + protected function addToVotazioni ( array $pages ): void { |
|
| 72 | 72 | $this->getLogger()->info( |
| 73 | 73 | 'Adding the following to votes: ' . implode( ', ', $pages ) |
| 74 | 74 | ); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param int $amount |
| 106 | 106 | * @throws TaskException |
| 107 | 107 | */ |
| 108 | - protected function addToNews( int $amount ): void { |
|
| 108 | + protected function addToNews ( int $amount ): void { |
|
| 109 | 109 | $this->getLogger()->info( "Increasing the news counter by $amount" ); |
| 110 | 110 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
| 111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $matches = $newsPage->getMatch( $reg ); |
| 120 | 120 | |
| 121 | - $newNum = (int)$matches[2] + $amount; |
|
| 121 | + $newNum = (int)$matches[ 2 ] + $amount; |
|
| 122 | 122 | $newContent = preg_replace( $reg, '${1}' . $newNum, $content ); |
| 123 | 123 | |
| 124 | 124 | $summary = $this->msg( 'news-page-summary' ) |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @inheritDoc |
| 19 | 19 | */ |
| 20 | - public function runInternal(): int { |
|
| 20 | + public function runInternal (): int { |
|
| 21 | 21 | $users = $this->getDataProvider()->getUsersToProcess(); |
| 22 | 22 | |
| 23 | 23 | if ( !$users ) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param User $user |
| 38 | 38 | */ |
| 39 | - protected function processUser( User $user ): void { |
|
| 39 | + protected function processUser ( User $user ): void { |
|
| 40 | 40 | $this->getLogger()->info( "Processing user $user" ); |
| 41 | 41 | try { |
| 42 | 42 | $num = $this->getLastPageNum( $user ) + 1; |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | * @return int |
| 72 | 72 | * @throws TaskException |
| 73 | 73 | */ |
| 74 | - protected function getLastPageNum( User $user ): int { |
|
| 74 | + protected function getLastPageNum ( User $user ): int { |
|
| 75 | 75 | $this->getLogger()->info( "Retrieving previous pages for $user" ); |
| 76 | 76 | |
| 77 | - $unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[1]; |
|
| 77 | + $unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[ 1 ]; |
|
| 78 | 78 | |
| 79 | 79 | $prefixes = [ "$unprefixedTitle/$user/" ]; |
| 80 | 80 | foreach ( $user->getAliases() as $alias ) { |
| 81 | - $prefixes[] = "$unprefixedTitle/$alias/"; |
|
| 81 | + $prefixes[ ] = "$unprefixedTitle/$alias/"; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $params = [ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ]; |
| 91 | 91 | $pagesIterator = new AppendIterator(); |
| 92 | 92 | foreach ( $prefixes as $prefix ) { |
| 93 | - $params['apprefix'] = $prefix; |
|
| 93 | + $params[ 'apprefix' ] = $prefix; |
|
| 94 | 94 | $res = $this->getRequestFactory()->newFromParams( $params )->executeAsQuery(); |
| 95 | 95 | $pagesIterator->append( new NoRewindIterator( $res ) ); |
| 96 | 96 | } |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | * @param string $title |
| 117 | 117 | * @param User $user |
| 118 | 118 | */ |
| 119 | - protected function createPage( string $title, User $user ): void { |
|
| 119 | + protected function createPage ( string $title, User $user ): void { |
|
| 120 | 120 | $this->getLogger()->info( "Creating page $title" ); |
| 121 | 121 | $groups = $user->getGroupsWithDates(); |
| 122 | 122 | $textParams = [ |
| 123 | 123 | '$user' => $user->getName(), |
| 124 | - '$date' => $groups['sysop'], |
|
| 125 | - '$burocrate' => $groups['bureaucrat'] ?? '', |
|
| 126 | - '$checkuser' => $groups['checkuser'] ?? '' |
|
| 124 | + '$date' => $groups[ 'sysop' ], |
|
| 125 | + '$burocrate' => $groups[ 'bureaucrat' ] ?? '', |
|
| 126 | + '$checkuser' => $groups[ 'checkuser' ] ?? '' |
|
| 127 | 127 | ]; |
| 128 | 128 | |
| 129 | 129 | $params = [ |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param Page $basePage |
| 142 | 142 | * @param string $newText |
| 143 | 143 | */ |
| 144 | - protected function createBasePage( Page $basePage, string $newText ): void { |
|
| 144 | + protected function createBasePage ( Page $basePage, string $newText ): void { |
|
| 145 | 145 | $this->getLogger()->info( "Creating base page $basePage" ); |
| 146 | 146 | |
| 147 | 147 | $params = [ |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param Page $basePage |
| 158 | 158 | * @param string $newText |
| 159 | 159 | */ |
| 160 | - protected function updateBasePage( Page $basePage, string $newText ): void { |
|
| 160 | + protected function updateBasePage ( Page $basePage, string $newText ): void { |
|
| 161 | 161 | $this->getLogger()->info( "Updating base page $basePage" ); |
| 162 | 162 | |
| 163 | 163 | $params = [ |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * @inheritDoc |
| 14 | 14 | */ |
| 15 | - public function runInternal(): int { |
|
| 15 | + public function runInternal (): int { |
|
| 16 | 16 | $pages = $this->getDataProvider()->getCreatedPages(); |
| 17 | 17 | $users = $this->getDataProvider()->getUsersToProcess(); |
| 18 | 18 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | return TaskResult::STATUS_NOTHING; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $ricNums = []; |
|
| 23 | + $ricNums = [ ]; |
|
| 24 | 24 | foreach ( $pages as $page ) { |
| 25 | 25 | $ricNums[ $page->getUserName() ] = $page->getNum(); |
| 26 | 26 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param User $user |
| 39 | 39 | * @param int $ricNum |
| 40 | 40 | */ |
| 41 | - protected function addMsg( User $user, int $ricNum ): void { |
|
| 41 | + protected function addMsg ( User $user, int $ricNum ): void { |
|
| 42 | 42 | $this->getLogger()->info( "Leaving msg to $user" ); |
| 43 | 43 | $msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text(); |
| 44 | 44 | |
@@ -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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @inheritDoc |
| 17 | 17 | */ |
| 18 | - public function runInternal(): int { |
|
| 18 | + public function runInternal (): int { |
|
| 19 | 19 | $orderedList = [ |
| 20 | 20 | 'close-pages', |
| 21 | 21 | 'archive-pages', |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - protected function getSubtasksMap(): array { |
|
| 37 | + protected function getSubtasksMap (): array { |
|
| 38 | 38 | return [ |
| 39 | 39 | 'archive-pages' => ArchivePages::class, |
| 40 | 40 | 'close-pages' => ClosePages::class, |
@@ -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 | |
@@ -15,13 +15,13 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @return string[] |
| 17 | 17 | */ |
| 18 | - abstract protected function getSubtasksMap(): array; |
|
| 18 | + abstract protected function getSubtasksMap (): array; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @param string $subtask Defined in self::SUBTASKS_MAP |
| 22 | 22 | * @return TaskResult |
| 23 | 23 | */ |
| 24 | - protected function runSubtask( string $subtask ): TaskResult { |
|
| 24 | + protected function runSubtask ( string $subtask ): TaskResult { |
|
| 25 | 25 | $map = $this->getSubtasksMap(); |
| 26 | 26 | if ( !isset( $map[ $subtask ] ) ) { |
| 27 | 27 | throw new InvalidArgumentException( "'$subtask' is not a valid task." ); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - final public function getOperationName(): string { |
|
| 37 | + final public function getOperationName (): string { |
|
| 38 | 38 | return 'task'; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $class |
| 45 | 45 | * @return Subtask |
| 46 | 46 | */ |
| 47 | - private function getSubtaskInstance( string $class ): Subtask { |
|
| 47 | + private function getSubtaskInstance ( string $class ): Subtask { |
|
| 48 | 48 | return new $class( |
| 49 | 49 | $this->getLogger(), |
| 50 | 50 | $this->getWikiGroup(), |