@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Wiki; |
| 4 | 4 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @param string $username |
| 16 | 16 | * @param string $password |
| 17 | 17 | */ |
| 18 | - public function __construct( string $username, string $password ) { |
|
| 18 | + public function __construct ( string $username, string $password ) { |
|
| 19 | 19 | $this->username = $username; |
| 20 | 20 | $this->password = $password; |
| 21 | 21 | } |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | - public function getUsername() : string { |
|
| 26 | + public function getUsername () : string { |
|
| 27 | 27 | return $this->username; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public function getPassword() : string { |
|
| 33 | + public function getPassword () : string { |
|
| 34 | 34 | return $this->password; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -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; |
| 4 | 4 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param MessageProvider $mp |
| 37 | 37 | * @param PageBotList $pbl |
| 38 | 38 | */ |
| 39 | - public function __construct( |
|
| 39 | + public function __construct ( |
|
| 40 | 40 | LoggerInterface $logger, |
| 41 | 41 | WikiGroup $wikiGroup, |
| 42 | 42 | MessageProvider $mp, |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return LoggerInterface |
| 54 | 54 | */ |
| 55 | - protected function getLogger() : LoggerInterface { |
|
| 55 | + protected function getLogger () : LoggerInterface { |
|
| 56 | 56 | return $this->logger; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @inheritDoc |
| 61 | 61 | */ |
| 62 | - public function setLogger( LoggerInterface $logger ) : void { |
|
| 62 | + public function setLogger ( LoggerInterface $logger ) : void { |
|
| 63 | 63 | $this->logger = $logger; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -69,21 +69,21 @@ discard block |
||
| 69 | 69 | * @param string $optname |
| 70 | 70 | * @return mixed |
| 71 | 71 | */ |
| 72 | - protected function getOpt( string $optname ) { |
|
| 72 | + protected function getOpt ( string $optname ) { |
|
| 73 | 73 | return $this->getConfig()->get( $optname ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @return Config |
| 78 | 78 | */ |
| 79 | - protected function getConfig() : Config { |
|
| 79 | + protected function getConfig () : Config { |
|
| 80 | 80 | return $this->config; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @param Config $cfg |
| 85 | 85 | */ |
| 86 | - protected function setConfig( Config $cfg ) : void { |
|
| 86 | + protected function setConfig ( Config $cfg ) : void { |
|
| 87 | 87 | $this->config = $cfg; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -91,35 +91,35 @@ discard block |
||
| 91 | 91 | * Shorthand |
| 92 | 92 | * @return Wiki |
| 93 | 93 | */ |
| 94 | - protected function getWiki() : Wiki { |
|
| 94 | + protected function getWiki () : Wiki { |
|
| 95 | 95 | return $this->getWikiGroup()->getMainWiki(); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * @return WikiGroup |
| 100 | 100 | */ |
| 101 | - protected function getWikiGroup() : WikiGroup { |
|
| 101 | + protected function getWikiGroup () : WikiGroup { |
|
| 102 | 102 | return $this->wikiGroup; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * @param WikiGroup $wikiGroup |
| 107 | 107 | */ |
| 108 | - protected function setWikiGroup( WikiGroup $wikiGroup ) : void { |
|
| 108 | + protected function setWikiGroup ( WikiGroup $wikiGroup ) : void { |
|
| 109 | 109 | $this->wikiGroup = $wikiGroup; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @return MessageProvider |
| 114 | 114 | */ |
| 115 | - protected function getMessageProvider() : MessageProvider { |
|
| 115 | + protected function getMessageProvider () : MessageProvider { |
|
| 116 | 116 | return $this->messageProvider; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * @param MessageProvider $mp |
| 121 | 121 | */ |
| 122 | - protected function setMessageProvider( MessageProvider $mp ) : void { |
|
| 122 | + protected function setMessageProvider ( MessageProvider $mp ) : void { |
|
| 123 | 123 | $this->messageProvider = $mp; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,21 +129,21 @@ discard block |
||
| 129 | 129 | * @param string $key |
| 130 | 130 | * @return Message |
| 131 | 131 | */ |
| 132 | - protected function msg( string $key ) : Message { |
|
| 132 | + protected function msg ( string $key ) : Message { |
|
| 133 | 133 | return $this->messageProvider->getMessage( $key ); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * @return PageBotList |
| 138 | 138 | */ |
| 139 | - public function getBotList() : PageBotList { |
|
| 139 | + public function getBotList () : PageBotList { |
|
| 140 | 140 | return $this->pageBotList; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @return RequestFactory |
| 145 | 145 | */ |
| 146 | - public function getRequestFactory() : RequestFactory { |
|
| 146 | + public function getRequestFactory () : RequestFactory { |
|
| 147 | 147 | return $this->getWiki()->getRequestFactory(); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @param string $title |
| 154 | 154 | * @return Page |
| 155 | 155 | */ |
| 156 | - protected function getPage( string $title ) : Page { |
|
| 156 | + protected function getPage ( string $title ) : Page { |
|
| 157 | 157 | return new Page( $title, $this->getWiki() ); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param string $name |
| 164 | 164 | * @return User |
| 165 | 165 | */ |
| 166 | - protected function getUser( string $name ) : User { |
|
| 166 | + protected function getUser ( string $name ) : User { |
|
| 167 | 167 | $ui = $this->getBotList()->getUserInfo( $name ); |
| 168 | 168 | return new User( $ui, $this->getWiki() ); |
| 169 | 169 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Wiki; |
| 4 | 4 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @param Wiki $centralWiki |
| 19 | 19 | * @param Wiki $privateWiki |
| 20 | 20 | */ |
| 21 | - public function __construct( Wiki $mainWiki, Wiki $centralWiki, Wiki $privateWiki ) { |
|
| 21 | + public function __construct ( Wiki $mainWiki, Wiki $centralWiki, Wiki $privateWiki ) { |
|
| 22 | 22 | $this->mainWiki = $mainWiki; |
| 23 | 23 | $this->centralWiki = $centralWiki; |
| 24 | 24 | $this->privateWiki = $privateWiki; |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @return Wiki |
| 29 | 29 | */ |
| 30 | - public function getMainWiki() : Wiki { |
|
| 30 | + public function getMainWiki () : Wiki { |
|
| 31 | 31 | return $this->mainWiki; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @return Wiki |
| 36 | 36 | */ |
| 37 | - public function getCentralWiki() : Wiki { |
|
| 37 | + public function getCentralWiki () : Wiki { |
|
| 38 | 38 | return $this->centralWiki; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * @return Wiki |
| 43 | 43 | */ |
| 44 | - public function getPrivateWiki() : Wiki { |
|
| 44 | + public function getPrivateWiki () : Wiki { |
|
| 45 | 45 | return $this->privateWiki; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -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,15 +14,15 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @inheritDoc |
| 16 | 16 | */ |
| 17 | - protected function getSubtasksMap(): array { |
|
| 17 | + protected function getSubtasksMap (): array { |
|
| 18 | 18 | // Everything is done here. |
| 19 | - return []; |
|
| 19 | + return [ ]; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @inheritDoc |
| 24 | 24 | */ |
| 25 | - public function runInternal() : int { |
|
| 25 | + public function runInternal () : int { |
|
| 26 | 26 | $pages = $this->getDataProvider()->getOpenPages(); |
| 27 | 27 | |
| 28 | 28 | if ( !$pages ) { |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | * @param PageRiconferma[] $pages |
| 37 | 37 | * @return int a STATUS_* constant |
| 38 | 38 | */ |
| 39 | - protected function processPages( array $pages ) : int { |
|
| 40 | - $donePages = []; |
|
| 39 | + protected function processPages ( array $pages ) : int { |
|
| 40 | + $donePages = [ ]; |
|
| 41 | 41 | foreach ( $pages as $page ) { |
| 42 | 42 | if ( $page->hasOpposition() && !$page->isVote() ) { |
| 43 | 43 | $this->openVote( $page ); |
| 44 | 44 | $this->updateBasePage( $page ); |
| 45 | - $donePages[] = $page; |
|
| 45 | + $donePages[ ] = $page; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param PageRiconferma $page |
| 62 | 62 | */ |
| 63 | - protected function openVote( PageRiconferma $page ) : void { |
|
| 63 | + protected function openVote ( PageRiconferma $page ) : void { |
|
| 64 | 64 | $this->getLogger()->info( "Starting vote on $page" ); |
| 65 | 65 | |
| 66 | 66 | $content = $page->getContent(); |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | * @see SimpleUpdates::updateVotazioni() |
| 100 | 100 | * @see OpenUpdates::addToVotazioni() |
| 101 | 101 | */ |
| 102 | - protected function updateVotazioni( array $pages ) : void { |
|
| 102 | + protected function updateVotazioni ( array $pages ) : void { |
|
| 103 | 103 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
| 104 | 104 | |
| 105 | - $users = []; |
|
| 105 | + $users = [ ]; |
|
| 106 | 106 | foreach ( $pages as $page ) { |
| 107 | - $users[] = $this->getUser( $page->getUserName() ); |
|
| 107 | + $users[ ] = $this->getUser( $page->getUserName() ); |
|
| 108 | 108 | } |
| 109 | 109 | $usersReg = RegexUtils::regexFromArray( '!', ...$users ); |
| 110 | 110 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param PageRiconferma $page |
| 139 | 139 | * @see \BotRiconferme\Task\Subtask\ClosePages::updateBasePage() |
| 140 | 140 | */ |
| 141 | - protected function updateBasePage( PageRiconferma $page ) : void { |
|
| 141 | + protected function updateBasePage ( PageRiconferma $page ) : void { |
|
| 142 | 142 | $this->getLogger()->info( "Updating base page for $page" ); |
| 143 | 143 | |
| 144 | 144 | if ( $page->getNum() === 1 ) { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @see SimpleUpdates::updateNews() |
| 166 | 166 | * @see OpenUpdates::addToNews() |
| 167 | 167 | */ |
| 168 | - protected function updateNews( int $amount ) : void { |
|
| 168 | + protected function updateNews ( int $amount ) : void { |
|
| 169 | 169 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
| 170 | 170 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
| 171 | 171 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | throw new TaskException( 'Param "voto" not found in news page' ); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $newTac = ( (int)$newsPage->getMatch( $regTac )[2] - $amount ) ?: ''; |
|
| 184 | - $newVot = ( (int)$newsPage->getMatch( $regVot )[2] + $amount ) ?: ''; |
|
| 183 | + $newTac = ( (int)$newsPage->getMatch( $regTac )[ 2 ] - $amount ) ?: ''; |
|
| 184 | + $newVot = ( (int)$newsPage->getMatch( $regVot )[ 2 ] + $amount ) ?: ''; |
|
| 185 | 185 | |
| 186 | 186 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
| 187 | 187 | $newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent ); |
@@ -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 | |
@@ -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\TaskHelper; |
| 4 | 4 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** @var User[]|null */ |
| 16 | 16 | private $processUsers; |
| 17 | 17 | /** @var PageRiconferma[] */ |
| 18 | - private $createdPages = []; |
|
| 18 | + private $createdPages = [ ]; |
|
| 19 | 19 | /** @var PageRiconferma[]|null */ |
| 20 | 20 | private $openPages; |
| 21 | 21 | /** @var PageRiconferma[]|null */ |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return User[] |
| 28 | 28 | */ |
| 29 | - public function getUsersToProcess() : array { |
|
| 29 | + public function getUsersToProcess () : array { |
|
| 30 | 30 | if ( $this->processUsers === null ) { |
| 31 | - $this->processUsers = []; |
|
| 31 | + $this->processUsers = [ ]; |
|
| 32 | 32 | foreach ( $this->getBotList()->getAdminsList() as $name => $userInfo ) { |
| 33 | 33 | if ( $this->shouldAddUser( $userInfo ) ) { |
| 34 | 34 | $this->processUsers[ $name ] = new User( $userInfo, $this->getWiki() ); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param UserInfo $ui |
| 46 | 46 | * @return bool |
| 47 | 47 | */ |
| 48 | - private function shouldAddUser( UserInfo $ui ) : bool { |
|
| 48 | + private function shouldAddUser ( UserInfo $ui ) : bool { |
|
| 49 | 49 | $timestamp = $this->getBotList()->getOverrideTimestamp( $ui ); |
| 50 | 50 | $override = $timestamp !== null; |
| 51 | 51 | |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return PageRiconferma[] |
| 65 | 65 | */ |
| 66 | - public function getOpenPages() : array { |
|
| 66 | + public function getOpenPages () : array { |
|
| 67 | 67 | if ( $this->openPages === null ) { |
| 68 | - $this->openPages = []; |
|
| 68 | + $this->openPages = [ ]; |
|
| 69 | 69 | $mainTitle = $this->getOpt( 'main-page-title' ); |
| 70 | 70 | $params = [ |
| 71 | 71 | 'action' => 'query', |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $pages = $this->getRequestFactory()->newFromParams( $params )->executeAsQuery(); |
| 80 | 80 | foreach ( $pages->current()->templates as $page ) { |
| 81 | 81 | if ( preg_match( "!$titleReg/[^/]+/\d!", $page->title ) ) { |
| 82 | - $this->openPages[] = new PageRiconferma( $page->title, $this->getWiki() ); |
|
| 82 | + $this->openPages[ ] = new PageRiconferma( $page->title, $this->getWiki() ); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return PageRiconferma[] |
| 94 | 94 | */ |
| 95 | - public function getPagesToClose() : array { |
|
| 95 | + public function getPagesToClose () : array { |
|
| 96 | 96 | if ( $this->pagesToClose === null ) { |
| 97 | - $this->pagesToClose = []; |
|
| 97 | + $this->pagesToClose = [ ]; |
|
| 98 | 98 | foreach ( $this->getOpenPages() as $page ) { |
| 99 | 99 | if ( time() > $page->getEndTimestamp() ) { |
| 100 | - $this->pagesToClose[] = $page; |
|
| 100 | + $this->pagesToClose[ ] = $page; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -109,21 +109,21 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param string $name |
| 111 | 111 | */ |
| 112 | - public function removeUser( string $name ) : void { |
|
| 112 | + public function removeUser ( string $name ) : void { |
|
| 113 | 113 | unset( $this->processUsers[ $name ] ); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * @return PageRiconferma[] |
| 118 | 118 | */ |
| 119 | - public function getCreatedPages() : array { |
|
| 119 | + public function getCreatedPages () : array { |
|
| 120 | 120 | return $this->createdPages; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @param PageRiconferma $page |
| 125 | 125 | */ |
| 126 | - public function addCreatedPage( PageRiconferma $page ) : void { |
|
| 127 | - $this->createdPages[] = $page; |
|
| 126 | + public function addCreatedPage ( PageRiconferma $page ) : void { |
|
| 127 | + $this->createdPages[ ] = $page; |
|
| 128 | 128 | } |
| 129 | 129 | } |