Passed
Push — master ( 1be95c...86a446 )
by Daimona
06:30 queued 01:10
created
includes/Task/Subtask/SimpleUpdates.php 1 patch
Spacing   +21 added lines, -21 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
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @inheritDoc
19 19
 	 */
20
-	public function runInternal() : int {
20
+	public function runInternal () : int {
21 21
 		$pages = $this->getDataProvider()->getPagesToClose();
22 22
 
23 23
 		if ( !$pages ) {
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 	 * @param PageRiconferma[] $pages
40 40
 	 * @see OpenUpdates::addToVotazioni()
41 41
 	 */
42
-	protected function updateVotazioni( array $pages ) {
42
+	protected function updateVotazioni ( array $pages ) {
43 43
 		$this->getLogger()->info(
44 44
 			'Updating votazioni: ' . implode( ', ', $pages )
45 45
 		);
46 46
 		$votePage = new Page( $this->getOpt( 'vote-page-title' ) );
47 47
 
48
-		$users = [];
48
+		$users = [ ];
49 49
 		foreach ( $pages as $page ) {
50
-			$users[] = $page->getUser();
50
+			$users[ ] = $page->getUser();
51 51
 		}
52 52
 		$usersReg = Element::regexFromArray( $users );
53 53
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param array $pages
69 69
 	 * @see OpenUpdates::addToNews()
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() ) {
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
89 89
 		$voteMatches = $newsPage->getMatch( $voteReg );
90 90
 
91
-		$newSimp = (int)$simpleMatches[2] - $simpleAmount ?: '';
92
-		$newVote = (int)$voteMatches[2] - $voteAmount ?: '';
91
+		$newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: '';
92
+		$newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: '';
93 93
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $newsPage->getContent() );
94 94
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
95 95
 
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @param bool[] $outcomes
109 109
 	 */
110
-	protected function updateAdminList( array $outcomes ) {
110
+	protected function updateAdminList ( array $outcomes ) {
111 111
 		$this->getLogger()->info( 'Updating admin list' );
112 112
 		$adminsPage = new Page( $this->getOpt( 'admins-list-title' ) );
113 113
 		$newContent = $adminsPage->getContent();
114 114
 
115
-		$riconfNames = $removeNames = [];
115
+		$riconfNames = $removeNames = [ ];
116 116
 		foreach ( $outcomes as $username => $confirmed ) {
117 117
 			$user = new User( $username );
118 118
 			$userReg = $user->getRegex();
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 					'${1}' . date( 'Ymd' ) . '|' . $nextDate . '$2',
125 125
 					$newContent
126 126
 				);
127
-				$riconfNames[] = $username;
127
+				$riconfNames[ ] = $username;
128 128
 			} else {
129 129
 				$newContent = preg_replace( $reg, '', $newContent );
130
-				$removeNames[] = $username;
130
+				$removeNames[ ] = $username;
131 131
 			}
132 132
 		}
133 133
 
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 	 * @param User $user
151 151
 	 * @return int
152 152
 	 */
153
-	private function getNextTs( User $user ) : int {
153
+	private function getNextTs ( User $user ) : int {
154 154
 		// If there's an "override", we ignore it, supposing that it's been already used for
155 155
 		// this time, but not yet removed in UpdateList. This will also discard "override"s added
156 156
 		// for the next year before the procedure is closed.
157 157
 		// @todo Avoid the limitation above
158 158
 		$groups = $user->getGroups();
159
-		if ( isset( $groups['override-perm'] ) ) {
159
+		if ( isset( $groups[ 'override-perm' ] ) ) {
160 160
 			$date = \DateTime::createFromFormat(
161 161
 				'd/m/Y',
162
-				$groups['override-perm'] . '/' . date( 'Y' )
162
+				$groups[ 'override-perm' ] . '/' . date( 'Y' )
163 163
 			);
164 164
 			if ( $date < new \DateTime ) {
165 165
 				$date->modify( '+1 year' );
@@ -172,21 +172,21 @@  discard block
 block discarded – undo
172 172
 	/**
173 173
 	 * @param bool[] $outcomes
174 174
 	 */
175
-	protected function updateCUList( array $outcomes ) {
175
+	protected function updateCUList ( array $outcomes ) {
176 176
 		$this->getLogger()->info( 'Updating CU list.' );
177 177
 		$cuList = new Page( $this->getOpt( 'cu-list-title' ) );
178 178
 		$newContent = $cuList->getContent();
179 179
 
180
-		$riconfNames = $removeNames = [];
180
+		$riconfNames = $removeNames = [ ];
181 181
 		foreach ( $outcomes as $user => $confirmed ) {
182 182
 			$userReg = ( new User( $user ) )->getRegex();
183 183
 			$reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!";
184 184
 			if ( $confirmed ) {
185 185
 				$newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent );
186
-				$riconfNames[] = $user;
186
+				$riconfNames[ ] = $user;
187 187
 			} else {
188 188
 				$newContent = preg_replace( $reg, '', $newContent );
189
-				$removeNames[] = $user;
189
+				$removeNames[ ] = $user;
190 190
 			}
191 191
 		}
192 192
 
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 * @param PageRiconferma[] $pages
211 211
 	 * @return bool[]
212 212
 	 */
213
-	private function getGroupOutcomes( string $group, array $pages ) : array {
214
-		$ret = [];
213
+	private function getGroupOutcomes ( string $group, array $pages ) : array {
214
+		$ret = [ ];
215 215
 		foreach ( $pages as $page ) {
216 216
 			$user = $page->getUser();
217 217
 			if ( $user->inGroup( $group ) ) {
Please login to merge, or discard this patch.