Passed
Push — master ( d0642b...ebe4f4 )
by Daimona
01:47
created
includes/Exception/EditException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Exception;
4 4
 
Please login to merge, or discard this patch.
includes/WikiController.php 1 patch
Spacing   +8 added lines, -8 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;
4 4
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	/** @var string[] */
20 20
 	private $tokens;
21 21
 
22
-	public function __construct() {
22
+	public function __construct () {
23 23
 		$this->logger = new Logger;
24 24
 	}
25 25
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return string
31 31
 	 * @throws MissingPageException
32 32
 	 */
33
-	public function getPageContent( string $title ) : string {
33
+	public function getPageContent ( string $title ) : string {
34 34
 		$this->logger->debug( "Retrieving page $title" );
35 35
 		$params = [
36 36
 			'action' => 'query',
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			throw new MissingPageException( $title );
49 49
 		}
50 50
 
51
-		return $page->revisions[0]->slots->main->{ '*' };
51
+		return $page->revisions[ 0 ]->slots->main->{ '*' };
52 52
 	}
53 53
 
54 54
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param array $params
58 58
 	 * @throws EditException
59 59
 	 */
60
-	public function editPage( array $params ) {
60
+	public function editPage ( array $params ) {
61 61
 		$this->login();
62 62
 
63 63
 		$params = [
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
77 77
 	 * @throws LoginException
78 78
 	 */
79
-	public function login() {
79
+	public function login () {
80 80
 		if ( self::$loggedIn ) {
81 81
 			$this->logger->debug( 'Already logged in' );
82 82
 			return;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 		self::$loggedIn = true;
105 105
 		// Clear tokens cache
106
-		$this->tokens = [];
106
+		$this->tokens = [ ];
107 107
 		$this->logger->info( 'Login succeeded' );
108 108
 	}
109 109
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param string $type
114 114
 	 * @return string
115 115
 	 */
116
-	public function getToken( string $type ) : string {
116
+	public function getToken ( string $type ) : string {
117 117
 		if ( !isset( $this->tokens[ $type ] ) ) {
118 118
 			$params = [
119 119
 				'action' => 'query',
Please login to merge, or discard this patch.
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.
includes/Task/UserNotice.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @inheritDoc
13 13
 	 */
14
-	public function run() : TaskResult {
14
+	public function run () : TaskResult {
15 15
 		$this->getLogger()->info( 'Starting task UserNotice' );
16 16
 
17 17
 		$pages = $this->getDataProvider()->getCreatedPages();
18 18
 		$users = $this->getDataProvider()->getUsersToProcess();
19 19
 		if ( $pages && $users ) {
20
-			$ricNums = [];
20
+			$ricNums = [ ];
21 21
 			foreach ( $pages as $page ) {
22 22
 				$bits = explode( '/', $page );
23 23
 				$num = intval( array_pop( $bits ) );
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param string $user
42 42
 	 * @param int $ricNum
43 43
 	 */
44
-	protected function addMsg( string $user, int $ricNum ) {
44
+	protected function addMsg ( string $user, int $ricNum ) {
45 45
 		$this->getLogger()->info( "Leaving msg to $user" );
46 46
 		$msg = str_replace( '$num', "$ricNum", $this->getConfig()->get( 'user-notice-msg' ) );
47 47
 
Please login to merge, or discard this patch.