Passed
Push — master ( 1801c5...ff3dfd )
by Daimona
01:39
created
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
 
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 	/** @var array[] */
16 16
 	private $allUsers;
17 17
 	/** @var PageRiconferma[] */
18
-	private $createdPages = [];
18
+	private $createdPages = [ ];
19 19
 
20 20
 	/**
21 21
 	 * Get the full content of the JSON users list
22 22
 	 *
23 23
 	 * @return array[]
24 24
 	 */
25
-	public function getUsersList() : array {
25
+	public function getUsersList () : array {
26 26
 		if ( $this->allUsers === null ) {
27 27
 			$this->getLogger()->debug( 'Retrieving users list' );
28 28
 			$this->allUsers = PageBotList::get()->getAdminsList();
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return array[]
38 38
 	 */
39
-	public function getUsersToProcess() : array {
39
+	public function getUsersToProcess () : array {
40 40
 		if ( $this->processUsers === null ) {
41
-			$this->processUsers = [];
41
+			$this->processUsers = [ ];
42 42
 			foreach ( $this->getUsersList() as $user => $groups ) {
43 43
 				$timestamp = $this->getValidTimestamp( $groups );
44 44
 
@@ -60,13 +60,11 @@  discard block
 block discarded – undo
60 60
 	 * @param array $groups
61 61
 	 * @return int
62 62
 	 */
63
-	private function getValidTimestamp( array $groups ) : int {
63
+	private function getValidTimestamp ( array $groups ) : int {
64 64
 		$checkuser = isset( $groups[ 'checkuser' ] ) ?
65
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() :
66
-			0;
65
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0;
67 66
 		$bureaucrat = isset( $groups[ 'bureaucrat' ] ) ?
68
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() :
69
-			0;
67
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0;
70 68
 
71 69
 		$timestamp = max( $bureaucrat, $checkuser );
72 70
 		if ( $timestamp === 0 ) {
@@ -80,7 +78,7 @@  discard block
 block discarded – undo
80 78
 	 *
81 79
 	 * @return PageRiconferma[]
82 80
 	 */
83
-	public function getOpenPages() : array {
81
+	public function getOpenPages () : array {
84 82
 		static $list = null;
85 83
 		if ( $list === null ) {
86 84
 			$baseTitle = $this->getConfig()->get( 'main-page-title' );
@@ -94,10 +92,10 @@  discard block
 block discarded – undo
94 92
 
95 93
 			$res = RequestBase::newFromParams( $params )->execute();
96 94
 			$pages = $res->query->pages;
97
-			$list = [];
95
+			$list = [ ];
98 96
 			foreach ( reset( $pages )->templates as $page ) {
99 97
 				if ( preg_match( "!$baseTitle\/[^\/]+\/\d!", $page->title ) !== false ) {
100
-					$list[] = new PageRiconferma( $page->title );
98
+					$list[ ] = new PageRiconferma( $page->title );
101 99
 				}
102 100
 			}
103 101
 		}
@@ -110,14 +108,14 @@  discard block
 block discarded – undo
110 108
 	 *
111 109
 	 * @return PageRiconferma[]
112 110
 	 */
113
-	public function getPagesToClose() : array {
111
+	public function getPagesToClose () : array {
114 112
 		static $list = null;
115 113
 		if ( $list === null ) {
116 114
 			$allPages = $this->getOpenPages();
117
-			$list = [];
115
+			$list = [ ];
118 116
 			foreach ( $allPages as $page ) {
119 117
 				if ( time() > $page->getEndTimestamp() ) {
120
-					$list[] = $page;
118
+					$list[ ] = $page;
121 119
 				}
122 120
 			}
123 121
 		}
@@ -129,21 +127,21 @@  discard block
 block discarded – undo
129 127
 	 *
130 128
 	 * @param string $name
131 129
 	 */
132
-	public function removeUser( string $name ) {
130
+	public function removeUser ( string $name ) {
133 131
 		unset( $this->processUsers[ $name ] );
134 132
 	}
135 133
 
136 134
 	/**
137 135
 	 * @return PageRiconferma[]
138 136
 	 */
139
-	public function getCreatedPages() : array {
137
+	public function getCreatedPages () : array {
140 138
 		return $this->createdPages;
141 139
 	}
142 140
 
143 141
 	/**
144 142
 	 * @param PageRiconferma $page
145 143
 	 */
146
-	public function addCreatedPages( PageRiconferma $page ) {
147
-		$this->createdPages[] = $page;
144
+	public function addCreatedPages ( PageRiconferma $page ) {
145
+		$this->createdPages[ ] = $page;
148 146
 	}
149 147
 }
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +16 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\Task;
4 4
 
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	protected function getSubtasksMap(): array {
18
+	protected function getSubtasksMap (): array {
19 19
 		// Everything is done here.
20
-		return [];
20
+		return [ ];
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @inheritDoc
25 25
 	 */
26
-	public function runInternal() : int {
26
+	public function runInternal () : int {
27 27
 		$pages = $this->getDataProvider()->getOpenPages();
28 28
 
29 29
 		if ( !$pages ) {
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	 * @param PageRiconferma[] $pages
38 38
 	 * @return int a STATUS_* constant
39 39
 	 */
40
-	protected function processPages( array $pages ) : int {
41
-		$actualPages = [];
40
+	protected function processPages ( array $pages ) : int {
41
+		$actualPages = [ ];
42 42
 		foreach ( $pages as $page ) {
43 43
 			if ( $page->hasOpposition() && !$page->isVote() ) {
44 44
 				$this->openVote( $page );
45
-				$actualPages[] = $page;
45
+				$actualPages[ ] = $page;
46 46
 			}
47 47
 		}
48 48
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param PageRiconferma $page
62 62
 	 */
63
-	protected function openVote( PageRiconferma $page ) {
63
+	protected function openVote ( PageRiconferma $page ) {
64 64
 		$this->getLogger()->info( "Starting vote on $page" );
65 65
 
66 66
 		$content = $page->getContent();
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	 * @see SimpleUpdates::updateVote()
100 100
 	 * @see UpdatesAround::addVote()
101 101
 	 */
102
-	protected function updateVotePage( array $pages ) {
102
+	protected function updateVotePage ( array $pages ) {
103 103
 		$votePage = new Page( $this->getConfig()->get( 'vote-page-title' ) );
104 104
 		$content = $votePage->getContent();
105 105
 
106
-		$titles = [];
106
+		$titles = [ ];
107 107
 		foreach ( $pages as $page ) {
108
-			$titles[] = preg_quote( $page->getTitle() );
108
+			$titles[ ] = preg_quote( $page->getTitle() );
109 109
 		}
110 110
 		$titleReg = implode( '|', $titles );
111 111
 		$search = "!^\*.+ La \[\[($titleReg)\|procedura]] termina.+\n!gm";
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 );
129 129
 		} else {
130 130
 			// Start section
131
-			$matches = [];
131
+			$matches = [ ];
132 132
 			if ( preg_match( $introReg, $newContent, $matches ) === false ) {
133 133
 				throw new TaskException( 'Intro not found in vote page' );
134 134
 			}
135 135
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
136 136
 			// Replace semicolon with full stop
137 137
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
138
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 );
138
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 );
139 139
 		}
140 140
 
141 141
 		$summary = $this->msg( 'vote-start-vote-page-summary' )
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @see UpdatesAround::addNews()
158 158
 	 * @see SimpleUpdates::updateNews()
159 159
 	 */
160
-	protected function updateNews( int $amount ) {
160
+	protected function updateNews ( int $amount ) {
161 161
 		$this->getLogger()->info( "Turning $amount pages into votes" );
162 162
 		$newsPage = new Page( $this->getConfig()->get( 'news-page-title' ) );
163 163
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 			throw new TaskException( 'Param "voto" not found in news page' );
173 173
 		}
174 174
 
175
-		$newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: '';
176
-		$newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: '';
175
+		$newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: '';
176
+		$newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: '';
177 177
 
178 178
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
179 179
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
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( ', ', array_map( 'strval', $pages ) )
43 43
 		);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param PageRiconferma[] $pages
66 66
 	 */
67
-	protected function addVote( array $pages ) {
67
+	protected function addVote ( array $pages ) {
68 68
 		$this->getLogger()->info(
69 69
 			'Adding the following to votes: ' . implode( ', ', array_map( 'strval', $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 addNews( int $amount ) {
115
+	protected function addNews ( 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( ', ', array_map( 'strval', $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
 		$mainPage->edit( [
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param PageRiconferma[] $pages
57 57
 	 */
58
-	protected function addToArchive( array $pages ) {
58
+	protected function addToArchive ( array $pages ) {
59 59
 		$this->getLogger()->info(
60 60
 			'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) )
61 61
 		);
62 62
 
63
-		$simple = $votes = [];
63
+		$simple = $votes = [ ];
64 64
 		foreach ( $pages as $page ) {
65 65
 			if ( $page->isVote() ) {
66
-				$votes[] = $page;
66
+				$votes[ ] = $page;
67 67
 			} else {
68
-				$simple[] = $page;
68
+				$simple[ ] = $page;
69 69
 			}
70 70
 		}
71 71
 
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 * @param string $archiveTitle
83 83
 	 * @param array $pages
84 84
 	 */
85
-	private function reallyAddToArchive( string $archiveTitle, array $pages ) {
85
+	private function reallyAddToArchive ( string $archiveTitle, array $pages ) {
86 86
 		$archivePage = new Page( "$archiveTitle/" . date( 'Y' ) );
87 87
 
88 88
 		$append = '';
89
-		$archivedList = [];
89
+		$archivedList = [ ];
90 90
 		foreach ( $pages as $page ) {
91 91
 			$append .= '{{' . $page->getTitle() . "}}\n";
92
-			$archivedList[] = $page->getUserNum();
92
+			$archivedList[ ] = $page->getUserNum();
93 93
 		}
94 94
 
95 95
 		$summary = $this->msg( 'close-archive-summary' )
Please login to merge, or discard this patch.
includes/Task/Subtask/CreatePages.php 1 patch
Spacing   +11 added lines, -11 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
 		$users = $this->getDataProvider()->getUsersToProcess();
19 19
 
20 20
 		if ( !$users ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $user
35 35
 	 * @param array $groups
36 36
 	 */
37
-	protected function processUser( string $user, array $groups ) {
37
+	protected function processUser ( string $user, array $groups ) {
38 38
 		try {
39 39
 			$num = $this->getLastPageNum( $user ) + 1;
40 40
 		} catch ( TaskException $e ) {
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @return int
67 67
 	 * @throws TaskException
68 68
 	 */
69
-	protected function getLastPageNum( string $user ) : int {
69
+	protected function getLastPageNum ( string $user ) : int {
70 70
 		$this->getLogger()->debug( "Retrieving previous pages for $user" );
71
-		$unprefixedTitle = explode( ':', $this->getConfig()->get( 'main-page-title' ), 2 )[1];
71
+		$unprefixedTitle = explode( ':', $this->getConfig()->get( 'main-page-title' ), 2 )[ 1 ];
72 72
 		$params = [
73 73
 			'action' => 'query',
74 74
 			'list' => 'allpages',
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 * @param string $user
104 104
 	 * @param array $groups
105 105
 	 */
106
-	protected function createPage( string $title, string $user, array $groups ) {
106
+	protected function createPage ( string $title, string $user, array $groups ) {
107 107
 		$this->getLogger()->info( "Creating page $title" );
108 108
 		$textParams = [
109 109
 			'$user' => $user,
110
-			'$date' => $groups['sysop'],
111
-			'$burocrate' => $groups['bureaucrat'] ?? '',
112
-			'$checkuser' => $groups['checkuser'] ?? ''
110
+			'$date' => $groups[ 'sysop' ],
111
+			'$burocrate' => $groups[ 'bureaucrat' ] ?? '',
112
+			'$checkuser' => $groups[ 'checkuser' ] ?? ''
113 113
 		];
114 114
 
115 115
 		$params = [
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string $title
128 128
 	 * @param string $newText
129 129
 	 */
130
-	protected function createBasePage( string $title, string $newText ) {
130
+	protected function createBasePage ( string $title, string $newText ) {
131 131
 		$this->getLogger()->info( "Creating base page $title" );
132 132
 
133 133
 		$params = [
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $title
145 145
 	 * @param string $newText
146 146
 	 */
147
-	protected function updateBasePage( string $title, string $newText ) {
147
+	protected function updateBasePage ( string $title, string $newText ) {
148 148
 		$this->getLogger()->info( "Updating base page $title" );
149 149
 
150 150
 		$params = [
Please login to merge, or discard this patch.
includes/Task/Subtask/SimpleUpdates.php 1 patch
Spacing   +16 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\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::addVote()
35 35
 	 */
36
-	protected function updateVote( array $pages ) {
36
+	protected function updateVote ( array $pages ) {
37 37
 		$this->getLogger()->info(
38 38
 			'Updating votazioni: ' . implode( ', ', array_map( 'strval', $pages ) )
39 39
 		);
40 40
 		$votePage = new Page( $this->getConfig()->get( 'vote-page-title' ) );
41 41
 
42
-		$titles = [];
42
+		$titles = [ ];
43 43
 		foreach ( $pages as $page ) {
44
-			$titles[] = preg_quote( $page->getTitle() );
44
+			$titles[ ] = preg_quote( $page->getTitle() );
45 45
 		}
46 46
 
47 47
 		$titleReg = implode( '|', $titles );
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @param array $pages
71 71
 	 * @see UpdatesAround::addNews()
72 72
 	 */
73
-	protected function updateNews( array $pages ) {
73
+	protected function updateNews ( array $pages ) {
74 74
 		$simpleAmount = $voteAmount = 0;
75 75
 		foreach ( $pages as $page ) {
76 76
 			if ( $page->isVote() ) {
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
94 94
 		$voteMatches = $newsPage->getMatch( $voteReg );
95 95
 
96
-		$newSimp = (int)$simpleMatches[2] - $simpleAmount ?: '';
97
-		$newVote = (int)$voteMatches[2] - $voteAmount ?: '';
96
+		$newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: '';
97
+		$newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: '';
98 98
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content );
99 99
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
100 100
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @param PageRiconferma[] $pages
114 114
 	 */
115
-	protected function updateAdminList( array $pages ) {
115
+	protected function updateAdminList ( array $pages ) {
116 116
 		$this->getLogger()->info(
117 117
 			'Updating admin list: ' . implode( ', ', array_map( 'strval', $pages ) )
118 118
 		);
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 		$newContent = $adminsPage->getContent();
121 121
 		$newDate = date( 'Ymd', strtotime( '+1 year' ) );
122 122
 
123
-		$riconfNames = $removeNames = [];
123
+		$riconfNames = $removeNames = [ ];
124 124
 		foreach ( $pages as $page ) {
125 125
 			$user = $page->getUser();
126 126
 			$reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!";
127 127
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
128 128
 				// Remove the line
129 129
 				$newContent = preg_replace( $reg, '', $newContent );
130
-				$removeNames[] = $user;
130
+				$removeNames[ ] = $user;
131 131
 			} else {
132 132
 				$newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent );
133
-				$riconfNames[] = $user;
133
+				$riconfNames[ ] = $user;
134 134
 			}
135 135
 		}
136 136
 
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 	/**
151 151
 	 * @param PageRiconferma[] $pages
152 152
 	 */
153
-	protected function updateCUList( array $pages ) {
153
+	protected function updateCUList ( array $pages ) {
154 154
 		$this->getLogger()->info( 'Checking if CU list needs updating.' );
155 155
 		$cuList = new Page( $this->getConfig()->get( 'cu-list-title' ) );
156 156
 		$admins = $this->getDataProvider()->getUsersList();
157 157
 		$newContent = $cuList->getContent();
158 158
 
159
-		$riconfNames = $removeNames = [];
159
+		$riconfNames = $removeNames = [ ];
160 160
 		foreach ( $pages as $page ) {
161 161
 			$user = $page->getUser();
162 162
 			if ( array_key_exists( 'checkuser', $admins[ $user ] ) ) {
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 				if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
165 165
 					// Remove the line
166 166
 					$newContent = preg_replace( $reg, '', $newContent );
167
-					$removeNames[] = $user;
167
+					$removeNames[ ] = $user;
168 168
 				} else {
169 169
 					$newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent );
170
-					$riconfNames[] = $user;
170
+					$riconfNames[ ] = $user;
171 171
 				}
172 172
 			}
173 173
 		}
Please login to merge, or discard this patch.
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
 
@@ -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
 		$failed = $this->getFailures();
19 19
 		if ( $failed ) {
20 20
 			$this->updateBurList( $failed );
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return PageRiconferma[]
33 33
 	 */
34
-	private function getFailures() : array {
35
-		$ret = [];
34
+	private function getFailures () : array {
35
+		$ret = [ ];
36 36
 		$allPages = $this->getDataProvider()->getPagesToClose();
37 37
 		foreach ( $allPages as $page ) {
38 38
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
39
-				$ret[] = $page;
39
+				$ret[ ] = $page;
40 40
 			}
41 41
 		}
42 42
 		return $ret;
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	/**
46 46
 	 * @param PageRiconferma[] $pages
47 47
 	 */
48
-	protected function updateBurList( array $pages ) {
48
+	protected function updateBurList ( array $pages ) {
49 49
 		$this->getLogger()->info( 'Checking if bur list needs updating.' );
50 50
 		$admins = $this->getDataProvider()->getUsersList();
51 51
 
52
-		$remove = [];
52
+		$remove = [ ];
53 53
 		foreach ( $pages as $page ) {
54 54
 			$user = $page->getUser();
55 55
 			if ( array_key_exists( 'bureaucrat', $admins[ $user ] ) &&
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( ', ', array_map( 'strval', $pages ) )
91 91
 		);
@@ -124,14 +124,14 @@  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
 
130
-		$names = [];
130
+		$names = [ ];
131 131
 		$text = '';
132 132
 		foreach ( $pages as $page ) {
133 133
 			$user = $page->getUser();
134
-			$names[] = $user;
134
+			$names[ ] = $user;
135 135
 			$text .= "{{Breve|admin|{{subst:#time:j}}|[[Utente:$user|]] " .
136 136
 				"non è stato riconfermato [[WP:A|amministratore]].}}\n";
137 137
 		}
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @param PageRiconferma[] $pages
167 167
 	 */
168
-	protected function updateUltimeNotizie( array $pages ) {
168
+	protected function updateUltimeNotizie ( array $pages ) {
169 169
 		$this->getLogger()->info( 'Updating ultime notizie' );
170 170
 		$notiziePage = new Page( $this->getConfig()->get( 'ultimenotizie-page-title' ) );
171 171
 
172
-		$names = [];
172
+		$names = [ ];
173 173
 		$text = '';
174 174
 		foreach ( $pages as $page ) {
175 175
 			$user = $page->getUser();
176 176
 			$title = $page->getTitle();
177
-			$names[] = $user;
177
+			$names[ ] = $user;
178 178
 			$text .= "'''{{subst:#time:j F}}''': [[Utente:$user|]] non è stato [[$title|riconfermato]] " .
179 179
 				'[[WP:A|amministratore]]; ora gli admin sono {{subst:#expr: {{NUMBEROFADMINS}} - 1}}.';
180 180
 		}
Please login to merge, or discard this patch.