Passed
Push — master ( 33a572...6f44ea )
by Daimona
01:49
created
includes/PageRiconferma.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;
4 4
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param string $title
20 20
 	 * @param WikiController $controller
21 21
 	 */
22
-	public function __construct( string $title, WikiController $controller ) {
22
+	public function __construct ( string $title, WikiController $controller ) {
23 23
 		$this->title = $title;
24 24
 		$this->controller = $controller;
25 25
 	}
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @return string
29 29
 	 */
30
-	public function getTitle() : string {
30
+	public function getTitle () : string {
31 31
 		return $this->title;
32 32
 	}
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return string
38 38
 	 */
39
-	public function getUser() : string {
40
-		return explode( '/', $this->title )[2];
39
+	public function getUser () : string {
40
+		return explode( '/', $this->title )[ 2 ];
41 41
 	}
42 42
 
43 43
 	/**
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return string
47 47
 	 */
48
-	public function getUserNum() : string {
49
-		return explode( '/', $this->getTitle(), 3 )[2];
48
+	public function getUserNum () : string {
49
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
50 50
 	}
51 51
 
52 52
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return string
56 56
 	 */
57
-	public function getBaseTitle() : string {
57
+	public function getBaseTitle () : string {
58 58
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
59 59
 	}
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string
65 65
 	 */
66
-	public function getContent() : string {
66
+	public function getContent () : string {
67 67
 		if ( $this->content === null ) {
68 68
 			$this->content = $this->controller->getPageContent( $this->title );
69 69
 		}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return bool
77 77
 	 */
78
-	public function hasOpposition() : bool {
78
+	public function hasOpposition () : bool {
79 79
 		$params = [
80 80
 			'action' => 'query',
81 81
 			'prop' => 'revisions',
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		];
87 87
 		$res = RequestBase::newFromParams( $params )->execute();
88 88
 		$page = reset( $res->query->pages );
89
-		$content = $page->revisions[0]->slots->main->{ '*' };
89
+		$content = $page->revisions[ 0 ]->slots->main->{ '*' };
90 90
 		// Let's hope that this is good enough...
91 91
 		$votes = substr_count( $content, "\n\# *(?![#*])" );
92 92
 		return $votes >= 15;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return bool
99 99
 	 */
100
-	public function isVote() : bool {
100
+	public function isVote () : bool {
101 101
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
102 102
 		return preg_match( $sectionReg, $this->getContent() ) === false;
103 103
 	}
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return int
109 109
 	 */
110
-	public function getEndTimestamp() : int {
110
+	public function getEndTimestamp () : int {
111 111
 		if ( $this->isVote() ) {
112
-			$matches = [];
112
+			$matches = [ ];
113 113
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
114 114
 			preg_match( $reg, $this->getContent(), $matches );
115 115
 			list( , $day, $hours ) = $matches;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		}
122 122
 	}
123 123
 
124
-	public function __toString() {
124
+	public function __toString () {
125 125
 		return $this->getTitle();
126 126
 	}
127 127
 }
Please login to merge, or discard this patch.
includes/TaskDataProvider.php 1 patch
Spacing   +14 added lines, -16 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
 
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
12 12
 	private $users;
13 13
 
14 14
 	/** @var string[] */
15
-	private $createdPages = [];
15
+	private $createdPages = [ ];
16 16
 
17 17
 	/**
18 18
 	 * Get a list of users to execute tasks on.
19 19
 	 *
20 20
 	 * @return array[]
21 21
 	 */
22
-	public function getUsersToProcess() : array {
22
+	public function getUsersToProcess () : array {
23 23
 		if ( $this->users === null ) {
24 24
 			$this->getLogger()->debug( 'Retrieving users list' );
25 25
 			$content = $this->getController()->getPageContent( $this->getConfig()->get( 'list-title' ) );
26 26
 			$listUsers = json_decode( $content, true );
27 27
 
28
-			$this->users = [];
28
+			$this->users = [ ];
29 29
 			foreach ( $listUsers as $user => $groups ) {
30 30
 				$timestamp = $this->getValidTimestamp( $groups );
31 31
 
@@ -47,13 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @param array $groups
48 48
 	 * @return int
49 49
 	 */
50
-	private function getValidTimestamp( array $groups ) : int {
50
+	private function getValidTimestamp ( array $groups ) : int {
51 51
 		$checkuser = isset( $groups[ 'checkuser' ] ) ?
52
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() :
53
-			0;
52
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0;
54 53
 		$bureaucrat = isset( $groups[ 'bureaucrat' ] ) ?
55
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() :
56
-			0;
54
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0;
57 55
 
58 56
 		$timestamp = max( $bureaucrat, $checkuser );
59 57
 		if ( $timestamp === 0 ) {
@@ -67,7 +65,7 @@  discard block
 block discarded – undo
67 65
 	 *
68 66
 	 * @return PageRiconferma[]
69 67
 	 */
70
-	public function getOpenPages() : array {
68
+	public function getOpenPages () : array {
71 69
 		$baseTitle = $this->getConfig()->get( 'ric-main-page' );
72 70
 		$params = [
73 71
 			'action' => 'query',
@@ -79,10 +77,10 @@  discard block
 block discarded – undo
79 77
 
80 78
 		$res = RequestBase::newFromParams( $params )->execute();
81 79
 		$pages = $res->query->pages;
82
-		$ret = [];
80
+		$ret = [ ];
83 81
 		foreach ( reset( $pages )->templates as $page ) {
84 82
 			if ( preg_match( "!$baseTitle\/[^\/]+\/\d!", $page->title ) !== false ) {
85
-				$ret[] = new PageRiconferma( $page->title, $this->getController() );
83
+				$ret[ ] = new PageRiconferma( $page->title, $this->getController() );
86 84
 			}
87 85
 		}
88 86
 		return $ret;
@@ -93,21 +91,21 @@  discard block
 block discarded – undo
93 91
 	 *
94 92
 	 * @param string $name
95 93
 	 */
96
-	public function removeUser( string $name ) {
94
+	public function removeUser ( string $name ) {
97 95
 		unset( $this->users[ $name ] );
98 96
 	}
99 97
 
100 98
 	/**
101 99
 	 * @return string[]
102 100
 	 */
103
-	public function getCreatedPages() : array {
101
+	public function getCreatedPages () : array {
104 102
 		return $this->createdPages;
105 103
 	}
106 104
 
107 105
 	/**
108 106
 	 * @param string $title
109 107
 	 */
110
-	public function addCreatedPages( string $title ) {
111
-		$this->createdPages[] = $title;
108
+	public function addCreatedPages ( string $title ) {
109
+		$this->createdPages[ ] = $title;
112 110
 	}
113 111
 }
Please login to merge, or discard this patch.
includes/WikiController.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;
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',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			throw new MissingPageException( $title );
48 48
 		}
49 49
 
50
-		return $page->revisions[0]->slots->main->{ '*' };
50
+		return $page->revisions[ 0 ]->slots->main->{ '*' };
51 51
 	}
52 52
 
53 53
 	/**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param array $params
57 57
 	 * @throws EditException
58 58
 	 */
59
-	public function editPage( array $params ) {
59
+	public function editPage ( array $params ) {
60 60
 		$this->login();
61 61
 
62 62
 		$params = [
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return string
79 79
 	 * @fixme Not the right place for this
80 80
 	 */
81
-	public static function getTimeWithArticle( int $timestamp ) : string {
81
+	public static function getTimeWithArticle ( int $timestamp ) : string {
82 82
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
83 83
 		$timeString = strftime( '%e %B alle %R', $timestamp );
84 84
 		// Remove the left space if day has a single digit
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 	 * @fixme Not the right place for this
98 98
 	 * @todo Is there a better way?
99 99
 	 */
100
-	public static function getTimestampFromLocalTime( string $timeString ) : int {
100
+	public static function getTimestampFromLocalTime ( string $timeString ) : int {
101 101
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
102 102
 		$bits = strptime( $timeString, '%e %m %Y alle %H:%M' );
103 103
 		$timestamp = mktime(
104
-			$bits['tm_hour'],
105
-			$bits['tm_min'],
104
+			$bits[ 'tm_hour' ],
105
+			$bits[ 'tm_min' ],
106 106
 			0,
107
-			$bits['tm_mon'] + 1,
108
-			$bits['tm_mday'],
109
-			$bits['tm_year'] + 1900
107
+			$bits[ 'tm_mon' ] + 1,
108
+			$bits[ 'tm_mday' ],
109
+			$bits[ 'tm_year' ] + 1900
110 110
 		);
111 111
 		setlocale( LC_TIME, $oldLoc );
112 112
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
117 117
 	 * @throws LoginException
118 118
 	 */
119
-	public function login() {
119
+	public function login () {
120 120
 		if ( self::$loggedIn ) {
121 121
 			$this->logger->debug( 'Already logged in' );
122 122
 			return;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 		self::$loggedIn = true;
145 145
 		// Clear tokens cache
146
-		$this->tokens = [];
146
+		$this->tokens = [ ];
147 147
 		$this->logger->info( 'Login succeeded' );
148 148
 	}
149 149
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @param string $type
154 154
 	 * @return string
155 155
 	 */
156
-	public function getToken( string $type ) : string {
156
+	public function getToken ( string $type ) : string {
157 157
 		if ( !isset( $this->tokens[ $type ] ) ) {
158 158
 			$params = [
159 159
 				'action' => 'query',
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param string $title
177 177
 	 * @return int
178 178
 	 */
179
-	public function getPageCreationTS( string $title ) : int {
179
+	public function getPageCreationTS ( string $title ) : int {
180 180
 		$params = [
181 181
 			'action' => 'query',
182 182
 			'prop' => 'revisions',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$res = ( RequestBase::newFromParams( $params ) )->execute();
191 191
 		$data = $res->query->pages;
192
-		return strtotime( reset( $data )->revisions[0]->timestamp );
192
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
193 193
 	}
194 194
 
195 195
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @param string $title
199 199
 	 * @param string $reason
200 200
 	 */
201
-	public function protectPage( string $title, string $reason ) {
201
+	public function protectPage ( string $title, string $reason ) {
202 202
 		$this->logger->info( "Protecting page $title" );
203 203
 		$this->login();
204 204
 
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +17 added lines, -17 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task StartVote' );
19 19
 
20 20
 		$pages = $this->getDataProvider()->getOpenPages();
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @param PageRiconferma[] $pages
34 34
 	 */
35
-	protected function processPages( array $pages ) {
36
-		$actualPages = [];
35
+	protected function processPages ( array $pages ) {
36
+		$actualPages = [ ];
37 37
 		foreach ( $pages as $page ) {
38 38
 			if ( $page->hasOpposition() && !$page->isVote() ) {
39 39
 				$this->openVote( $page );
40
-				$actualPages[] = $page;
40
+				$actualPages[ ] = $page;
41 41
 			}
42 42
 		}
43 43
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @param PageRiconferma $page
56 56
 	 */
57
-	protected function openVote( PageRiconferma $page ) {
57
+	protected function openVote ( PageRiconferma $page ) {
58 58
 		$this->getLogger()->info( "Starting vote on $page" );
59 59
 
60 60
 		$content = $page->getContent();
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 * @see ClosePages::updateVote()
94 94
 	 * @see UpdatesAround::addVote()
95 95
 	 */
96
-	protected function updateVotePage( array $pages ) {
96
+	protected function updateVotePage ( array $pages ) {
97 97
 		$votePage = $this->getConfig()->get( 'ric-vote-page' );
98 98
 		$content = $this->getController()->getPageContent( $votePage );
99 99
 
100
-		$titles = [];
100
+		$titles = [ ];
101 101
 		foreach ( $pages as $page ) {
102
-			$titles[] = preg_quote( $page->getTitle() );
102
+			$titles[ ] = preg_quote( $page->getTitle() );
103 103
 		}
104 104
 		$titleReg = implode( '|', $titles );
105 105
 		$search = "!^\*.+ La \[\[($titleReg)\|procedura]] termina.+\n!gm";
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 );
122 122
 		} else {
123 123
 			// Start section
124
-			$matches = [];
124
+			$matches = [ ];
125 125
 			if ( preg_match( $introReg, $content, $matches ) === false ) {
126 126
 				throw new TaskException( 'Intro not found in vote page' );
127 127
 			}
128 128
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
129 129
 			// Replace semicolon with full stop
130 130
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
131
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 );
131
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 );
132 132
 		}
133 133
 
134 134
 		$summary = strtr(
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		$summary = preg_replace_callback(
139 139
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
140 140
 			function ( $matches ) {
141
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
141
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
142 142
 			},
143 143
 			$summary
144 144
 		);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @see UpdatesAround::addNews()
160 160
 	 * @see ClosePages::updateNews()
161 161
 	 */
162
-	protected function updateNews( int $amount ) {
162
+	protected function updateNews ( int $amount ) {
163 163
 		$this->getLogger()->info( "Turning $amount pages into votes" );
164 164
 		$newsPage = $this->getConfig()->get( 'ric-news-page' );
165 165
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$regTac = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!';
168 168
 		$regVot = '!(\| *riconferme[ _]voto[ _]amministratori *= *)(\d+)!';
169 169
 
170
-		$tacMatches = $votMatches = [];
170
+		$tacMatches = $votMatches = [ ];
171 171
 		if ( preg_match( $regTac, $content, $tacMatches ) === false ) {
172 172
 			throw new TaskException( 'Param "tacite" not found in news page' );
173 173
 		}
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			throw new TaskException( 'Param "voto" not found in news page' );
176 176
 		}
177 177
 
178
-		$newTac = (int)$tacMatches[2] - $amount;
179
-		$newVot = (int)$votMatches[2] + $amount;
178
+		$newTac = (int)$tacMatches[ 2 ] - $amount;
179
+		$newVot = (int)$votMatches[ 2 ] + $amount;
180 180
 
181 181
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
182 182
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$summary = preg_replace_callback(
189 189
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
190 190
 			function ( $matches ) {
191
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
191
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
192 192
 			},
193 193
 			$summary
194 194
 		);
Please login to merge, or discard this patch.
includes/Task/ClosePages.php 1 patch
Spacing   +24 added lines, -24 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
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	public function run() : TaskResult {
18
+	public function run () : TaskResult {
19 19
 		$this->getLogger()->info( 'Starting task ClosePages' );
20 20
 
21 21
 		$pages = $this->getPagesList();
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return PageRiconferma[]
42 42
 	 */
43
-	protected function getPagesList() : array {
43
+	protected function getPagesList () : array {
44 44
 		$allPages = $this->getDataProvider()->getOpenPages();
45
-		$ret = [];
45
+		$ret = [ ];
46 46
 		foreach ( $allPages as $page ) {
47 47
 			if ( time() > $page->getEndTimestamp() && !$page->hasOpposition() ) {
48
-				$ret[] = $page;
48
+				$ret[ ] = $page;
49 49
 			}
50 50
 		}
51 51
 		return $ret;
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 	 * @param PageRiconferma[] $pages
57 57
 	 * @see UpdatesAround::addToMainPage()
58 58
 	 */
59
-	protected function removeFromMainPage( array $pages ) {
59
+	protected function removeFromMainPage ( array $pages ) {
60 60
 		$this->getLogger()->info(
61 61
 			'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) )
62 62
 		);
63 63
 
64 64
 		$mainPage = $this->getConfig()->get( 'ric-main-page' );
65 65
 		$content = $this->getController()->getPageContent( $mainPage );
66
-		$translations = [];
66
+		$translations = [ ];
67 67
 		foreach ( $pages as $page ) {
68 68
 			$translations[ '{{' . $page->getTitle() . '}}' ] = '';
69 69
 		}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param PageRiconferma[] $pages
83 83
 	 */
84
-	protected function addToArchive( array $pages ) {
84
+	protected function addToArchive ( array $pages ) {
85 85
 		$this->getLogger()->info(
86 86
 			'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) )
87 87
 		);
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 		$archiveTitle = "$archiveTitle/" . date( 'Y' );
91 91
 
92 92
 		$append = '';
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
 		if ( count( $archivedList ) > 1 ) {
100 100
 			$last = array_pop( $archivedList );
101 101
 			$userNums = implode( ', ', $archivedList ) . " e $last";
102 102
 		} else {
103
-			$userNums = $archivedList[0];
103
+			$userNums = $archivedList[ 0 ];
104 104
 		}
105 105
 
106 106
 		$summary = strtr(
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @param PageRiconferma $page
122 122
 	 * @see CreatePages::updateBasePage()
123 123
 	 */
124
-	protected function updateBasePage( PageRiconferma $page ) {
124
+	protected function updateBasePage ( PageRiconferma $page ) {
125 125
 		$this->getLogger()->info( "Updating base page for $page" );
126 126
 
127 127
 		$current = $this->getController()->getPageContent( $page->getBaseTitle() );
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 * @param PageRiconferma[] $pages
141 141
 	 * @see UpdatesAround::addVote()
142 142
 	 */
143
-	protected function updateVote( array $pages ) {
143
+	protected function updateVote ( array $pages ) {
144 144
 		$votePage = $this->getConfig()->get( 'ric-vote-page' );
145 145
 		$content = $this->getController()->getPageContent( $votePage );
146 146
 
147
-		$titles = [];
147
+		$titles = [ ];
148 148
 		foreach ( $pages as $page ) {
149
-			$titles[] = preg_quote( $page->getTitle() );
149
+			$titles[ ] = preg_quote( $page->getTitle() );
150 150
 		}
151 151
 
152 152
 		$titleReg = implode( '|', $titles );
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$summary = preg_replace_callback(
165 165
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
166 166
 			function ( $matches ) {
167
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
167
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
168 168
 			},
169 169
 			$summary
170 170
 		);
@@ -183,19 +183,19 @@  discard block
 block discarded – undo
183 183
 	 * @throws TaskException
184 184
 	 * @see UpdatesAround::addNews()
185 185
 	 */
186
-	protected function updateNews( int $amount ) {
186
+	protected function updateNews ( int $amount ) {
187 187
 		$this->getLogger()->info( "Decreasing the news counter by $amount" );
188 188
 		$newsPage = $this->getConfig()->get( 'ric-news-page' );
189 189
 
190 190
 		$content = $this->getController()->getPageContent( $newsPage );
191 191
 		$reg = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!';
192 192
 
193
-		$matches = [];
193
+		$matches = [ ];
194 194
 		if ( preg_match( $reg, $content, $matches ) === false ) {
195 195
 			throw new TaskException( 'Param not found in news page' );
196 196
 		}
197 197
 
198
-		$newNum = (int)$matches[2] - $amount;
198
+		$newNum = (int)$matches[ 2 ] - $amount;
199 199
 		$newContent = preg_replace( $reg, '${1}' . $newNum, $content );
200 200
 
201 201
 		$summary = strtr(
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		$summary = preg_replace_callback(
206 206
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
207 207
 			function ( $matches ) {
208
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
208
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
209 209
 			},
210 210
 			$summary
211 211
 		);
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @param PageRiconferma[] $pages
226 226
 	 */
227
-	protected function updateAdminList( array $pages ) {
227
+	protected function updateAdminList ( array $pages ) {
228 228
 		$listTitle = $this->getConfig()->get( 'admins-list' );
229 229
 		$content = $this->getController()->getPageContent( $listTitle );
230 230
 		$newDate = date( 'Ymd', strtotime( '+1 year' ) );
231 231
 
232
-		$names = [];
232
+		$names = [ ];
233 233
 		foreach ( $pages as $page ) {
234 234
 			$user = $page->getUser();
235
-			$names[] = $user;
235
+			$names[ ] = $user;
236 236
 			$reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+(?= *\|(?: *pausa)? *\}\})!";
237 237
 			$content = preg_replace( $reg, '$1' . $newDate, $content );
238 238
 		}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			$lastUser = array_pop( $names );
242 242
 			$usersList = implode( ', ', $names ) . " e $lastUser";
243 243
 		} else {
244
-			$usersList = $names[0];
244
+			$usersList = $names[ 0 ];
245 245
 		}
246 246
 
247 247
 		$summary = strtr(
Please login to merge, or discard this patch.