Passed
Push — master ( b3e686...761a52 )
by Daimona
01:54
created
includes/Task/Subtask/FailedUpdates.php 1 patch
Spacing   +15 added lines, -15 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\Subtask;
4 4
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	public function runInternal() : int {
18
+	public function runInternal () : int {
19 19
 		$failed = $this->getFailures();
20 20
 		if ( $failed ) {
21 21
 			$this->updateBurList( $failed );
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return PageRiconferma[]
34 34
 	 */
35
-	private function getFailures() : array {
36
-		$ret = [];
35
+	private function getFailures () : array {
36
+		$ret = [ ];
37 37
 		$allPages = $this->getDataProvider()->getPagesToClose();
38 38
 		foreach ( $allPages as $page ) {
39 39
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
40
-				$ret[] = $page;
40
+				$ret[ ] = $page;
41 41
 			}
42 42
 		}
43 43
 		return $ret;
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * @param PageRiconferma[] $pages
48 48
 	 */
49
-	protected function updateBurList( array $pages ) {
49
+	protected function updateBurList ( array $pages ) {
50 50
 		$this->getLogger()->info( 'Checking if bur list needs updating.' );
51 51
 
52
-		$remove = [];
52
+		$remove = [ ];
53 53
 		foreach ( $pages as $page ) {
54 54
 			$user = $page->getUser();
55 55
 			if ( $user->inGroup( 'bureaucrat' ) &&
56 56
 				( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL )
57 57
 			) {
58
-				$remove[] = $user;
58
+				$remove[ ] = $user;
59 59
 			}
60 60
 		}
61 61
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param PageRiconferma[] $pages
87 87
 	 */
88
-	protected function requestRemoval( array $pages ) {
88
+	protected function requestRemoval ( array $pages ) {
89 89
 		$this->getLogger()->info(
90 90
 			'Requesting removal on meta for: ' . implode( ', ', $pages )
91 91
 		);
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param PageRiconferma[] $pages
126 126
 	 */
127
-	protected function updateAnnunci( array $pages ) {
127
+	protected function updateAnnunci ( array $pages ) {
128 128
 		$this->getLogger()->info( 'Updating annunci' );
129 129
 		$section = 1;
130 130
 
131
-		$names = [];
131
+		$names = [ ];
132 132
 		$text = '';
133 133
 		foreach ( $pages as $page ) {
134 134
 			$user = $page->getUser()->getName();
135
-			$names[] = $user;
135
+			$names[ ] = $user;
136 136
 			$text .= "{{Breve|admin|{{subst:#time:j}}|[[Utente:$user|]] " .
137 137
 				"non è stato riconfermato [[WP:A|amministratore]].}}\n";
138 138
 		}
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @param PageRiconferma[] $pages
169 169
 	 */
170
-	protected function updateUltimeNotizie( array $pages ) {
170
+	protected function updateUltimeNotizie ( array $pages ) {
171 171
 		$this->getLogger()->info( 'Updating ultime notizie' );
172 172
 		$notiziePage = new Page( $this->getConfig()->get( 'ultimenotizie-page-title' ) );
173 173
 
174
-		$names = [];
174
+		$names = [ ];
175 175
 		$text = '';
176 176
 		foreach ( $pages as $page ) {
177 177
 			$user = $page->getUser()->getName();
178 178
 			$title = $page->getTitle();
179
-			$names[] = $user;
179
+			$names[ ] = $user;
180 180
 			$text .= "*'''{{subst:#time:j F}}''': [[Utente:$user|]] non è stato [[$title|riconfermato]] " .
181 181
 				"[[WP:A|amministratore]]; ora gli admin sono {{subst:#expr: {{subst:NUMBEROFADMINS}} - 1}}.\n";
182 182
 		}
Please login to merge, or discard this patch.
includes/Task/Subtask/SimpleUpdates.php 1 patch
Spacing   +14 added lines, -14 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\Subtask;
4 4
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	public function runInternal() : int {
18
+	public function runInternal () : int {
19 19
 		$pages = $this->getDataProvider()->getPagesToClose();
20 20
 
21 21
 		if ( !$pages ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param PageRiconferma[] $pages
35 35
 	 * @see UpdatesAround::addToVotazioni()
36 36
 	 */
37
-	protected function updateVotazioni( array $pages ) {
37
+	protected function updateVotazioni ( array $pages ) {
38 38
 		$this->getLogger()->info(
39 39
 			'Updating votazioni: ' . implode( ', ', $pages )
40 40
 		);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param array $pages
67 67
 	 * @see UpdatesAround::addToNews()
68 68
 	 */
69
-	protected function updateNews( array $pages ) {
69
+	protected function updateNews ( array $pages ) {
70 70
 		$simpleAmount = $voteAmount = 0;
71 71
 		foreach ( $pages as $page ) {
72 72
 			if ( $page->isVote() ) {
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
90 90
 		$voteMatches = $newsPage->getMatch( $voteReg );
91 91
 
92
-		$newSimp = (int)$simpleMatches[2] - $simpleAmount ?: '';
93
-		$newVote = (int)$voteMatches[2] - $voteAmount ?: '';
92
+		$newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: '';
93
+		$newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: '';
94 94
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content );
95 95
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
96 96
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param PageRiconferma[] $pages
110 110
 	 */
111
-	protected function updateAdminList( array $pages ) {
111
+	protected function updateAdminList ( array $pages ) {
112 112
 		$this->getLogger()->info(
113 113
 			'Updating admin list: ' . implode( ', ', $pages )
114 114
 		);
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 		$newContent = $adminsPage->getContent();
117 117
 		$newDate = date( 'Ymd', strtotime( '+1 year' ) );
118 118
 
119
-		$riconfNames = $removeNames = [];
119
+		$riconfNames = $removeNames = [ ];
120 120
 		foreach ( $pages as $page ) {
121 121
 			$user = $page->getUser();
122 122
 			$reg = '!(\{\{Amministratore\/riga\|' . $user->getRegex() . ".+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!";
123 123
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
124 124
 				// Remove the line
125 125
 				$newContent = preg_replace( $reg, '', $newContent );
126
-				$removeNames[] = $user->getName();
126
+				$removeNames[ ] = $user->getName();
127 127
 			} else {
128 128
 				$newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent );
129
-				$riconfNames[] = $user->getName();
129
+				$riconfNames[ ] = $user->getName();
130 130
 			}
131 131
 		}
132 132
 
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 	/**
147 147
 	 * @param PageRiconferma[] $pages
148 148
 	 */
149
-	protected function updateCUList( array $pages ) {
149
+	protected function updateCUList ( array $pages ) {
150 150
 		$this->getLogger()->info( 'Checking if CU list needs updating.' );
151 151
 		$cuList = new Page( $this->getConfig()->get( 'cu-list-title' ) );
152 152
 		$newContent = $cuList->getContent();
153 153
 
154
-		$riconfNames = $removeNames = [];
154
+		$riconfNames = $removeNames = [ ];
155 155
 		foreach ( $pages as $page ) {
156 156
 			$user = $page->getUser();
157 157
 			if ( $user->inGroup( 'checkuser' ) ) {
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 				if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
160 160
 					// Remove the line
161 161
 					$newContent = preg_replace( $reg, '', $newContent );
162
-					$removeNames[] = $user->getName();
162
+					$removeNames[ ] = $user->getName();
163 163
 				} else {
164 164
 					$newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent );
165
-					$riconfNames[] = $user->getName();
165
+					$riconfNames[ ] = $user->getName();
166 166
 				}
167 167
 			}
168 168
 		}
Please login to merge, or discard this patch.
includes/Task/Subtask/UpdatesAround.php 1 patch
Spacing   +7 added lines, -7 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\Subtask;
4 4
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	public function runInternal() : int {
18
+	public function runInternal () : int {
19 19
 		$pages = $this->getDataProvider()->getCreatedPages();
20 20
 
21 21
 		if ( !$pages ) {
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param PageRiconferma[] $pages
39 39
 	 */
40
-	protected function addToMainPage( array $pages ) {
40
+	protected function addToMainPage ( array $pages ) {
41 41
 		$this->getLogger()->info(
42 42
 			'Adding the following to main: ' . implode( ', ', $pages )
43 43
 		);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param PageRiconferma[] $pages
66 66
 	 */
67
-	protected function addToVotazioni( array $pages ) {
67
+	protected function addToVotazioni ( array $pages ) {
68 68
 		$this->getLogger()->info(
69 69
 			'Adding the following to votes: ' . implode( ', ', $pages )
70 70
 		);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
94 94
 			// Replace semicolon with full stop
95 95
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
96
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $content, 1 );
96
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $content, 1 );
97 97
 		}
98 98
 
99 99
 		$summary = $this->msg( 'vote-page-summary' )
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @param int $amount
114 114
 	 */
115
-	protected function addToNews( int $amount ) {
115
+	protected function addToNews ( int $amount ) {
116 116
 		$this->getLogger()->info( "Increasing the news counter by $amount" );
117 117
 		$newsPage = new Page( $this->getConfig()->get( 'news-page-title' ) );
118 118
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			throw new TaskException( 'Param not found in news page' );
126 126
 		}
127 127
 
128
-		$newNum = (int)$matches[2] + $amount;
128
+		$newNum = (int)$matches[ 2 ] + $amount;
129 129
 		$newContent = preg_replace( $reg, '${1}' . $newNum, $content );
130 130
 
131 131
 		$summary = $this->msg( 'news-page-summary' )
Please login to merge, or discard this patch.
includes/Task/Subtask/ArchivePages.php 1 patch
Spacing   +12 added lines, -12 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\Subtask;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function runInternal() : int {
17
+	public function runInternal () : int {
18 18
 		$pages = $this->getDataProvider()->getPagesToClose();
19 19
 
20 20
 		if ( !$pages ) {
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 	 * @param PageRiconferma[] $pages
34 34
 	 * @see UpdatesAround::addToMainPage()
35 35
 	 */
36
-	protected function removeFromMainPage( array $pages ) {
36
+	protected function removeFromMainPage ( array $pages ) {
37 37
 		$this->getLogger()->info(
38 38
 			'Removing from main: ' . implode( ', ', $pages )
39 39
 		);
40 40
 
41 41
 		$mainPage = new Page( $this->getConfig()->get( 'main-page-title' ) );
42
-		$remove = [];
42
+		$remove = [ ];
43 43
 		foreach ( $pages as $page ) {
44
-			$remove[] = '{{' . $page->getTitle() . '}}';
44
+			$remove[ ] = '{{' . $page->getTitle() . '}}';
45 45
 		}
46 46
 
47 47
 		$summary = $this->msg( 'close-main-summary' )
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param PageRiconferma[] $pages
61 61
 	 */
62
-	protected function addToArchive( array $pages ) {
62
+	protected function addToArchive ( array $pages ) {
63 63
 		$this->getLogger()->info(
64 64
 			'Adding to archive: ' . implode( ', ', $pages )
65 65
 		);
66 66
 
67
-		$simple = $votes = [];
67
+		$simple = $votes = [ ];
68 68
 		foreach ( $pages as $page ) {
69 69
 			if ( $page->isVote() ) {
70
-				$votes[] = $page;
70
+				$votes[ ] = $page;
71 71
 			} else {
72
-				$simple[] = $page;
72
+				$simple[ ] = $page;
73 73
 			}
74 74
 		}
75 75
 
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 	 * @param string $archiveTitle
87 87
 	 * @param array $pages
88 88
 	 */
89
-	private function reallyAddToArchive( string $archiveTitle, array $pages ) {
89
+	private function reallyAddToArchive ( string $archiveTitle, array $pages ) {
90 90
 		$archivePage = new Page( "$archiveTitle/" . date( 'Y' ) );
91 91
 
92 92
 		$append = "\n";
93
-		$archivedList = [];
93
+		$archivedList = [ ];
94 94
 		foreach ( $pages as $page ) {
95 95
 			$append .= '{{' . $page->getTitle() . "}}\n";
96
-			$archivedList[] = $page->getUserNum();
96
+			$archivedList[ ] = $page->getUserNum();
97 97
 		}
98 98
 
99 99
 		$summary = $this->msg( 'close-archive-summary' )
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @inheritDoc
18 18
 	 */
19
-	protected function getSubtasksMap(): array {
19
+	protected function getSubtasksMap (): array {
20 20
 		// Everything is done here.
21
-		return [];
21
+		return [ ];
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @inheritDoc
26 26
 	 */
27
-	public function runInternal() : int {
27
+	public function runInternal () : int {
28 28
 		$pages = $this->getDataProvider()->getOpenPages();
29 29
 
30 30
 		if ( !$pages ) {
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	 * @param PageRiconferma[] $pages
39 39
 	 * @return int a STATUS_* constant
40 40
 	 */
41
-	protected function processPages( array $pages ) : int {
42
-		$actualPages = [];
41
+	protected function processPages ( array $pages ) : int {
42
+		$actualPages = [ ];
43 43
 		foreach ( $pages as $page ) {
44 44
 			if ( $page->hasOpposition() && !$page->isVote() ) {
45 45
 				$this->openVote( $page );
46
-				$actualPages[] = $page;
46
+				$actualPages[ ] = $page;
47 47
 			}
48 48
 		}
49 49
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @param PageRiconferma $page
63 63
 	 */
64
-	protected function openVote( PageRiconferma $page ) {
64
+	protected function openVote ( PageRiconferma $page ) {
65 65
 		$this->getLogger()->info( "Starting vote on $page" );
66 66
 
67 67
 		$content = $page->getContent();
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @see SimpleUpdates::updateVotazioni()
101 101
 	 * @see UpdatesAround::addToVotazioni()
102 102
 	 */
103
-	protected function updateVotePage( array $pages ) {
103
+	protected function updateVotePage ( array $pages ) {
104 104
 		$votePage = new Page( $this->getConfig()->get( 'vote-page-title' ) );
105 105
 		$content = $votePage->getContent();
106 106
 
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 );
128 128
 		} else {
129 129
 			// Start section
130
-			$matches = [];
130
+			$matches = [ ];
131 131
 			if ( preg_match( $introReg, $newContent, $matches ) === 0 ) {
132 132
 				throw new TaskException( 'Intro not found in vote page' );
133 133
 			}
134 134
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
135 135
 			// Replace semicolon with full stop
136 136
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
137
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 );
137
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 );
138 138
 		}
139 139
 
140 140
 		$summary = $this->msg( 'vote-start-vote-page-summary' )
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @see UpdatesAround::addToNews()
157 157
 	 * @see SimpleUpdates::updateNews()
158 158
 	 */
159
-	protected function updateNews( int $amount ) {
159
+	protected function updateNews ( int $amount ) {
160 160
 		$this->getLogger()->info( "Turning $amount pages into votes" );
161 161
 		$newsPage = new Page( $this->getConfig()->get( 'news-page-title' ) );
162 162
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 			throw new TaskException( 'Param "voto" not found in news page' );
172 172
 		}
173 173
 
174
-		$newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: '';
175
-		$newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: '';
174
+		$newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: '';
175
+		$newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: '';
176 176
 
177 177
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
178 178
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
Please login to merge, or discard this patch.
includes/Wiki/User.php 1 patch
Spacing   +7 added lines, -7 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\Wiki;
4 4
 
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @param string $name
18 18
 	 */
19
-	public function __construct( string $name ) {
19
+	public function __construct ( string $name ) {
20 20
 		$this->name = $name;
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @return string
25 25
 	 */
26
-	public function getName() : string {
26
+	public function getName () : string {
27 27
 		return $this->name;
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @return string[]
32 32
 	 */
33
-	public function getGroups() : array {
33
+	public function getGroups () : array {
34 34
 		if ( $this->groups === null ) {
35 35
 			$usersList = PageBotList::get()->getAdminsList();
36 36
 			$this->groups = array_keys( $usersList[ $this->name ] );
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param string $groupName
45 45
 	 * @return bool
46 46
 	 */
47
-	public function inGroup( string $groupName ) : bool {
47
+	public function inGroup ( string $groupName ) : bool {
48 48
 		return in_array( $groupName, $this->getGroups() );
49 49
 	}
50 50
 
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @inheritDoc
55 55
 	 */
56
-	public function getRegex() : string {
56
+	public function getRegex () : string {
57 57
 		return str_replace( ' ', '[ _]', preg_quote( $this->name ) );
58 58
 	}
59 59
 
60 60
 	/**
61 61
 	 * @return string
62 62
 	 */
63
-	public function __toString() {
63
+	public function __toString () {
64 64
 		return $this->name;
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
includes/Wiki/Page/Page.php 1 patch
Spacing   +14 added lines, -14 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\Wiki\Page;
4 4
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param string $title
22 22
 	 * @param string $domain The site where the page lives, if different from default
23 23
 	 */
24
-	public function __construct( string $title, string $domain = DEFAULT_URL ) {
24
+	public function __construct ( string $title, string $domain = DEFAULT_URL ) {
25 25
 		$this->title = $title;
26 26
 		$this->controller = new Controller( $domain );
27 27
 	}
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @return string
31 31
 	 */
32
-	public function getTitle() : string {
32
+	public function getTitle () : string {
33 33
 		return $this->title;
34 34
 	}
35 35
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param int|null $section A section number to retrieve the content of that section
40 40
 	 * @return string
41 41
 	 */
42
-	public function getContent( int $section = null ) : string {
42
+	public function getContent ( int $section = null ) : string {
43 43
 		if ( $this->content === null ) {
44 44
 			$this->content = $this->controller->getPageContent( $this->title, $section );
45 45
 		}
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @param array $params
53 53
 	 */
54
-	public function edit( array $params ) {
54
+	public function edit ( array $params ) {
55 55
 		$params = [
56 56
 			'title' => $this->getTitle()
57 57
 		] + $params;
58 58
 
59 59
 		$this->controller->editPage( $params );
60
-		if ( isset( $params['text'] ) ) {
61
-			$this->content = $params['text'];
62
-		} elseif ( isset( $params['appendtext'] ) ) {
63
-			$this->content .= $params['appendtext'];
60
+		if ( isset( $params[ 'text' ] ) ) {
61
+			$this->content = $params[ 'text' ];
62
+		} elseif ( isset( $params[ 'appendtext' ] ) ) {
63
+			$this->content .= $params[ 'appendtext' ];
64 64
 		} else {
65 65
 			// Clear the cache anyway
66 66
 			( new Logger )->warning( 'Resetting content cache. Params: ' . var_export( $params, true ) );
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param string $regex
75 75
 	 * @return bool
76 76
 	 */
77
-	public function matches( string $regex ) : bool {
77
+	public function matches ( string $regex ) : bool {
78 78
 		return (bool)preg_match( $regex, $this->getContent() );
79 79
 	}
80 80
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 * @return string[]
87 87
 	 * @throws \Exception
88 88
 	 */
89
-	public function getMatch( string $regex ) : array {
90
-		$ret = [];
89
+	public function getMatch ( string $regex ) : array {
90
+		$ret = [ ];
91 91
 		if ( preg_match( $regex, $this->getContent(), $ret ) === 0 ) {
92 92
 			throw new \Exception( 'The content does not match the given regex' );
93 93
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @inheritDoc
101 101
 	 */
102
-	public function getRegex() : string {
102
+	public function getRegex () : string {
103 103
 		return str_replace( ' ', '[ _]', preg_quote( $this->title ) );
104 104
 	}
105 105
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return string
110 110
 	 */
111
-	public function __toString() {
111
+	public function __toString () {
112 112
 		return $this->getTitle();
113 113
 	}
114 114
 }
Please login to merge, or discard this patch.
includes/Wiki/Element.php 1 patch
Spacing   +5 added lines, -5 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\Wiki;
4 4
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	 *
12 12
 	 * @return string
13 13
 	 */
14
-	abstract public function getRegex() : string;
14
+	abstract public function getRegex () : string;
15 15
 
16 16
 	/**
17 17
 	 * Get a regex matching any element in the given array
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	 * @return string
21 21
 	 * @fixme Is this the right place?
22 22
 	 */
23
-	public static function regexFromArray( array $elements ) : string {
24
-		$bits = [];
23
+	public static function regexFromArray ( array $elements ) : string {
24
+		$bits = [ ];
25 25
 		foreach ( $elements as $el ) {
26
-			$bits[] = $el->getRegex();
26
+			$bits[ ] = $el->getRegex();
27 27
 		}
28 28
 		return '(?:' . implode( '|', $bits ) . ')';
29 29
 	}
Please login to merge, or discard this patch.
includes/TaskDataProvider.php 1 patch
Spacing   +18 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;
4 4
 
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 	/** @var array[] */
17 17
 	private $allUsers;
18 18
 	/** @var PageRiconferma[] */
19
-	private $createdPages = [];
19
+	private $createdPages = [ ];
20 20
 
21 21
 	/**
22 22
 	 * Get the full content of the JSON users list
23 23
 	 *
24 24
 	 * @return array[]
25 25
 	 */
26
-	public function getUsersList() : array {
26
+	public function getUsersList () : array {
27 27
 		if ( $this->allUsers === null ) {
28 28
 			$this->getLogger()->debug( 'Retrieving users list' );
29 29
 			$this->allUsers = PageBotList::get()->getAdminsList();
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return array[]
39 39
 	 */
40
-	public function getUsersToProcess() : array {
40
+	public function getUsersToProcess () : array {
41 41
 		if ( $this->processUsers === null ) {
42
-			$this->processUsers = [];
42
+			$this->processUsers = [ ];
43 43
 			foreach ( $this->getUsersList() as $user => $groups ) {
44 44
 				$timestamp = $this->getValidTimestamp( $groups );
45 45
 
@@ -61,13 +61,11 @@  discard block
 block discarded – undo
61 61
 	 * @param array $groups
62 62
 	 * @return int
63 63
 	 */
64
-	private function getValidTimestamp( array $groups ) : int {
64
+	private function getValidTimestamp ( array $groups ) : int {
65 65
 		$checkuser = isset( $groups[ 'checkuser' ] ) ?
66
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() :
67
-			0;
66
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0;
68 67
 		$bureaucrat = isset( $groups[ 'bureaucrat' ] ) ?
69
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() :
70
-			0;
68
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0;
71 69
 
72 70
 		$timestamp = max( $bureaucrat, $checkuser );
73 71
 		if ( $timestamp === 0 ) {
@@ -81,7 +79,7 @@  discard block
 block discarded – undo
81 79
 	 *
82 80
 	 * @return PageRiconferma[]
83 81
 	 */
84
-	public function getOpenPages() : array {
82
+	public function getOpenPages () : array {
85 83
 		static $list = null;
86 84
 		if ( $list === null ) {
87 85
 			$mainTitle = $this->getConfig()->get( 'main-page-title' );
@@ -95,10 +93,10 @@  discard block
 block discarded – undo
95 93
 
96 94
 			$pages = RequestBase::newFromParams( $params )->execute()->query->pages;
97 95
 			$reg = ( new Page( $mainTitle ) )->getRegex();
98
-			$list = [];
96
+			$list = [ ];
99 97
 			foreach ( reset( $pages )->templates as $page ) {
100 98
 				if ( preg_match( "!$reg\/[^\/]+\/\d!", $page->title ) ) {
101
-					$list[] = new PageRiconferma( $page->title );
99
+					$list[ ] = new PageRiconferma( $page->title );
102 100
 				}
103 101
 			}
104 102
 		}
@@ -111,14 +109,14 @@  discard block
 block discarded – undo
111 109
 	 *
112 110
 	 * @return PageRiconferma[]
113 111
 	 */
114
-	public function getPagesToClose() : array {
112
+	public function getPagesToClose () : array {
115 113
 		static $list = null;
116 114
 		if ( $list === null ) {
117 115
 			$allPages = $this->getOpenPages();
118
-			$list = [];
116
+			$list = [ ];
119 117
 			foreach ( $allPages as $page ) {
120 118
 				if ( time() > $page->getEndTimestamp() ) {
121
-					$list[] = $page;
119
+					$list[ ] = $page;
122 120
 				}
123 121
 			}
124 122
 		}
@@ -130,21 +128,21 @@  discard block
 block discarded – undo
130 128
 	 *
131 129
 	 * @param string $name
132 130
 	 */
133
-	public function removeUser( string $name ) {
131
+	public function removeUser ( string $name ) {
134 132
 		unset( $this->processUsers[ $name ] );
135 133
 	}
136 134
 
137 135
 	/**
138 136
 	 * @return PageRiconferma[]
139 137
 	 */
140
-	public function getCreatedPages() : array {
138
+	public function getCreatedPages () : array {
141 139
 		return $this->createdPages;
142 140
 	}
143 141
 
144 142
 	/**
145 143
 	 * @param PageRiconferma $page
146 144
 	 */
147
-	public function addCreatedPages( PageRiconferma $page ) {
148
-		$this->createdPages[] = $page;
145
+	public function addCreatedPages ( PageRiconferma $page ) {
146
+		$this->createdPages[ ] = $page;
149 147
 	}
150 148
 }
Please login to merge, or discard this patch.