Passed
Push — master ( 896b09...d0642b )
by Daimona
02:01
created
includes/Task/UpdateList.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	/**
19 19
 	 * @inheritDoc
20 20
 	 */
21
-	public function run() : TaskResult {
21
+	public function run () : TaskResult {
22 22
 		$this->getLogger()->info( 'Starting task UpdateList' );
23 23
 		$this->actualList = $this->getActualAdmins();
24 24
 		$this->botList = $this->getList();
@@ -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 ) ) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * @return array
89 89
 	 */
90
-	protected function getList() : array {
90
+	protected function getList () : array {
91 91
 		$this->getLogger()->debug( 'Retrieving admins - JSON list' );
92 92
 		$content = $this->getController()->getPageContent( $this->getConfig()->get( 'list-title' ) );
93 93
 
@@ -99,22 +99,22 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return array[]
101 101
 	 */
102
-	protected function getMissingGroups() : array {
103
-		$missing = [];
102
+	protected function getMissingGroups () : array {
103
+		$missing = [ ];
104 104
 		foreach ( $this->actualList as $adm => $groups ) {
105
-			$groupsList = [];
105
+			$groupsList = [ ];
106 106
 			if ( !isset( $this->botList[ $adm ] ) ) {
107 107
 				$groupsList = $groups;
108
-			} elseif ( count( $groups ) > count( $this->botList[$adm] ) ) {
108
+			} elseif ( count( $groups ) > count( $this->botList[ $adm ] ) ) {
109 109
 				// Only some groups are missing
110
-				$groupsList = array_diff_key( $groups, $this->botList[$adm] );
110
+				$groupsList = array_diff_key( $groups, $this->botList[ $adm ] );
111 111
 			}
112 112
 
113 113
 			foreach ( $groupsList as $group ) {
114 114
 				try {
115 115
 					$missing[ $adm ][ $group ] = $this->getFlagDate( $adm, $group );
116 116
 				} catch ( TaskException $e ) {
117
-					$this->errors[] = $e->getMessage();
117
+					$this->errors[ ] = $e->getMessage();
118 118
 				}
119 119
 			}
120 120
 		}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return string
130 130
 	 * @throws TaskException
131 131
 	 */
132
-	protected function getFlagDate( string $admin, string $group ) : string {
132
+	protected function getFlagDate ( string $admin, string $group ) : string {
133 133
 		$this->getLogger()->info( "Retrieving $group flag date for $admin" );
134 134
 
135 135
 		if ( $group === 'checkuser' ) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @param string $group
170 170
 	 * @return string|null
171 171
 	 */
172
-	private function extractTimestamp( \stdClass $data, string $group ) : ?string {
172
+	private function extractTimestamp ( \stdClass $data, string $group ) : ?string {
173 173
 		$ts = null;
174 174
 		foreach ( $data->query->logevents as $entry ) {
175 175
 			if ( !isset( $entry->params ) ) {
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return array[]
193 193
 	 */
194
-	protected function getExtraGroups() : array {
195
-		$extra = [];
194
+	protected function getExtraGroups () : array {
195
+		$extra = [ ];
196 196
 		foreach ( $this->botList as $name => $groups ) {
197 197
 			if ( !isset( $this->actualList[ $name ] ) ) {
198 198
 				$extra[ $name ] = $groups;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param array $newContent
210 210
 	 */
211
-	protected function doUpdateList( array $newContent ) {
211
+	protected function doUpdateList ( array $newContent ) {
212 212
 		$this->getLogger()->info( 'Updating admin list' );
213 213
 
214 214
 		$params = [
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @param array[] $extra
228 228
 	 * @return array[]
229 229
 	 */
230
-	protected function getNewContent( array $missing, array $extra ) : array {
230
+	protected function getNewContent ( array $missing, array $extra ) : array {
231 231
 		$newContent = $this->botList;
232 232
 		foreach ( $newContent as $user => $groups ) {
233 233
 			if ( isset( $missing[ $user ] ) ) {
Please login to merge, or discard this patch.