Passed
Push — master ( bbcd54...3d4f1f )
by Daimona
03:26 queued 01:29
created
includes/Task/UpdateList.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;
4 4
 
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @inheritDoc
21 21
 	 */
22
-	protected function getSubtasksMap(): array {
22
+	protected function getSubtasksMap (): array {
23 23
 		// Everything is done here.
24
-		return [];
24
+		return [ ];
25 25
 	}
26 26
 
27 27
 	/**
28 28
 	 * @inheritDoc
29 29
 	 */
30
-	public function runInternal() : int {
30
+	public function runInternal () : int {
31 31
 		$this->actualList = $this->getActualAdmins();
32 32
 		$pageBotList = PageBotList::get( $this->getWiki() );
33 33
 		$this->botList = $pageBotList->getAdminsList();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @return array
56 56
 	 */
57
-	protected function getActualAdmins() : array {
57
+	protected function getActualAdmins () : array {
58 58
 		$params = [
59 59
 			'action' => 'query',
60 60
 			'list' => 'allusers',
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param \stdClass $data
72 72
 	 * @return array
73 73
 	 */
74
-	protected function extractAdmins( \stdClass $data ) : array {
75
-		$ret = [];
74
+	protected function extractAdmins ( \stdClass $data ) : array {
75
+		$ret = [ ];
76 76
 		$blacklist = $this->getOpt( 'exclude-admins' );
77 77
 		foreach ( $data->query->allusers as $u ) {
78 78
 			if ( in_array( $u->name, $blacklist ) ) {
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return array[]
91 91
 	 */
92
-	protected function getMissingGroups() : array {
93
-		$missing = [];
92
+	protected function getMissingGroups () : array {
93
+		$missing = [ ];
94 94
 		foreach ( $this->actualList as $adm => $groups ) {
95
-			$curMissing = array_diff( $groups, array_keys( $this->botList[$adm] ?? [] ) );
95
+			$curMissing = array_diff( $groups, array_keys( $this->botList[ $adm ] ?? [ ] ) );
96 96
 
97 97
 			foreach ( $curMissing as $group ) {
98 98
 				try {
99 99
 					$missing[ $adm ][ $group ] = $this->getFlagDate( $adm, $group );
100 100
 				} catch ( TaskException $e ) {
101
-					$this->errors[] = $e->getMessage();
101
+					$this->errors[ ] = $e->getMessage();
102 102
 				}
103 103
 			}
104 104
 		}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @return string
114 114
 	 * @throws TaskException
115 115
 	 */
116
-	protected function getFlagDate( string $admin, string $group ) : string {
116
+	protected function getFlagDate ( string $admin, string $group ) : string {
117 117
 		$this->getLogger()->info( "Retrieving $group flag date for $admin" );
118 118
 
119 119
 		$url = DEFAULT_URL;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @param string $group
150 150
 	 * @return string|null
151 151
 	 */
152
-	private function extractTimestamp( \stdClass $data, string $group ) : ?string {
152
+	private function extractTimestamp ( \stdClass $data, string $group ) : ?string {
153 153
 		$ts = null;
154 154
 		foreach ( $data->query->logevents as $entry ) {
155 155
 			if ( isset( $entry->params ) ) {
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return array[]
170 170
 	 */
171
-	protected function getExtraGroups() : array {
172
-		$extra = [];
171
+	protected function getExtraGroups () : array {
172
+		$extra = [ ];
173 173
 		foreach ( $this->botList as $name => $groups ) {
174 174
 			// These are not groups
175 175
 			unset( $groups[ 'override' ], $groups[ 'override-perm' ] );
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param array[] $extra
190 190
 	 * @return array[]
191 191
 	 */
192
-	protected function getNewContent( array $missing, array $extra ) : array {
192
+	protected function getNewContent ( array $missing, array $extra ) : array {
193 193
 		$newContent = $this->botList;
194 194
 		foreach ( $newContent as $user => $groups ) {
195 195
 			if ( isset( $missing[ $user ] ) ) {
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
 	 * @param array[] $newContent
214 214
 	 * @return array[]
215 215
 	 */
216
-	protected function removeOverrides( array $newContent ) : array {
217
-		$removed = [];
216
+	protected function removeOverrides ( array $newContent ) : array {
217
+		$removed = [ ];
218 218
 		foreach ( $newContent as $user => $groups ) {
219
-			if ( !isset( $groups['override'] ) ) {
219
+			if ( !isset( $groups[ 'override' ] ) ) {
220 220
 				continue;
221 221
 			}
222 222
 
223 223
 			$flagTS = PageBotList::getValidFlagTimestamp( $groups );
224 224
 			$usualTS = strtotime( date( 'Y' ) . '-' . date( 'm-d', $flagTS ) );
225
-			$overrideTS = \DateTime::createFromFormat( 'd/m/Y', $groups['override'] )->getTimestamp();
225
+			$overrideTS = \DateTime::createFromFormat( 'd/m/Y', $groups[ 'override' ] )->getTimestamp();
226 226
 			$delay = 60 * 60 * 24 * 3;
227 227
 
228 228
 			if ( time() > $usualTS + $delay && time() > $overrideTS + $delay ) {
229 229
 				unset( $newContent[ $user ][ 'override' ] );
230
-				$removed[] = $user;
230
+				$removed[ ] = $user;
231 231
 			}
232 232
 		}
233 233
 
Please login to merge, or discard this patch.