@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Task\Subtask; |
4 | 4 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @inheritDoc |
18 | 18 | */ |
19 | - public function runInternal() : int { |
|
19 | + public function runInternal () : int { |
|
20 | 20 | $failed = $this->getFailures(); |
21 | 21 | if ( $failed ) { |
22 | 22 | $bureaucrats = $this->getFailedBureaucrats( $failed ); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return PageRiconferma[] |
38 | 38 | */ |
39 | - private function getFailures() : array { |
|
40 | - $ret = []; |
|
39 | + private function getFailures () : array { |
|
40 | + $ret = [ ]; |
|
41 | 41 | $allPages = $this->getDataProvider()->getPagesToClose(); |
42 | 42 | foreach ( $allPages as $page ) { |
43 | 43 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
44 | - $ret[] = $page; |
|
44 | + $ret[ ] = $page; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | return $ret; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @param User[] $users |
52 | 52 | */ |
53 | - protected function updateBurList( array $users ) { |
|
53 | + protected function updateBurList ( array $users ) { |
|
54 | 54 | $this->getLogger()->info( 'Updating bur list. Removing: ' . implode( ', ', $users ) ); |
55 | 55 | $remList = Element::regexFromArray( $users ); |
56 | 56 | $burList = new Page( $this->getConfig()->get( 'bur-list-title' ) ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param PageRiconferma[] $pages |
75 | 75 | */ |
76 | - protected function requestRemoval( array $pages ) { |
|
76 | + protected function requestRemoval ( array $pages ) { |
|
77 | 77 | $this->getLogger()->info( |
78 | 78 | 'Requesting removal on meta for: ' . implode( ', ', $pages ) |
79 | 79 | ); |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param PageRiconferma[] $pages |
114 | 114 | */ |
115 | - protected function updateAnnunci( array $pages ) { |
|
115 | + protected function updateAnnunci ( array $pages ) { |
|
116 | 116 | $this->getLogger()->info( 'Updating annunci' ); |
117 | 117 | $section = 1; |
118 | 118 | |
119 | - $names = []; |
|
119 | + $names = [ ]; |
|
120 | 120 | $text = ''; |
121 | 121 | $msg = $this->msg( 'annunci-text' ); |
122 | 122 | foreach ( $pages as $page ) { |
123 | 123 | $user = $page->getUser()->getName(); |
124 | - $names[] = $user; |
|
124 | + $names[ ] = $user; |
|
125 | 125 | $text .= $msg->params( [ '$user' => $user ] )->text(); |
126 | 126 | } |
127 | 127 | |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param PageRiconferma[] $pages |
155 | 155 | */ |
156 | - protected function updateUltimeNotizie( array $pages ) { |
|
156 | + protected function updateUltimeNotizie ( array $pages ) { |
|
157 | 157 | $this->getLogger()->info( 'Updating ultime notizie' ); |
158 | 158 | $notiziePage = new Page( $this->getConfig()->get( 'ultimenotizie-page-title' ) ); |
159 | 159 | |
160 | - $names = []; |
|
160 | + $names = [ ]; |
|
161 | 161 | $text = ''; |
162 | 162 | $msg = $this->msg( 'ultimenotizie-text' ); |
163 | 163 | foreach ( $pages as $page ) { |
164 | 164 | $user = $page->getUser()->getName(); |
165 | 165 | $title = $page->getTitle(); |
166 | - $names[] = $user; |
|
166 | + $names[ ] = $user; |
|
167 | 167 | $text .= $msg->params( [ '$user' => $user, '$title' => $title ] )->text(); |
168 | 168 | } |
169 | 169 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @param PageRiconferma[] $pages |
194 | 194 | * @return User[] |
195 | 195 | */ |
196 | - private function getFailedBureaucrats( array $pages ) : array { |
|
197 | - $ret = []; |
|
196 | + private function getFailedBureaucrats ( array $pages ) : array { |
|
197 | + $ret = [ ]; |
|
198 | 198 | foreach ( $pages as $page ) { |
199 | 199 | $user = $page->getUser(); |
200 | 200 | if ( $user->inGroup( 'bureaucrat' ) ) { |
201 | - $ret[] = $user; |
|
201 | + $ret[ ] = $user; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | return $ret; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Task\Subtask; |
4 | 4 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @inheritDoc |
18 | 18 | */ |
19 | - public function runInternal() : int { |
|
19 | + public function runInternal () : int { |
|
20 | 20 | $pages = $this->getDataProvider()->getPagesToClose(); |
21 | 21 | |
22 | 22 | if ( !$pages ) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param PageRiconferma[] $pages |
39 | 39 | * @see UpdatesAround::addToVotazioni() |
40 | 40 | */ |
41 | - protected function updateVotazioni( array $pages ) { |
|
41 | + protected function updateVotazioni ( array $pages ) { |
|
42 | 42 | $this->getLogger()->info( |
43 | 43 | 'Updating votazioni: ' . implode( ', ', $pages ) |
44 | 44 | ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array $pages |
71 | 71 | * @see UpdatesAround::addToNews() |
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 |
||
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,21 +112,21 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param bool[] $outcomes |
114 | 114 | */ |
115 | - protected function updateAdminList( array $outcomes ) { |
|
115 | + protected function updateAdminList ( array $outcomes ) { |
|
116 | 116 | $this->getLogger()->info( 'Updating admin list' ); |
117 | 117 | $adminsPage = new Page( $this->getConfig()->get( 'admins-list-title' ) ); |
118 | 118 | $newContent = $adminsPage->getContent(); |
119 | 119 | |
120 | - $riconfNames = $removeNames = []; |
|
120 | + $riconfNames = $removeNames = [ ]; |
|
121 | 121 | foreach ( $outcomes as $user => $confirmed ) { |
122 | 122 | $userReg = ( new User( $user ) )->getRegex(); |
123 | 123 | $reg = "!(\{\{Amministratore\/riga\|$userReg.+\| *)\d+( *\|[ \w]*\}\}.*\n)!"; |
124 | 124 | if ( $confirmed ) { |
125 | 125 | $newContent = preg_replace( $reg, '${1}{{subst:#time:Ymd|+1 year}}$2', $newContent ); |
126 | - $riconfNames[] = $user; |
|
126 | + $riconfNames[ ] = $user; |
|
127 | 127 | } else { |
128 | 128 | $newContent = preg_replace( $reg, '', $newContent ); |
129 | - $removeNames[] = $user; |
|
129 | + $removeNames[ ] = $user; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -146,21 +146,21 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * @param bool[] $outcomes |
148 | 148 | */ |
149 | - protected function updateCUList( array $outcomes ) { |
|
149 | + protected function updateCUList ( array $outcomes ) { |
|
150 | 150 | $this->getLogger()->info( 'Updating CU list.' ); |
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 ( $outcomes as $user => $confirmed ) { |
156 | 156 | $userReg = ( new User( $user ) )->getRegex(); |
157 | 157 | $reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!"; |
158 | 158 | if ( $confirmed ) { |
159 | 159 | $newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent ); |
160 | - $riconfNames[] = $user; |
|
160 | + $riconfNames[ ] = $user; |
|
161 | 161 | } else { |
162 | 162 | $newContent = preg_replace( $reg, '', $newContent ); |
163 | - $removeNames[] = $user; |
|
163 | + $removeNames[ ] = $user; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | * @param PageRiconferma[] $pages |
185 | 185 | * @return bool[] |
186 | 186 | */ |
187 | - private function getGroupOutcomes( string $group, array $pages ) : array { |
|
188 | - $ret = []; |
|
187 | + private function getGroupOutcomes ( string $group, array $pages ) : array { |
|
188 | + $ret = [ ]; |
|
189 | 189 | foreach ( $pages as $page ) { |
190 | 190 | $user = $page->getUser(); |
191 | 191 | if ( $user->inGroup( $group ) ) { |