@@ -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,15 +15,15 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @inheritDoc |
| 17 | 17 | */ |
| 18 | - protected function getSubtasksMap(): array { |
|
| 18 | + protected function getSubtasksMap (): array { |
|
| 19 | 19 | // Everything is done here. |
| 20 | - return []; |
|
| 20 | + return [ ]; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @inheritDoc |
| 25 | 25 | */ |
| 26 | - public function runInternal() : int { |
|
| 26 | + public function runInternal () : int { |
|
| 27 | 27 | $pages = $this->getDataProvider()->getOpenPages(); |
| 28 | 28 | |
| 29 | 29 | if ( !$pages ) { |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | * @param PageRiconferma[] $pages |
| 38 | 38 | * @return int a STATUS_* constant |
| 39 | 39 | */ |
| 40 | - protected function processPages( array $pages ) : int { |
|
| 41 | - $donePages = []; |
|
| 40 | + protected function processPages ( array $pages ) : int { |
|
| 41 | + $donePages = [ ]; |
|
| 42 | 42 | foreach ( $pages as $page ) { |
| 43 | 43 | if ( $page->hasOpposition() && !$page->isVote() ) { |
| 44 | 44 | $this->openVote( $page ); |
| 45 | 45 | $this->updateBasePage( $page ); |
| 46 | - $donePages[] = $page; |
|
| 46 | + $donePages[ ] = $page; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @param PageRiconferma $page |
| 63 | 63 | */ |
| 64 | - protected function openVote( PageRiconferma $page ) : void { |
|
| 64 | + protected function openVote ( PageRiconferma $page ) : void { |
|
| 65 | 65 | $this->getLogger()->info( "Starting vote on $page" ); |
| 66 | 66 | |
| 67 | 67 | $content = $page->getContent(); |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | * @see SimpleUpdates::updateVotazioni() |
| 101 | 101 | * @see OpenUpdates::addToVotazioni() |
| 102 | 102 | */ |
| 103 | - protected function updateVotazioni( array $pages ) : void { |
|
| 103 | + protected function updateVotazioni ( array $pages ) : void { |
|
| 104 | 104 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
| 105 | 105 | |
| 106 | - $users = []; |
|
| 106 | + $users = [ ]; |
|
| 107 | 107 | foreach ( $pages as $page ) { |
| 108 | - $users[] = $this->getUser( $page->getUserName() ); |
|
| 108 | + $users[ ] = $this->getUser( $page->getUserName() ); |
|
| 109 | 109 | } |
| 110 | 110 | $usersReg = RegexUtils::regexFromArray( '!', ...$users ); |
| 111 | 111 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param PageRiconferma $page |
| 140 | 140 | * @see ClosePages::updateBasePage() |
| 141 | 141 | */ |
| 142 | - protected function updateBasePage( PageRiconferma $page ) : void { |
|
| 142 | + protected function updateBasePage ( PageRiconferma $page ) : void { |
|
| 143 | 143 | $this->getLogger()->info( "Updating base page for $page" ); |
| 144 | 144 | |
| 145 | 145 | if ( $page->getNum() === 1 ) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @see SimpleUpdates::updateNews() |
| 167 | 167 | * @see OpenUpdates::addToNews() |
| 168 | 168 | */ |
| 169 | - protected function updateNews( int $amount ) : void { |
|
| 169 | + protected function updateNews ( int $amount ) : void { |
|
| 170 | 170 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
| 171 | 171 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
| 172 | 172 | |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | throw new TaskException( 'Param "voto" not found in news page' ); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $newTac = ( (int)$newsPage->getMatch( $regTac )[2] - $amount ) ?: ''; |
|
| 185 | - $newVot = ( (int)$newsPage->getMatch( $regVot )[2] + $amount ) ?: ''; |
|
| 184 | + $newTac = ( (int)$newsPage->getMatch( $regTac )[ 2 ] - $amount ) ?: ''; |
|
| 185 | + $newVot = ( (int)$newsPage->getMatch( $regVot )[ 2 ] + $amount ) ?: ''; |
|
| 186 | 186 | |
| 187 | 187 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
| 188 | 188 | $newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent ); |