Passed
Push — master ( 705e17...c9cba6 )
by Daimona
01:56
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
 		$this->botList = PageBotList::get()->getAdminsList();
33 33
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @return array
55 55
 	 */
56
-	protected function getActualAdmins() : array {
56
+	protected function getActualAdmins () : array {
57 57
 		$params = [
58 58
 			'action' => 'query',
59 59
 			'list' => 'allusers',
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 * @param \stdClass $data
71 71
 	 * @return array
72 72
 	 */
73
-	protected function extractAdmins( \stdClass $data ) : array {
74
-		$ret = [];
73
+	protected function extractAdmins ( \stdClass $data ) : array {
74
+		$ret = [ ];
75 75
 		$blacklist = $this->getOpt( 'exclude-admins' );
76 76
 		foreach ( $data->query->allusers as $u ) {
77 77
 			if ( in_array( $u->name, $blacklist ) ) {
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return array[]
90 90
 	 */
91
-	protected function getMissingGroups() : array {
92
-		$missing = [];
91
+	protected function getMissingGroups () : array {
92
+		$missing = [ ];
93 93
 		foreach ( $this->actualList as $adm => $groups ) {
94
-			$curMissing = array_diff( $groups, array_keys( $this->botList[$adm] ?? [] ) );
94
+			$curMissing = array_diff( $groups, array_keys( $this->botList[ $adm ] ?? [ ] ) );
95 95
 
96 96
 			foreach ( $curMissing as $group ) {
97 97
 				try {
98 98
 					$missing[ $adm ][ $group ] = $this->getFlagDate( $adm, $group );
99 99
 				} catch ( TaskException $e ) {
100
-					$this->errors[] = $e->getMessage();
100
+					$this->errors[ ] = $e->getMessage();
101 101
 				}
102 102
 			}
103 103
 		}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return string
113 113
 	 * @throws TaskException
114 114
 	 */
115
-	protected function getFlagDate( string $admin, string $group ) : string {
115
+	protected function getFlagDate ( string $admin, string $group ) : string {
116 116
 		$this->getLogger()->info( "Retrieving $group flag date for $admin" );
117 117
 
118 118
 		$url = DEFAULT_URL;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @param string $group
148 148
 	 * @return string|null
149 149
 	 */
150
-	private function extractTimestamp( \stdClass $data, string $group ) : ?string {
150
+	private function extractTimestamp ( \stdClass $data, string $group ) : ?string {
151 151
 		$ts = null;
152 152
 		foreach ( $data->query->logevents as $entry ) {
153 153
 			if ( isset( $entry->params ) ) {
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return array[]
168 168
 	 */
169
-	protected function getExtraGroups() : array {
170
-		$extra = [];
169
+	protected function getExtraGroups () : array {
170
+		$extra = [ ];
171 171
 		foreach ( $this->botList as $name => $groups ) {
172 172
 			// These are not groups
173 173
 			unset( $groups[ 'override' ], $groups[ 'override-perm' ] );
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @param array[] $extra
188 188
 	 * @return array[]
189 189
 	 */
190
-	protected function getNewContent( array $missing, array $extra ) : array {
190
+	protected function getNewContent ( array $missing, array $extra ) : array {
191 191
 		$newContent = $this->botList;
192 192
 		foreach ( $newContent as $user => $groups ) {
193 193
 			if ( isset( $missing[ $user ] ) ) {
@@ -211,21 +211,21 @@  discard block
 block discarded – undo
211 211
 	 * @param array[] $newContent
212 212
 	 * @return array[]
213 213
 	 */
214
-	protected function removeOverrides( array $newContent ) : array {
215
-		$removed = [];
214
+	protected function removeOverrides ( array $newContent ) : array {
215
+		$removed = [ ];
216 216
 		foreach ( $newContent as $user => $groups ) {
217
-			if ( !isset( $groups['override'] ) ) {
217
+			if ( !isset( $groups[ 'override' ] ) ) {
218 218
 				continue;
219 219
 			}
220 220
 
221 221
 			$flagTS = PageBotList::getValidFlagTimestamp( $groups );
222 222
 			$usualTS = strtotime( date( 'Y' ) . '-' . date( 'm-d', $flagTS ) );
223
-			$overrideTS = \DateTime::createFromFormat( 'd/m/Y', $groups['override'] )->getTimestamp();
223
+			$overrideTS = \DateTime::createFromFormat( 'd/m/Y', $groups[ 'override' ] )->getTimestamp();
224 224
 			$delay = 60 * 60 * 24 * 3;
225 225
 
226 226
 			if ( time() > $usualTS + $delay && time() > $overrideTS + $delay ) {
227 227
 				unset( $newContent[ $user ][ 'override' ] );
228
-				$removed[] = $user;
228
+				$removed[ ] = $user;
229 229
 			}
230 230
 		}
231 231
 
Please login to merge, or discard this patch.