Passed
Push — master ( 57ce19...2f436c )
by Daimona
01:58
created
includes/Task/StartVote.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 );
Please login to merge, or discard this patch.