@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @inheritDoc |
15 | 15 | */ |
16 | - public function runInternal() : int { |
|
16 | + public function runInternal () : int { |
|
17 | 17 | $failed = $this->getFailures(); |
18 | 18 | if ( $failed ) { |
19 | 19 | $this->updateBurList( $failed ); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return PageRiconferma[] |
32 | 32 | */ |
33 | - private function getFailures() : array { |
|
34 | - $ret = []; |
|
33 | + private function getFailures () : array { |
|
34 | + $ret = [ ]; |
|
35 | 35 | $allPages = $this->getDataProvider()->getPagesToClose(); |
36 | 36 | foreach ( $allPages as $page ) { |
37 | 37 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
38 | - $ret[] = $page; |
|
38 | + $ret[ ] = $page; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | return $ret; |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @param PageRiconferma[] $pages |
46 | 46 | */ |
47 | - protected function updateBurList( array $pages ) { |
|
47 | + protected function updateBurList ( array $pages ) { |
|
48 | 48 | $this->getLogger()->info( 'Checking if bur list needs updating.' ); |
49 | 49 | $admins = $this->getDataProvider()->getUsersList(); |
50 | 50 | |
51 | - $remove = []; |
|
51 | + $remove = [ ]; |
|
52 | 52 | foreach ( $pages as $page ) { |
53 | 53 | $user = $page->getUser(); |
54 | 54 | if ( array_key_exists( 'bureaucrat', $admins[ $user ] ) && |
55 | 55 | $page->getOutcome() & PageRiconferma::OUTCOME_FAIL |
56 | 56 | ) { |
57 | - $remove[] = $user; |
|
57 | + $remove[ ] = $user; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @param PageRiconferma[] $pages |
86 | 86 | */ |
87 | - protected function requestRemoval( array $pages ) { |
|
87 | + protected function requestRemoval ( array $pages ) { |
|
88 | 88 | $this->getLogger()->info( |
89 | 89 | 'Requesting removal on meta for: ' . implode( ', ', array_map( 'strval', $pages ) ) |
90 | 90 | ); |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param PageRiconferma[] $pages |
128 | 128 | */ |
129 | - protected function updateAnnunci( array $pages ) { |
|
129 | + protected function updateAnnunci ( array $pages ) { |
|
130 | 130 | $this->getLogger()->info( 'Updating annunci' ); |
131 | 131 | |
132 | - $names = []; |
|
132 | + $names = [ ]; |
|
133 | 133 | $text = ''; |
134 | 134 | foreach ( $pages as $page ) { |
135 | 135 | $user = $page->getUser(); |
136 | - $names[] = $user; |
|
136 | + $names[ ] = $user; |
|
137 | 137 | $text .= "{{Breve|admin|{{subst:#time:j}}|[[Utente:$user|]] " . |
138 | 138 | "non è stato riconfermato [[WP:A|amministratore]].}}\n"; |
139 | 139 | } |
@@ -167,16 +167,16 @@ discard block |
||
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-title' ) ); |
173 | 173 | |
174 | - $names = []; |
|
174 | + $names = [ ]; |
|
175 | 175 | $text = ''; |
176 | 176 | foreach ( $pages as $page ) { |
177 | 177 | $user = $page->getUser(); |
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: {{NUMBEROFADMINS}} - 1}}.'; |
182 | 182 | } |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @inheritDoc |
15 | 15 | */ |
16 | - public function runInternal() : int { |
|
16 | + public function runInternal () : int { |
|
17 | 17 | $users = $this->getDataProvider()->getUsersToProcess(); |
18 | 18 | |
19 | 19 | if ( !$users ) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $this->processUser( $user, $groups ); |
25 | 25 | } |
26 | 26 | |
27 | - return self::STATUS_GOOD ; |
|
27 | + return self::STATUS_GOOD; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $user |
34 | 34 | * @param array $groups |
35 | 35 | */ |
36 | - protected function processUser( string $user, array $groups ) { |
|
36 | + protected function processUser ( string $user, array $groups ) { |
|
37 | 37 | try { |
38 | 38 | $num = $this->getLastPageNum( $user ) + 1; |
39 | 39 | } catch ( TaskException $e ) { |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * @return int |
66 | 66 | * @throws TaskException |
67 | 67 | */ |
68 | - protected function getLastPageNum( string $user ) : int { |
|
68 | + protected function getLastPageNum ( string $user ) : int { |
|
69 | 69 | $this->getLogger()->debug( "Retrieving previous pages for $user" ); |
70 | - $unprefixedTitle = explode( ':', $this->getConfig()->get( 'ric-main-page' ), 2 )[1]; |
|
70 | + $unprefixedTitle = explode( ':', $this->getConfig()->get( 'ric-main-page' ), 2 )[ 1 ]; |
|
71 | 71 | $params = [ |
72 | 72 | 'action' => 'query', |
73 | 73 | 'list' => 'allpages', |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | * @param string $user |
103 | 103 | * @param array $groups |
104 | 104 | */ |
105 | - protected function createPage( string $title, string $user, array $groups ) { |
|
105 | + protected function createPage ( string $title, string $user, array $groups ) { |
|
106 | 106 | $this->getLogger()->info( "Creating page $title" ); |
107 | 107 | $text = $this->getConfig()->get( 'ric-page-text' ); |
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 | $text = strtr( $text, $textParams ); |
115 | 115 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $title |
129 | 129 | * @param string $newText |
130 | 130 | */ |
131 | - protected function createBasePage( string $title, string $newText ) { |
|
131 | + protected function createBasePage ( string $title, string $newText ) { |
|
132 | 132 | $this->getLogger()->info( "Creating base page $title" ); |
133 | 133 | |
134 | 134 | $params = [ |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param string $title |
146 | 146 | * @param string $newText |
147 | 147 | */ |
148 | - protected function updateBasePage( string $title, string $newText ) { |
|
148 | + protected function updateBasePage ( string $title, string $newText ) { |
|
149 | 149 | $this->getLogger()->info( "Updating base page $title" ); |
150 | 150 | |
151 | 151 | $params = [ |
@@ -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 | |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * @inheritDoc |
11 | 11 | */ |
12 | - public function runInternal() : int { |
|
12 | + public function runInternal () : int { |
|
13 | 13 | $pages = $this->getDataProvider()->getCreatedPages(); |
14 | 14 | $users = $this->getDataProvider()->getUsersToProcess(); |
15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | return self::STATUS_NOTHING; |
18 | 18 | } |
19 | 19 | |
20 | - $ricNums = []; |
|
20 | + $ricNums = [ ]; |
|
21 | 21 | foreach ( $pages as $page ) { |
22 | 22 | $ricNums[ $page->getUser() ] = $page->getNum(); |
23 | 23 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param string $user |
36 | 36 | * @param int $ricNum |
37 | 37 | */ |
38 | - protected function addMsg( string $user, int $ricNum ) { |
|
38 | + protected function addMsg ( string $user, int $ricNum ) { |
|
39 | 39 | $this->getLogger()->info( "Leaving msg to $user" ); |
40 | 40 | $msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text(); |
41 | 41 |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @inheritDoc |
15 | 15 | */ |
16 | - public function runInternal() : int { |
|
16 | + public function runInternal () : int { |
|
17 | 17 | $pages = $this->getDataProvider()->getPagesToClose(); |
18 | 18 | $this->updateVote( $pages ); |
19 | 19 | $this->updateNews( $pages ); |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | * @param PageRiconferma[] $pages |
28 | 28 | * @see UpdatesAround::addVote() |
29 | 29 | */ |
30 | - protected function updateVote( array $pages ) { |
|
30 | + protected function updateVote ( array $pages ) { |
|
31 | 31 | $this->getLogger()->info( |
32 | 32 | 'Updating votazioni: ' . implode( ', ', array_map( 'strval', $pages ) ) |
33 | 33 | ); |
34 | 34 | $votePage = new Page( $this->getConfig()->get( 'ric-vote-page' ) ); |
35 | 35 | |
36 | - $titles = []; |
|
36 | + $titles = [ ]; |
|
37 | 37 | foreach ( $pages as $page ) { |
38 | - $titles[] = preg_quote( $page->getTitle() ); |
|
38 | + $titles[ ] = preg_quote( $page->getTitle() ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $titleReg = implode( '|', $titles ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $pages |
65 | 65 | * @see UpdatesAround::addNews() |
66 | 66 | */ |
67 | - protected function updateNews( array $pages ) { |
|
67 | + protected function updateNews ( array $pages ) { |
|
68 | 68 | $simpleAmount = $voteAmount = 0; |
69 | 69 | foreach ( $pages as $page ) { |
70 | 70 | if ( $page->isVote() ) { |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $simpleMatches = $newsPage->getMatch( $simpleReg ); |
88 | 88 | $voteMatches = $newsPage->getMatch( $voteReg ); |
89 | 89 | |
90 | - $newSimp = (int)$simpleMatches[2] - $simpleAmount ?: ''; |
|
91 | - $newVote = (int)$voteMatches[2] - $voteAmount ?: ''; |
|
90 | + $newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: ''; |
|
91 | + $newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: ''; |
|
92 | 92 | $newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content ); |
93 | 93 | $newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent ); |
94 | 94 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param PageRiconferma[] $pages |
108 | 108 | */ |
109 | - protected function updateAdminList( array $pages ) { |
|
109 | + protected function updateAdminList ( array $pages ) { |
|
110 | 110 | $this->getLogger()->info( |
111 | 111 | 'Updating admin list: ' . implode( ', ', array_map( 'strval', $pages ) ) |
112 | 112 | ); |
@@ -114,17 +114,17 @@ discard block |
||
114 | 114 | $newContent = $adminsPage->getContent(); |
115 | 115 | $newDate = date( 'Ymd', strtotime( '+1 year' ) ); |
116 | 116 | |
117 | - $riconfNames = $removeNames = []; |
|
117 | + $riconfNames = $removeNames = [ ]; |
|
118 | 118 | foreach ( $pages as $page ) { |
119 | 119 | $user = $page->getUser(); |
120 | 120 | $reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!"; |
121 | 121 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
122 | 122 | // Remove the line |
123 | 123 | $newContent = preg_replace( $reg, '', $newContent ); |
124 | - $removeNames[] = $user; |
|
124 | + $removeNames[ ] = $user; |
|
125 | 125 | } else { |
126 | 126 | $newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent ); |
127 | - $riconfNames[] = $user; |
|
127 | + $riconfNames[ ] = $user; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | /** |
145 | 145 | * @param PageRiconferma[] $pages |
146 | 146 | */ |
147 | - protected function updateCUList( array $pages ) { |
|
147 | + protected function updateCUList ( array $pages ) { |
|
148 | 148 | $this->getLogger()->info( 'Checking if CU list needs updating.' ); |
149 | 149 | $cuList = new Page( $this->getConfig()->get( 'cu-list-title' ) ); |
150 | 150 | $admins = $this->getDataProvider()->getUsersList(); |
151 | 151 | $newContent = $cuList->getContent(); |
152 | 152 | |
153 | - $riconfNames = $removeNames = []; |
|
153 | + $riconfNames = $removeNames = [ ]; |
|
154 | 154 | foreach ( $pages as $page ) { |
155 | 155 | $user = $page->getUser(); |
156 | 156 | if ( array_key_exists( 'checkuser', $admins[ $user ] ) ) { |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
159 | 159 | // Remove the line |
160 | 160 | $newContent = preg_replace( $reg, '', $newContent ); |
161 | - $removeNames[] = $user; |
|
161 | + $removeNames[ ] = $user; |
|
162 | 162 | } else { |
163 | 163 | $newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent ); |
164 | - $riconfNames[] = $user; |
|
164 | + $riconfNames[ ] = $user; |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -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 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @inheritDoc |
16 | 16 | */ |
17 | - public function runInternal() : int { |
|
17 | + public function runInternal () : int { |
|
18 | 18 | $pages = $this->getDataProvider()->getCreatedPages(); |
19 | 19 | |
20 | 20 | if ( !$pages ) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param PageRiconferma[] $pages |
38 | 38 | */ |
39 | - protected function addToMainPage( array $pages ) { |
|
39 | + protected function addToMainPage ( array $pages ) { |
|
40 | 40 | $this->getLogger()->info( |
41 | 41 | 'Adding the following to main: ' . implode( ', ', array_map( 'strval', $pages ) ) |
42 | 42 | ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @param PageRiconferma[] $pages |
65 | 65 | */ |
66 | - protected function addVote( array $pages ) { |
|
66 | + protected function addVote ( array $pages ) { |
|
67 | 67 | $this->getLogger()->info( |
68 | 68 | 'Adding the following to votes: ' . implode( ', ', array_map( 'strval', $pages ) ) |
69 | 69 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m'; |
93 | 93 | // Replace semicolon with full stop |
94 | 94 | $newLines = substr( $newLines, 0, -2 ) . ".\n"; |
95 | - $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $content, 1 ); |
|
95 | + $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $content, 1 ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $summary = $this->msg( 'ric-vote-page-summary' ) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param int $amount |
113 | 113 | */ |
114 | - protected function addNews( int $amount ) { |
|
114 | + protected function addNews ( int $amount ) { |
|
115 | 115 | $this->getLogger()->info( "Increasing the news counter by $amount" ); |
116 | 116 | $newsPage = new Page( $this->getConfig()->get( 'ric-news-page' ) ); |
117 | 117 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | throw new TaskException( 'Param not found in news page' ); |
125 | 125 | } |
126 | 126 | |
127 | - $newNum = (int)$matches[2] + $amount; |
|
127 | + $newNum = (int)$matches[ 2 ] + $amount; |
|
128 | 128 | $newContent = preg_replace( $reg, '${1}' . $newNum, $content ); |
129 | 129 | |
130 | 130 | $summary = $this->msg( 'ric-news-page-summary' ) |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @inheritDoc |
15 | 15 | */ |
16 | - public function runInternal() : int { |
|
16 | + public function runInternal () : int { |
|
17 | 17 | $pages = $this->getDataProvider()->getPagesToClose(); |
18 | 18 | $protectReason = $this->getConfig()->get( 'close-protect-summary' ); |
19 | 19 | foreach ( $pages as $page ) { |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | $this->updateBasePage( $page ); |
25 | 25 | } |
26 | 26 | |
27 | - return self::STATUS_GOOD ; |
|
27 | + return self::STATUS_GOOD; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param PageRiconferma $page |
32 | 32 | */ |
33 | - protected function addVoteCloseText( PageRiconferma $page ) { |
|
33 | + protected function addVoteCloseText ( PageRiconferma $page ) { |
|
34 | 34 | $content = $page->getContent(); |
35 | 35 | $beforeReg = '!è necessario ottenere una maggioranza .+ votanti\.!'; |
36 | 36 | $newContent = preg_replace( $beforeReg, '$0' . "\n" . $page->getOutcomeText(), $content ); |
@@ -45,15 +45,14 @@ discard block |
||
45 | 45 | * @param PageRiconferma $page |
46 | 46 | * @see CreatePages::updateBasePage() |
47 | 47 | */ |
48 | - protected function updateBasePage( PageRiconferma $page ) { |
|
48 | + protected function updateBasePage ( PageRiconferma $page ) { |
|
49 | 49 | $this->getLogger()->info( "Updating base page for $page" ); |
50 | 50 | |
51 | 51 | $basePage = new Page( $page->getBaseTitle() ); |
52 | 52 | $current = $basePage->getContent(); |
53 | 53 | |
54 | 54 | $outcomeText = $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ? |
55 | - 'non riconfermato' : |
|
56 | - 'riconfermato'; |
|
55 | + 'non riconfermato' : 'riconfermato'; |
|
57 | 56 | $text = $page->isVote() ? "votazione: $outcomeText" : 'riconferma tacita'; |
58 | 57 | |
59 | 58 | $newContent = str_replace( 'riconferma in corso', $text, $current ); |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @inheritDoc |
15 | 15 | */ |
16 | - public function runInternal() : int { |
|
16 | + public function runInternal () : int { |
|
17 | 17 | $pages = $this->getDataProvider()->getPagesToClose(); |
18 | 18 | $this->removeFromMainPage( $pages ); |
19 | 19 | $this->addToArchive( $pages ); |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | * @param PageRiconferma[] $pages |
28 | 28 | * @see UpdatesAround::addToMainPage() |
29 | 29 | */ |
30 | - protected function removeFromMainPage( array $pages ) { |
|
30 | + protected function removeFromMainPage ( array $pages ) { |
|
31 | 31 | $this->getLogger()->info( |
32 | 32 | 'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) ) |
33 | 33 | ); |
34 | 34 | |
35 | 35 | $mainPage = new Page( $this->getConfig()->get( 'ric-main-page' ) ); |
36 | - $remove = []; |
|
36 | + $remove = [ ]; |
|
37 | 37 | foreach ( $pages as $page ) { |
38 | - $remove[] = '{{' . $page->getTitle() . '}}'; |
|
38 | + $remove[ ] = '{{' . $page->getTitle() . '}}'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $mainPage->edit( [ |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @param PageRiconferma[] $pages |
51 | 51 | */ |
52 | - protected function addToArchive( array $pages ) { |
|
52 | + protected function addToArchive ( array $pages ) { |
|
53 | 53 | $this->getLogger()->info( |
54 | 54 | 'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) ) |
55 | 55 | ); |
56 | 56 | |
57 | - $simple = $votes = []; |
|
57 | + $simple = $votes = [ ]; |
|
58 | 58 | foreach ( $pages as $page ) { |
59 | 59 | if ( $page->isVote() ) { |
60 | - $votes[] = $page; |
|
60 | + $votes[ ] = $page; |
|
61 | 61 | } else { |
62 | - $simple[] = $page; |
|
62 | + $simple[ ] = $page; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | * @param string $archiveTitle |
77 | 77 | * @param array $pages |
78 | 78 | */ |
79 | - private function reallyAddToArchive( string $archiveTitle, array $pages ) { |
|
79 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ) { |
|
80 | 80 | $archivePage = new Page( "$archiveTitle/" . date( 'Y' ) ); |
81 | 81 | |
82 | 82 | $append = ''; |
83 | - $archivedList = []; |
|
83 | + $archivedList = [ ]; |
|
84 | 84 | foreach ( $pages as $page ) { |
85 | 85 | $append .= '{{' . $page->getTitle() . "}}\n"; |
86 | - $archivedList[] = $page->getUserNum(); |
|
86 | + $archivedList[ ] = $page->getUserNum(); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $summary = $this->msg( 'close-archive-summary' ) |
@@ -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; |
4 | 4 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @inheritDoc |
17 | 17 | */ |
18 | - public function runInternal() : int { |
|
18 | + public function runInternal () : int { |
|
19 | 19 | $orderedList = [ |
20 | 20 | 'close-pages', |
21 | 21 | 'archive-pages', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @inheritDoc |
36 | 36 | */ |
37 | - protected function getSubtasksMap(): array { |
|
37 | + protected function getSubtasksMap (): array { |
|
38 | 38 | return [ |
39 | 39 | 'archive-pages' => ArchivePages::class, |
40 | 40 | 'close-pages' => ClosePages::class, |
@@ -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; |
4 | 4 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | const STATUS_NOTHING = 1; |
16 | 16 | const STATUS_ERROR = 2; |
17 | 17 | /** @var string[] */ |
18 | - protected $errors = []; |
|
18 | + protected $errors = [ ]; |
|
19 | 19 | /** @var TaskDataProvider */ |
20 | 20 | protected $dataProvider; |
21 | 21 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param TaskDataProvider $dataProvider |
26 | 26 | */ |
27 | - final public function __construct( TaskDataProvider $dataProvider ) { |
|
27 | + final public function __construct ( TaskDataProvider $dataProvider ) { |
|
28 | 28 | set_exception_handler( [ $this, 'handleException' ] ); |
29 | 29 | set_error_handler( [ $this, 'handleError' ] ); |
30 | 30 | parent::__construct(); |
31 | 31 | $this->dataProvider = $dataProvider; |
32 | 32 | } |
33 | 33 | |
34 | - public function __destruct() { |
|
34 | + public function __destruct () { |
|
35 | 35 | restore_error_handler(); |
36 | 36 | restore_exception_handler(); |
37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return TaskResult |
43 | 43 | */ |
44 | - final public function run() : TaskResult { |
|
44 | + final public function run () : TaskResult { |
|
45 | 45 | $task = static::class; |
46 | 46 | $this->getLogger()->info( "Starting task $task" ); |
47 | 47 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return int One of the STATUS_* constants |
73 | 73 | */ |
74 | - abstract protected function runInternal() : int; |
|
74 | + abstract protected function runInternal () : int; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Exception handler. |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param \Throwable $ex |
80 | 80 | * @protected |
81 | 81 | */ |
82 | - public function handleException( \Throwable $ex ) { |
|
82 | + public function handleException ( \Throwable $ex ) { |
|
83 | 83 | $this->getLogger()->error( |
84 | 84 | get_class( $ex ) . ': ' . |
85 | 85 | $ex->getMessage() . "\nTrace:\n" . |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * @param int $errline |
97 | 97 | * @protected |
98 | 98 | */ |
99 | - public function handleError( $errno, $errstr, $errfile, $errline ) { |
|
99 | + public function handleError ( $errno, $errstr, $errfile, $errline ) { |
|
100 | 100 | throw new \ErrorException( $errstr, 0, $errno, $errfile, $errline ); |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | 104 | * @return TaskDataProvider |
105 | 105 | */ |
106 | - protected function getDataProvider() : TaskDataProvider { |
|
106 | + protected function getDataProvider () : TaskDataProvider { |
|
107 | 107 | return $this->dataProvider; |
108 | 108 | } |
109 | 109 | } |