Passed
Push — master ( edfae3...adbe23 )
by Daimona
01:28
created
includes/Task/UpdateList.php 1 patch
Spacing   +20 added lines, -20 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
 		$this->getLogger()->debug( 'Retrieving admins - API' );
58 58
 		$params = [
59 59
 			'action' => 'query',
@@ -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->getConfig()->get( '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;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param string $group
149 149
 	 * @return string|null
150 150
 	 */
151
-	private function extractTimestamp( \stdClass $data, string $group ) : ?string {
151
+	private function extractTimestamp ( \stdClass $data, string $group ) : ?string {
152 152
 		$ts = null;
153 153
 		foreach ( $data->query->logevents as $entry ) {
154 154
 			if ( isset( $entry->params ) ) {
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return array[]
169 169
 	 */
170
-	protected function getExtraGroups() : array {
171
-		$extra = [];
170
+	protected function getExtraGroups () : array {
171
+		$extra = [ ];
172 172
 		foreach ( $this->botList as $name => $groups ) {
173 173
 			// These are not groups
174 174
 			unset( $groups[ 'override' ], $groups[ 'override-perm' ] );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @param array[] $extra
189 189
 	 * @return array[]
190 190
 	 */
191
-	protected function getNewContent( array $missing, array $extra ) : array {
191
+	protected function getNewContent ( array $missing, array $extra ) : array {
192 192
 		$newContent = $this->botList;
193 193
 		foreach ( $newContent as $user => $groups ) {
194 194
 			if ( isset( $missing[ $user ] ) ) {
@@ -213,15 +213,15 @@  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 219
 			$ts = PageBotList::getValidFlagTimestamp( $groups );
220
-			if ( isset( $groups['override'] ) && ( date( 'd/m', $ts ) ===
220
+			if ( isset( $groups[ 'override' ] ) && ( date( 'd/m', $ts ) ===
221 221
 				date( 'd/m', strtotime( '- 1 days' ) ) )
222 222
 			) {
223 223
 				unset( $newContent[ $user ][ 'override' ] );
224
-				$removed[] = $user;
224
+				$removed[ ] = $user;
225 225
 			}
226 226
 		}
227 227
 
Please login to merge, or discard this patch.