@@ -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,12 +37,12 @@ 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 | - $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 ) { |
|
| 63 | + protected function openVote ( PageRiconferma $page ) { |
|
| 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 ) { |
|
| 102 | + protected function updateVotazioni ( array $pages ) { |
|
| 103 | 103 | $votePage = new Page( $this->getOpt( 'vote-page-title' ) ); |
| 104 | 104 | |
| 105 | - $users = []; |
|
| 105 | + $users = [ ]; |
|
| 106 | 106 | foreach ( $pages as $page ) { |
| 107 | - $users[] = $page->getUser(); |
|
| 107 | + $users[ ] = $page->getUser(); |
|
| 108 | 108 | } |
| 109 | 109 | $usersReg = Element::regexFromArray( $users ); |
| 110 | 110 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @see SimpleUpdates::updateNews() |
| 143 | 143 | * @see OpenUpdates::addToNews() |
| 144 | 144 | */ |
| 145 | - protected function updateNews( int $amount ) { |
|
| 145 | + protected function updateNews ( int $amount ) { |
|
| 146 | 146 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
| 147 | 147 | $newsPage = new Page( $this->getOpt( 'news-page-title' ) ); |
| 148 | 148 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | throw new TaskException( 'Param "voto" not found in news page' ); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: ''; |
|
| 161 | - $newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: ''; |
|
| 160 | + $newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: ''; |
|
| 161 | + $newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: ''; |
|
| 162 | 162 | |
| 163 | 163 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
| 164 | 164 | $newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent ); |