Passed
Push — master ( 28b5dd...57ce19 )
by Daimona
01:49
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,12 +37,12 @@  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
-				$donePages[] = $page;
45
+				$donePages[ ] = $page;
46 46
 			}
47 47
 		}
48 48
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
138 138
 	 * @param PageRiconferma $page
139 139
 	 * @see 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
 block discarded – undo
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
 block discarded – undo
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 );
Please login to merge, or discard this patch.
includes/Task/Subtask/ClosePages.php 1 patch
Spacing   +5 added lines, -6 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\Subtask;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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', $text, $current );
Please login to merge, or discard this patch.