Passed
Push — master ( 2ef02f...fd3159 )
by Daimona
01:56
created
includes/Page/PageRiconferma.php 1 patch
Spacing   +17 added lines, -17 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\Page;
4 4
 
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @return string
25 25
 	 */
26
-	public function getUser() : string {
27
-		return explode( '/', $this->title )[2];
26
+	public function getUser () : string {
27
+		return explode( '/', $this->title )[ 2 ];
28 28
 	}
29 29
 
30 30
 	/**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return int
34 34
 	 */
35
-	public function getNum() : int {
35
+	public function getNum () : int {
36 36
 		$bits = explode( '/', $this->getTitle() );
37 37
 		return intval( end( $bits ) );
38 38
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return string
44 44
 	 */
45
-	public function getUserNum() : string {
46
-		return explode( '/', $this->getTitle(), 3 )[2];
45
+	public function getUserNum () : string {
46
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
47 47
 	}
48 48
 
49 49
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return string
53 53
 	 */
54
-	public function getBaseTitle() : string {
54
+	public function getBaseTitle () : string {
55 55
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
56 56
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
57 57
 	}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return int
63 63
 	 */
64
-	public function getOpposingCount() : int {
64
+	public function getOpposingCount () : int {
65 65
 		return $this->getCountForSection( self::SECTION_OPPOSE );
66 66
 	}
67 67
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return int
72 72
 	 */
73
-	public function getSupportCount() : int {
73
+	public function getSupportCount () : int {
74 74
 		return $this->getCountForSection( self::SECTION_SUPPORT );
75 75
 	}
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param int $secNum
81 81
 	 * @return int
82 82
 	 */
83
-	protected function getCountForSection( int $secNum ) : int {
83
+	protected function getCountForSection ( int $secNum ) : int {
84 84
 		$content = $this->controller->getPageContent( $this->title, $secNum );
85 85
 		// Let's hope that this is good enough...
86 86
 		return substr_count( $content, "\n\# *(?![#*])" );
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return int
93 93
 	 */
94
-	protected function getQuorum() : int {
94
+	protected function getQuorum () : int {
95 95
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
96
-		return intval( $this->getMatch( $reg )[1] );
96
+		return intval( $this->getMatch( $reg )[ 1 ] );
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return bool
103 103
 	 */
104
-	public function hasOpposition() : bool {
104
+	public function hasOpposition () : bool {
105 105
 		return $this->getOpposingCount() >= 15;
106 106
 	}
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return int One of the OUTCOME_* constants
112 112
 	 * @throws \BadMethodCallException
113 113
 	 */
114
-	public function getOutcome() : int {
114
+	public function getOutcome () : int {
115 115
 		if ( !$this->isVote() ) {
116 116
 			throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' );
117 117
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @throws \BadMethodCallException
132 132
 	 * @throws \LogicException
133 133
 	 */
134
-	public function getOutcomeText() : string {
134
+	public function getOutcomeText () : string {
135 135
 		if ( !$this->isVote() ) {
136 136
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
137 137
 		}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return bool
167 167
 	 */
168
-	public function isVote() : bool {
168
+	public function isVote () : bool {
169 169
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
170 170
 		return $this->matches( $sectionReg );
171 171
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return int
177 177
 	 */
178
-	public function getEndTimestamp() : int {
178
+	public function getEndTimestamp () : int {
179 179
 		if ( $this->isVote() ) {
180 180
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
181 181
 			list( , $day, $hours ) = $this->getMatch( $reg );
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +16 added lines, -16 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 run() : TaskResult {
26
+	public function run () : TaskResult {
27 27
 		$this->getLogger()->info( 'Starting task StartVote' );
28 28
 
29 29
 		$pages = $this->getDataProvider()->getOpenPages();
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @param PageRiconferma[] $pages
43 43
 	 */
44
-	protected function processPages( array $pages ) {
45
-		$actualPages = [];
44
+	protected function processPages ( array $pages ) {
45
+		$actualPages = [ ];
46 46
 		foreach ( $pages as $page ) {
47 47
 			if ( $page->hasOpposition() && !$page->isVote() ) {
48 48
 				$this->openVote( $page );
49
-				$actualPages[] = $page;
49
+				$actualPages[ ] = $page;
50 50
 			}
51 51
 		}
52 52
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param PageRiconferma $page
65 65
 	 */
66
-	protected function openVote( PageRiconferma $page ) {
66
+	protected function openVote ( PageRiconferma $page ) {
67 67
 		$this->getLogger()->info( "Starting vote on $page" );
68 68
 
69 69
 		$content = $page->getContent();
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 	 * @see SimpleUpdates::updateVote()
103 103
 	 * @see UpdatesAround::addVote()
104 104
 	 */
105
-	protected function updateVotePage( array $pages ) {
105
+	protected function updateVotePage ( array $pages ) {
106 106
 		$votePage = new Page( $this->getConfig()->get( 'ric-vote-page' ) );
107 107
 		$content = $votePage->getContent();
108 108
 
109
-		$titles = [];
109
+		$titles = [ ];
110 110
 		foreach ( $pages as $page ) {
111
-			$titles[] = preg_quote( $page->getTitle() );
111
+			$titles[ ] = preg_quote( $page->getTitle() );
112 112
 		}
113 113
 		$titleReg = implode( '|', $titles );
114 114
 		$search = "!^\*.+ La \[\[($titleReg)\|procedura]] termina.+\n!gm";
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 );
132 132
 		} else {
133 133
 			// Start section
134
-			$matches = [];
134
+			$matches = [ ];
135 135
 			if ( preg_match( $introReg, $newContent, $matches ) === false ) {
136 136
 				throw new TaskException( 'Intro not found in vote page' );
137 137
 			}
138 138
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
139 139
 			// Replace semicolon with full stop
140 140
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
141
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 );
141
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 );
142 142
 		}
143 143
 
144 144
 		$summary = $this->msg( 'vote-start-vote-page-summary' )
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @see UpdatesAround::addNews()
161 161
 	 * @see SimpleUpdates::updateNews()
162 162
 	 */
163
-	protected function updateNews( int $amount ) {
163
+	protected function updateNews ( int $amount ) {
164 164
 		$this->getLogger()->info( "Turning $amount pages into votes" );
165 165
 		$newsPage = new Page( $this->getConfig()->get( 'ric-news-page' ) );
166 166
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			throw new TaskException( 'Param "voto" not found in news page' );
176 176
 		}
177 177
 
178
-		$newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: '';
179
-		$newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: '';
178
+		$newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: '';
179
+		$newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: '';
180 180
 
181 181
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
182 182
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
Please login to merge, or discard this patch.
includes/WikiController.php 1 patch
Spacing   +12 added lines, -12 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;
4 4
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	/**
25 25
 	 * @param string $domain The URL of the wiki, if different from default
26 26
 	 */
27
-	public function __construct( string $domain = DEFAULT_URL ) {
27
+	public function __construct ( string $domain = DEFAULT_URL ) {
28 28
 		$this->logger = new Logger;
29 29
 		$this->domain = $domain;
30 30
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return string
38 38
 	 * @throws MissingPageException
39 39
 	 */
40
-	public function getPageContent( string $title, int $section = null ) : string {
40
+	public function getPageContent ( string $title, int $section = null ) : string {
41 41
 		$this->logger->debug( "Retrieving page $title" );
42 42
 		$params = [
43 43
 			'action' => 'query',
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		];
49 49
 
50 50
 		if ( $section !== null ) {
51
-			$params['rvsection'] = $section;
51
+			$params[ 'rvsection' ] = $section;
52 52
 		}
53 53
 
54 54
 		$req = RequestBase::newFromParams( $params )->setUrl( $this->domain );
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			throw new MissingPageException( $title );
59 59
 		}
60 60
 
61
-		return $page->revisions[0]->slots->main->{ '*' };
61
+		return $page->revisions[ 0 ]->slots->main->{ '*' };
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param array $params
68 68
 	 * @throws EditException
69 69
 	 */
70
-	public function editPage( array $params ) {
70
+	public function editPage ( array $params ) {
71 71
 		$this->login();
72 72
 
73 73
 		$params = [
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
90 90
 	 * @throws LoginException
91 91
 	 */
92
-	public function login() {
92
+	public function login () {
93 93
 		if ( self::$loggedIn ) {
94 94
 			$this->logger->debug( 'Already logged in' );
95 95
 			return;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 		self::$loggedIn = true;
118 118
 		// Clear tokens cache
119
-		$this->tokens = [];
119
+		$this->tokens = [ ];
120 120
 		$this->logger->info( 'Login succeeded' );
121 121
 	}
122 122
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param string $type
127 127
 	 * @return string
128 128
 	 */
129
-	public function getToken( string $type ) : string {
129
+	public function getToken ( string $type ) : string {
130 130
 		if ( !isset( $this->tokens[ $type ] ) ) {
131 131
 			$params = [
132 132
 				'action' => 'query',
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @param string $title
150 150
 	 * @return int
151 151
 	 */
152
-	public function getPageCreationTS( string $title ) : int {
152
+	public function getPageCreationTS ( string $title ) : int {
153 153
 		$params = [
154 154
 			'action' => 'query',
155 155
 			'prop' => 'revisions',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 		$res = RequestBase::newFromParams( $params )->setUrl( $this->domain )->execute();
164 164
 		$data = $res->query->pages;
165
-		return strtotime( reset( $data )->revisions[0]->timestamp );
165
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
166 166
 	}
167 167
 
168 168
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param string $title
172 172
 	 * @param string $reason
173 173
 	 */
174
-	public function protectPage( string $title, string $reason ) {
174
+	public function protectPage ( string $title, string $reason ) {
175 175
 		$this->logger->info( "Protecting page $title" );
176 176
 		$this->login();
177 177
 
Please login to merge, or discard this patch.
includes/Message.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;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @param string $key
16 16
 	 */
17
-	public function __construct( string $key ) {
17
+	public function __construct ( string $key ) {
18 18
 		$this->key = $key;
19 19
 		$this->value = Config::getInstance()->getWikiMessage( $key );
20 20
 	}
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param array $args
24 24
 	 * @return self
25 25
 	 */
26
-	public function params( array $args ) : self {
26
+	public function params ( array $args ) : self {
27 27
 		$this->value = strtr( $this->value, $args );
28 28
 		return $this;
29 29
 	}
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * @return string
33 33
 	 */
34
-	public function text() : string {
34
+	public function text () : string {
35 35
 		$this->parsePlurals();
36 36
 		return $this->value;
37 37
 	}
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * Replace {{$plur|<amount>|sing|plur}}
41 41
 	 */
42
-	protected function parsePlurals() {
42
+	protected function parsePlurals () {
43 43
 		$this->value = preg_replace_callback(
44 44
 			'!\{\{$plur|(?P<amount>\d+)|(?P<sing>[^}|]+)|(?P<plur>[^|}]+)}}!',
45 45
 			function ( $matches ) {
46
-				return intval( $matches['amount'] ) > 1 ? trim( $matches['plur'] ) : trim( $matches['sing'] );
46
+				return intval( $matches[ 'amount' ] ) > 1 ? trim( $matches[ 'plur' ] ) : trim( $matches[ 'sing' ] );
47 47
 			},
48 48
 			$this->value
49 49
 		);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param int $timestamp
56 56
 	 * @return string
57 57
 	 */
58
-	public static function getTimeWithArticle( int $timestamp ) : string {
58
+	public static function getTimeWithArticle ( int $timestamp ) : string {
59 59
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
60 60
 		$timeString = strftime( '%e %B alle %R', $timestamp );
61 61
 		// Remove the left space if day has a single digit
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	 * @return int
74 74
 	 * @todo Is there a better way?
75 75
 	 */
76
-	public static function getTimestampFromLocalTime( string $timeString ) : int {
76
+	public static function getTimestampFromLocalTime ( string $timeString ) : int {
77 77
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
78 78
 		$bits = strptime( $timeString, '%e %m %Y alle %H:%M' );
79 79
 		$timestamp = mktime(
80
-			$bits['tm_hour'],
81
-			$bits['tm_min'],
80
+			$bits[ 'tm_hour' ],
81
+			$bits[ 'tm_min' ],
82 82
 			0,
83
-			$bits['tm_mon'] + 1,
84
-			$bits['tm_mday'],
85
-			$bits['tm_year'] + 1900
83
+			$bits[ 'tm_mon' ] + 1,
84
+			$bits[ 'tm_mday' ],
85
+			$bits[ 'tm_year' ] + 1900
86 86
 		);
87 87
 		setlocale( LC_TIME, $oldLoc );
88 88
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	 * @param string $emptyText
98 98
 	 * @return string
99 99
 	 */
100
-	public static function commaList( array $data, string $emptyText = 'nessuno' ) : string {
100
+	public static function commaList ( array $data, string $emptyText = 'nessuno' ) : string {
101 101
 		if ( count( $data ) > 1 ) {
102 102
 			$last = array_pop( $data );
103 103
 			$ret = implode( ', ', $data ) . " e $last";
104 104
 		} elseif ( $data ) {
105
-			$ret = $data[0];
105
+			$ret = $data[ 0 ];
106 106
 		} else {
107 107
 			$ret = $emptyText;
108 108
 		}
Please login to merge, or discard this patch.
includes/Task/Subtask/FailedUpdates.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\Subtask;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task FailedUpdates' );
19 19
 
20 20
 		$failed = $this->getFailures();
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @return PageRiconferma[]
36 36
 	 */
37
-	private function getFailures() : array {
38
-		$ret = [];
37
+	private function getFailures () : array {
38
+		$ret = [ ];
39 39
 		$allPages = $this->getDataProvider()->getPagesToClose();
40 40
 		foreach ( $allPages as $page ) {
41 41
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
42
-				$ret[] = $page;
42
+				$ret[ ] = $page;
43 43
 			}
44 44
 		}
45 45
 		return $ret;
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * @param PageRiconferma[] $pages
50 50
 	 */
51
-	protected function updateBurList( array $pages ) {
51
+	protected function updateBurList ( array $pages ) {
52 52
 		$this->getLogger()->info( 'Checking if bur list needs updating.' );
53 53
 		$admins = $this->getDataProvider()->getUsersList();
54 54
 
55
-		$remove = [];
55
+		$remove = [ ];
56 56
 		foreach ( $pages as $page ) {
57 57
 			$user = $page->getUser();
58 58
 			if ( array_key_exists( 'bureaucrat', $admins[ $user ] ) &&
59 59
 				$page->getOutcome() & PageRiconferma::OUTCOME_FAIL
60 60
 			) {
61
-				$remove[] = $user;
61
+				$remove[ ] = $user;
62 62
 			}
63 63
 		}
64 64
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @param PageRiconferma[] $pages
90 90
 	 */
91
-	protected function requestRemoval( array $pages ) {
91
+	protected function requestRemoval ( array $pages ) {
92 92
 		$this->getLogger()->info(
93 93
 			'Requesting removal on meta for: ' . implode( ', ', array_map( 'strval', $pages ) )
94 94
 		);
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @param PageRiconferma[] $pages
132 132
 	 */
133
-	protected function updateAnnunci( array $pages ) {
133
+	protected function updateAnnunci ( array $pages ) {
134 134
 		$this->getLogger()->info( 'Updating annunci' );
135 135
 
136
-		$names = [];
136
+		$names = [ ];
137 137
 		$text = '';
138 138
 		foreach ( $pages as $page ) {
139 139
 			$user = $page->getUser();
140
-			$names[] = $user;
140
+			$names[ ] = $user;
141 141
 			$text .= "{{Breve|admin|{{subst:#time:j}}|[[Utente:$user|]] " .
142 142
 				"non è stato riconfermato [[WP:A|amministratore]].}}\n";
143 143
 		}
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @param PageRiconferma[] $pages
173 173
 	 */
174
-	protected function updateUltimeNotizie( array $pages ) {
174
+	protected function updateUltimeNotizie ( array $pages ) {
175 175
 		$this->getLogger()->info( 'Updating ultime notizie' );
176 176
 		$notiziePage = new Page( $this->getConfig()->get( 'ultimenotizie-title' ) );
177 177
 
178
-		$names = [];
178
+		$names = [ ];
179 179
 		$text = '';
180 180
 		foreach ( $pages as $page ) {
181 181
 			$user = $page->getUser();
182 182
 			$title = $page->getTitle();
183
-			$names[] = $user;
183
+			$names[ ] = $user;
184 184
 			$text .= "'''{{subst:#time:j F}}''': [[Utente:$user|]] non è stato [[$title|riconfermato]] " .
185 185
 				'[[WP:A|amministratore]]; ora gli admin sono {{subst:#expr: {{NUMBEROFADMINS}} - 1}}.';
186 186
 		}
Please login to merge, or discard this patch.
includes/Task/Subtask/SimpleUpdates.php 1 patch
Spacing   +16 added lines, -16 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task SimpleUpdates' );
19 19
 
20 20
 		$pages = $this->getDataProvider()->getPagesToClose();
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 	 * @param PageRiconferma[] $pages
32 32
 	 * @see UpdatesAround::addVote()
33 33
 	 */
34
-	protected function updateVote( array $pages ) {
34
+	protected function updateVote ( array $pages ) {
35 35
 		$this->getLogger()->info(
36 36
 			'Updating votazioni: ' . implode( ', ', array_map( 'strval', $pages ) )
37 37
 		);
38 38
 		$votePage = new Page( $this->getConfig()->get( 'ric-vote-page' ) );
39 39
 
40
-		$titles = [];
40
+		$titles = [ ];
41 41
 		foreach ( $pages as $page ) {
42
-			$titles[] = preg_quote( $page->getTitle() );
42
+			$titles[ ] = preg_quote( $page->getTitle() );
43 43
 		}
44 44
 
45 45
 		$titleReg = implode( '|', $titles );
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param array $pages
69 69
 	 * @see UpdatesAround::addNews()
70 70
 	 */
71
-	protected function updateNews( array $pages ) {
71
+	protected function updateNews ( array $pages ) {
72 72
 		$simpleAmount = $voteAmount = 0;
73 73
 		foreach ( $pages as $page ) {
74 74
 			if ( $page->isVote() ) {
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
92 92
 		$voteMatches = $newsPage->getMatch( $voteReg );
93 93
 
94
-		$newSimp = (int)$simpleMatches[2] - $simpleAmount ?: '';
95
-		$newVote = (int)$voteMatches[2] - $voteAmount ?: '';
94
+		$newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: '';
95
+		$newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: '';
96 96
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content );
97 97
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
98 98
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param PageRiconferma[] $pages
112 112
 	 */
113
-	protected function updateAdminList( array $pages ) {
113
+	protected function updateAdminList ( array $pages ) {
114 114
 		$this->getLogger()->info(
115 115
 			'Updating admin list: ' . implode( ', ', array_map( 'strval', $pages ) )
116 116
 		);
@@ -118,17 +118,17 @@  discard block
 block discarded – undo
118 118
 		$newContent = $adminsPage->getContent();
119 119
 		$newDate = date( 'Ymd', strtotime( '+1 year' ) );
120 120
 
121
-		$riconfNames = $removeNames = [];
121
+		$riconfNames = $removeNames = [ ];
122 122
 		foreach ( $pages as $page ) {
123 123
 			$user = $page->getUser();
124 124
 			$reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!";
125 125
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
126 126
 				// Remove the line
127 127
 				$newContent = preg_replace( $reg, '', $newContent );
128
-				$removeNames[] = $user;
128
+				$removeNames[ ] = $user;
129 129
 			} else {
130 130
 				$newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent );
131
-				$riconfNames[] = $user;
131
+				$riconfNames[ ] = $user;
132 132
 			}
133 133
 		}
134 134
 
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 	/**
149 149
 	 * @param PageRiconferma[] $pages
150 150
 	 */
151
-	protected function updateCUList( array $pages ) {
151
+	protected function updateCUList ( array $pages ) {
152 152
 		$this->getLogger()->info( 'Checking if CU list needs updating.' );
153 153
 		$cuList = new Page( $this->getConfig()->get( 'cu-list-title' ) );
154 154
 		$admins = $this->getDataProvider()->getUsersList();
155 155
 		$newContent = $cuList->getContent();
156 156
 
157
-		$riconfNames = $removeNames = [];
157
+		$riconfNames = $removeNames = [ ];
158 158
 		foreach ( $pages as $page ) {
159 159
 			$user = $page->getUser();
160 160
 			if ( array_key_exists( 'checkuser', $admins[ $user ] ) ) {
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 				if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
163 163
 					// Remove the line
164 164
 					$newContent = preg_replace( $reg, '', $newContent );
165
-					$removeNames[] = $user;
165
+					$removeNames[ ] = $user;
166 166
 				} else {
167 167
 					$newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent );
168
-					$riconfNames[] = $user;
168
+					$riconfNames[ ] = $user;
169 169
 				}
170 170
 			}
171 171
 		}
Please login to merge, or discard this patch.
includes/Task/Subtask/ArchivePages.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task ArchivePages' );
19 19
 
20 20
 		$pages = $this->getDataProvider()->getPagesToClose();
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 	 * @param PageRiconferma[] $pages
32 32
 	 * @see UpdatesAround::addToMainPage()
33 33
 	 */
34
-	protected function removeFromMainPage( array $pages ) {
34
+	protected function removeFromMainPage ( array $pages ) {
35 35
 		$this->getLogger()->info(
36 36
 			'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) )
37 37
 		);
38 38
 
39 39
 		$mainPage = new Page( $this->getConfig()->get( 'ric-main-page' ) );
40
-		$remove = [];
40
+		$remove = [ ];
41 41
 		foreach ( $pages as $page ) {
42
-			$remove[] = '{{' . $page->getTitle() . '}}';
42
+			$remove[ ] = '{{' . $page->getTitle() . '}}';
43 43
 		}
44 44
 
45 45
 		$mainPage->edit( [
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param PageRiconferma[] $pages
55 55
 	 */
56
-	protected function addToArchive( array $pages ) {
56
+	protected function addToArchive ( array $pages ) {
57 57
 		$this->getLogger()->info(
58 58
 			'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) )
59 59
 		);
60 60
 
61
-		$simple = $votes = [];
61
+		$simple = $votes = [ ];
62 62
 		foreach ( $pages as $page ) {
63 63
 			if ( $page->isVote() ) {
64
-				$votes[] = $page;
64
+				$votes[ ] = $page;
65 65
 			} else {
66
-				$simple[] = $page;
66
+				$simple[ ] = $page;
67 67
 			}
68 68
 		}
69 69
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 * @param string $archiveTitle
81 81
 	 * @param array $pages
82 82
 	 */
83
-	private function reallyAddToArchive( string $archiveTitle, array $pages ) {
83
+	private function reallyAddToArchive ( string $archiveTitle, array $pages ) {
84 84
 		$archivePage = new Page( "$archiveTitle/" . date( 'Y' ) );
85 85
 
86 86
 		$append = '';
87
-		$archivedList = [];
87
+		$archivedList = [ ];
88 88
 		foreach ( $pages as $page ) {
89 89
 			$append .= '{{' . $page->getTitle() . "}}\n";
90
-			$archivedList[] = $page->getUserNum();
90
+			$archivedList[ ] = $page->getUserNum();
91 91
 		}
92 92
 
93 93
 		$summary = $this->msg( 'close-archive-summary' )
Please login to merge, or discard this patch.