Passed
Push — master ( d9b4e0...efcd2b )
by Daimona
01:45
created
includes/Task/Subtask/SimpleUpdates.php 1 patch
Spacing   +23 added lines, -23 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
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @inheritDoc
18 18
 	 */
19
-	public function runInternal() : int {
19
+	public function runInternal () : int {
20 20
 		$pages = $this->getDataProvider()->getPagesToClose();
21 21
 
22 22
 		if ( !$pages ) {
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	 * @param PageRiconferma[] $pages
39 39
 	 * @see OpenUpdates::addToVotazioni()
40 40
 	 */
41
-	protected function updateVotazioni( array $pages ) {
41
+	protected function updateVotazioni ( array $pages ) {
42 42
 		$this->getLogger()->info(
43 43
 			'Updating votazioni: ' . implode( ', ', $pages )
44 44
 		);
45 45
 		$votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) );
46 46
 
47
-		$users = [];
47
+		$users = [ ];
48 48
 		foreach ( $pages as $page ) {
49
-			$users[] = $page->getUser();
49
+			$users[ ] = $page->getUser();
50 50
 		}
51 51
 		$usersReg = Element::regexFromArray( $users );
52 52
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param array $pages
68 68
 	 * @see OpenUpdates::addToNews()
69 69
 	 */
70
-	protected function updateNews( array $pages ) {
70
+	protected function updateNews ( array $pages ) {
71 71
 		$simpleAmount = $voteAmount = 0;
72 72
 		foreach ( $pages as $page ) {
73 73
 			if ( $page->isVote() ) {
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
88 88
 		$voteMatches = $newsPage->getMatch( $voteReg );
89 89
 
90
-		$newSimp = ( (int)$simpleMatches[2] - $simpleAmount ) ?: '';
91
-		$newVote = ( (int)$voteMatches[2] - $voteAmount ) ?: '';
90
+		$newSimp = ( (int)$simpleMatches[ 2 ] - $simpleAmount ) ?: '';
91
+		$newVote = ( (int)$voteMatches[ 2 ] - $voteAmount ) ?: '';
92 92
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $newsPage->getContent() );
93 93
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
94 94
 
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @param bool[] $outcomes
108 108
 	 */
109
-	protected function updateAdminList( array $outcomes ) {
109
+	protected function updateAdminList ( array $outcomes ) {
110 110
 		$this->getLogger()->info( 'Updating admin list' );
111 111
 		$adminsPage = $this->getPage( $this->getOpt( 'admins-list-title' ) );
112 112
 		$newContent = $adminsPage->getContent();
113 113
 
114
-		$riconfNames = $removeNames = [];
114
+		$riconfNames = $removeNames = [ ];
115 115
 		foreach ( $outcomes as $username => $confirmed ) {
116 116
 			$user = $this->getUser( $username );
117 117
 			$userReg = $user->getRegex();
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 					'${1}{{subst:#timel:Ymd}}|' . $nextDate . '$2',
124 124
 					$newContent
125 125
 				);
126
-				$riconfNames[] = $username;
126
+				$riconfNames[ ] = $username;
127 127
 			} else {
128 128
 				$newContent = preg_replace( $reg, '', $newContent );
129
-				$removeNames[] = $username;
129
+				$removeNames[ ] = $username;
130 130
 			}
131 131
 		}
132 132
 
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 	 * @param User $user
150 150
 	 * @return int
151 151
 	 */
152
-	private function getNextTs( User $user ) : int {
152
+	private function getNextTs ( User $user ) : int {
153 153
 		$userInfo = $user->getUserInfo();
154
-		if ( isset( $userInfo['override-perm'] ) ) {
154
+		if ( isset( $userInfo[ 'override-perm' ] ) ) {
155 155
 			$date = \DateTime::createFromFormat(
156 156
 				'd/m/Y',
157
-				$userInfo['override-perm'] . '/' . date( 'Y' )
157
+				$userInfo[ 'override-perm' ] . '/' . date( 'Y' )
158 158
 			);
159 159
 		} else {
160 160
 			$date = null;
161
-			if ( isset( $userInfo['override'] ) ) {
162
-				$date = \DateTime::createFromFormat( 'd/m/Y', $userInfo['override'] );
161
+			if ( isset( $userInfo[ 'override' ] ) ) {
162
+				$date = \DateTime::createFromFormat( 'd/m/Y', $userInfo[ 'override' ] );
163 163
 			}
164 164
 			if ( !$date || $date <= new \DateTime ) {
165 165
 				$ts = PageBotList::getValidFlagTimestamp( $userInfo );
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 	/**
176 176
 	 * @param bool[] $outcomes
177 177
 	 */
178
-	protected function updateCUList( array $outcomes ) {
178
+	protected function updateCUList ( array $outcomes ) {
179 179
 		$this->getLogger()->info( 'Updating CU list.' );
180 180
 		$cuList = $this->getPage( $this->getOpt( 'cu-list-title' ) );
181 181
 		$newContent = $cuList->getContent();
182 182
 
183
-		$riconfNames = $removeNames = [];
183
+		$riconfNames = $removeNames = [ ];
184 184
 		foreach ( $outcomes as $user => $confirmed ) {
185 185
 			$userReg = $this->getUser( $user )->getRegex();
186 186
 			$reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!";
187 187
 			if ( $confirmed ) {
188 188
 				$newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent );
189
-				$riconfNames[] = $user;
189
+				$riconfNames[ ] = $user;
190 190
 			} else {
191 191
 				$newContent = preg_replace( $reg, '', $newContent );
192
-				$removeNames[] = $user;
192
+				$removeNames[ ] = $user;
193 193
 			}
194 194
 		}
195 195
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @param PageRiconferma[] $pages
214 214
 	 * @return bool[]
215 215
 	 */
216
-	private function getGroupOutcomes( string $group, array $pages ) : array {
217
-		$ret = [];
216
+	private function getGroupOutcomes ( string $group, array $pages ) : array {
217
+		$ret = [ ];
218 218
 		foreach ( $pages as $page ) {
219 219
 			$user = $page->getUser();
220 220
 			if ( $user->inGroup( $group ) ) {
Please login to merge, or discard this patch.