@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @inheritDoc |
13 | 13 | */ |
14 | - final public function getOperationName(): string { |
|
14 | + final public function getOperationName (): string { |
|
15 | 15 | return 'subtask'; |
16 | 16 | } |
17 | 17 | } |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @inheritDoc |
13 | 13 | */ |
14 | - public function runInternal() : int { |
|
14 | + public function runInternal () : int { |
|
15 | 15 | $pages = $this->getDataProvider()->getCreatedPages(); |
16 | 16 | $users = $this->getDataProvider()->getUsersToProcess(); |
17 | 17 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | return TaskResult::STATUS_NOTHING; |
20 | 20 | } |
21 | 21 | |
22 | - $ricNums = []; |
|
22 | + $ricNums = [ ]; |
|
23 | 23 | foreach ( $pages as $page ) { |
24 | 24 | $ricNums[ $page->getUser()->getName() ] = $page->getNum(); |
25 | 25 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param string $user |
38 | 38 | * @param int $ricNum |
39 | 39 | */ |
40 | - protected function addMsg( string $user, int $ricNum ) { |
|
40 | + protected function addMsg ( string $user, int $ricNum ) { |
|
41 | 41 | $this->getLogger()->info( "Leaving msg to $user" ); |
42 | 42 | $msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text(); |
43 | 43 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Exception; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Request; |
4 | 4 | |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | /** @var string */ |
31 | 31 | protected $method = 'GET'; |
32 | 32 | /** @var string[] */ |
33 | - protected $newCookies = []; |
|
33 | + protected $newCookies = [ ]; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Use self::newFromParams, which will provide the right class to use |
37 | 37 | * |
38 | 38 | * @param array $params |
39 | 39 | */ |
40 | - protected function __construct( array $params ) { |
|
40 | + protected function __construct ( array $params ) { |
|
41 | 41 | $this->params = [ 'format' => 'json' ] + $params; |
42 | 42 | $this->url = DEFAULT_URL; |
43 | 43 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param array $params |
49 | 49 | * @return self |
50 | 50 | */ |
51 | - public static function newFromParams( array $params ) : self { |
|
51 | + public static function newFromParams ( array $params ) : self { |
|
52 | 52 | if ( extension_loaded( 'curl' ) ) { |
53 | 53 | $ret = new CurlRequest( $params ); |
54 | 54 | } else { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return self For chaining |
64 | 64 | */ |
65 | - public function setPost() : self { |
|
65 | + public function setPost () : self { |
|
66 | 66 | $this->method = 'POST'; |
67 | 67 | return $this; |
68 | 68 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string $url |
74 | 74 | * @return self for chaining |
75 | 75 | */ |
76 | - public function setUrl( string $url ) : self { |
|
76 | + public function setUrl ( string $url ) : self { |
|
77 | 77 | $this->url = $url; |
78 | 78 | return $this; |
79 | 79 | } |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return \stdClass |
85 | 85 | */ |
86 | - public function execute() : \stdClass { |
|
86 | + public function execute () : \stdClass { |
|
87 | 87 | $curParams = $this->params; |
88 | - $sets = []; |
|
88 | + $sets = [ ]; |
|
89 | 89 | do { |
90 | 90 | $res = $this->makeRequestInternal( $curParams ); |
91 | 91 | |
92 | 92 | $this->handleErrorAndWarnings( $res ); |
93 | - $sets[] = $res; |
|
93 | + $sets[ ] = $res; |
|
94 | 94 | |
95 | 95 | $finished = true; |
96 | 96 | if ( isset( $res->continue ) ) { |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * @param array $params |
109 | 109 | * @return \stdClass |
110 | 110 | */ |
111 | - private function makeRequestInternal( array $params ) : \stdClass { |
|
111 | + private function makeRequestInternal ( array $params ) : \stdClass { |
|
112 | 112 | if ( $this->method === 'POST' ) { |
113 | - $params['maxlag'] = self::MAXLAG; |
|
113 | + $params[ 'maxlag' ] = self::MAXLAG; |
|
114 | 114 | } |
115 | 115 | $params = http_build_query( $params ); |
116 | 116 | |
@@ -126,17 +126,17 @@ discard block |
||
126 | 126 | * @param string $params |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - abstract protected function reallyMakeRequest( string $params ) : string; |
|
129 | + abstract protected function reallyMakeRequest ( string $params ) : string; |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * After a request, set cookies for the next ones |
133 | 133 | * |
134 | 134 | * @param array $cookies |
135 | 135 | */ |
136 | - protected function setCookies( array $cookies ) { |
|
136 | + protected function setCookies ( array $cookies ) { |
|
137 | 137 | foreach ( $cookies as $cookie ) { |
138 | 138 | $bits = explode( ';', $cookie ); |
139 | - list( $name, $value ) = explode( '=', $bits[0] ); |
|
139 | + list( $name, $value ) = explode( '=', $bits[ 0 ] ); |
|
140 | 140 | self::$cookiesToSet[ $name ] = $value; |
141 | 141 | } |
142 | 142 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param \stdClass $res |
148 | 148 | * @return APIRequestException |
149 | 149 | */ |
150 | - private function getException( \stdClass $res ) : APIRequestException { |
|
150 | + private function getException ( \stdClass $res ) : APIRequestException { |
|
151 | 151 | switch ( $res->error->code ) { |
152 | 152 | case 'missingtitle': |
153 | 153 | $ex = new MissingPageException; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param \stdClass $res |
171 | 171 | * @throws APIRequestException |
172 | 172 | */ |
173 | - protected function handleErrorAndWarnings( \stdClass $res ) { |
|
173 | + protected function handleErrorAndWarnings ( \stdClass $res ) { |
|
174 | 174 | if ( isset( $res->error ) ) { |
175 | 175 | throw $this->getException( $res ); |
176 | 176 | } elseif ( isset( $res->warnings ) ) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param \stdClass[] $sets |
187 | 187 | * @return \stdClass |
188 | 188 | */ |
189 | - private function mergeSets( array $sets ) : \stdClass { |
|
189 | + private function mergeSets ( array $sets ) : \stdClass { |
|
190 | 190 | // Use the first set as template |
191 | 191 | $ret = array_shift( $sets ); |
192 | 192 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param array|\stdClass $second |
204 | 204 | * @return array|\stdClass array |
205 | 205 | */ |
206 | - private function recursiveMerge( $first, $second ) { |
|
206 | + private function recursiveMerge ( $first, $second ) { |
|
207 | 207 | $ret = $first; |
208 | 208 | if ( is_array( $second ) ) { |
209 | 209 | $ret = is_array( $first ) ? array_merge_recursive( $first, $second ) : $second; |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return array |
223 | 223 | */ |
224 | - protected function getHeaders() :array { |
|
224 | + protected function getHeaders () :array { |
|
225 | 225 | $ret = self::HEADERS; |
226 | 226 | if ( self::$cookiesToSet ) { |
227 | - $cookies = []; |
|
227 | + $cookies = [ ]; |
|
228 | 228 | foreach ( self::$cookiesToSet as $cname => $cval ) { |
229 | - $cookies[] = trim( "$cname=$cval" ); |
|
229 | + $cookies[ ] = trim( "$cname=$cval" ); |
|
230 | 230 | } |
231 | - $ret[] = 'Cookie: ' . implode( '; ', $cookies ); |
|
231 | + $ret[ ] = 'Cookie: ' . implode( '; ', $cookies ); |
|
232 | 232 | } |
233 | 233 | return $ret; |
234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param array $headers |
240 | 240 | * @return string |
241 | 241 | */ |
242 | - protected function buildHeadersString( array $headers ) : string { |
|
242 | + protected function buildHeadersString ( array $headers ) : string { |
|
243 | 243 | $ret = ''; |
244 | 244 | foreach ( $headers as $header ) { |
245 | 245 | $ret .= "$header\r\n"; |
@@ -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 | $users = $this->getDataProvider()->getUsersToProcess(); |
19 | 19 | |
20 | 20 | if ( !$users ) { |
@@ -34,7 +34,7 @@ discard block |
||
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 |
||
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->getOpt( 'main-page-title' ), 2 )[1]; |
|
71 | + $unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[ 1 ]; |
|
72 | 72 | $params = [ |
73 | 73 | 'action' => 'query', |
74 | 74 | 'list' => 'allpages', |
@@ -103,13 +103,13 @@ discard block |
||
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 |
||
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 |
||
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 = [ |
@@ -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 | |
@@ -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 | $orderedList = [ |
19 | 19 | 'create-pages', |
20 | 20 | 'open-updates', |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @inheritDoc |
34 | 34 | */ |
35 | - protected function getSubtasksMap() : array { |
|
35 | + protected function getSubtasksMap () : array { |
|
36 | 36 | return [ |
37 | 37 | 'create-pages' => CreatePages::class, |
38 | 38 | 'open-updates' => OpenUpdates::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\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 | |
19 | 19 | if ( !$pages ) { |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * @param PageRiconferma[] $pages |
33 | 33 | * @see OpenUpdates::addToMainPage() |
34 | 34 | */ |
35 | - protected function removeFromMainPage( array $pages ) { |
|
35 | + protected function removeFromMainPage ( array $pages ) { |
|
36 | 36 | $this->getLogger()->info( |
37 | 37 | 'Removing from main: ' . implode( ', ', $pages ) |
38 | 38 | ); |
39 | 39 | |
40 | 40 | $mainPage = $this->getPage( $this->getOpt( 'main-page-title' ) ); |
41 | - $remove = []; |
|
41 | + $remove = [ ]; |
|
42 | 42 | foreach ( $pages as $page ) { |
43 | 43 | // Order matters here. It's not guaranteed that there'll be a newline, but avoid |
44 | 44 | // regexps for that single character. |
45 | - $remove[] = '{{' . $page->getTitle() . "}}\n"; |
|
46 | - $remove[] = '{{' . $page->getTitle() . '}}'; |
|
45 | + $remove[ ] = '{{' . $page->getTitle() . "}}\n"; |
|
46 | + $remove[ ] = '{{' . $page->getTitle() . '}}'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $newContent = str_replace( $remove, '', $mainPage->getContent() ); |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param PageRiconferma[] $pages |
74 | 74 | */ |
75 | - protected function addToArchive( array $pages ) { |
|
75 | + protected function addToArchive ( array $pages ) { |
|
76 | 76 | $this->getLogger()->info( |
77 | 77 | 'Adding to archive: ' . implode( ', ', $pages ) |
78 | 78 | ); |
79 | 79 | |
80 | - $simple = $votes = []; |
|
80 | + $simple = $votes = [ ]; |
|
81 | 81 | foreach ( $pages as $page ) { |
82 | 82 | if ( $page->isVote() ) { |
83 | - $votes[] = $page; |
|
83 | + $votes[ ] = $page; |
|
84 | 84 | } else { |
85 | - $simple[] = $page; |
|
85 | + $simple[ ] = $page; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | * @param string $archiveTitle |
104 | 104 | * @param array $pages |
105 | 105 | */ |
106 | - private function reallyAddToArchive( string $archiveTitle, array $pages ) { |
|
106 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ) { |
|
107 | 107 | $archivePage = $this->getPage( "$archiveTitle/" . date( 'Y' ) ); |
108 | 108 | $exists = $archivePage->exists(); |
109 | 109 | |
110 | 110 | $append = "\n"; |
111 | - $archivedList = []; |
|
111 | + $archivedList = [ ]; |
|
112 | 112 | foreach ( $pages as $page ) { |
113 | 113 | $append .= '{{' . $page->getTitle() . "}}\n"; |
114 | - $archivedList[] = $page->getUserNum(); |
|
114 | + $archivedList[ ] = $page->getUserNum(); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $summary = $this->msg( 'close-archive-summary' ) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @param string $archiveTitle |
134 | 134 | */ |
135 | - private function addArchiveYear( string $archiveTitle ) { |
|
135 | + private function addArchiveYear ( string $archiveTitle ) { |
|
136 | 136 | $page = $this->getPage( $archiveTitle ); |
137 | 137 | $year = date( 'Y' ); |
138 | 138 |
@@ -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 | |
19 | 19 | if ( !$pages ) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @param PageRiconferma $page |
37 | 37 | */ |
38 | - protected function addVoteCloseText( PageRiconferma $page ) { |
|
38 | + protected function addVoteCloseText ( PageRiconferma $page ) { |
|
39 | 39 | $content = $page->getContent(); |
40 | 40 | $beforeReg = '!è necessario ottenere una maggioranza .+ votanti\.!'; |
41 | 41 | $newContent = preg_replace( $beforeReg, '$0' . "\n" . $page->getOutcomeText(), $content ); |
@@ -50,15 +50,14 @@ discard block |
||
50 | 50 | * @param PageRiconferma $page |
51 | 51 | * @see CreatePages::updateBasePage() |
52 | 52 | */ |
53 | - protected function updateBasePage( PageRiconferma $page ) { |
|
53 | + protected function updateBasePage ( PageRiconferma $page ) { |
|
54 | 54 | $this->getLogger()->info( "Updating base page for $page" ); |
55 | 55 | |
56 | 56 | $basePage = $this->getPage( $page->getBaseTitle() ); |
57 | 57 | $current = $basePage->getContent(); |
58 | 58 | |
59 | 59 | $outcomeText = $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ? |
60 | - 'non riconfermato' : |
|
61 | - 'riconfermato'; |
|
60 | + 'non riconfermato' : 'riconfermato'; |
|
62 | 61 | $text = $page->isVote() ? "votazione: $outcomeText" : 'riconferma tacita'; |
63 | 62 | |
64 | 63 | $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; |
4 | 4 | |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @inheritDoc |
16 | 16 | */ |
17 | - protected function getSubtasksMap(): array { |
|
17 | + protected function getSubtasksMap (): array { |
|
18 | 18 | // Everything is done here. |
19 | - return []; |
|
19 | + return [ ]; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @inheritDoc |
24 | 24 | */ |
25 | - public function runInternal() : int { |
|
25 | + public function runInternal () : int { |
|
26 | 26 | $pages = $this->getDataProvider()->getOpenPages(); |
27 | 27 | |
28 | 28 | if ( !$pages ) { |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @param PageRiconferma[] $pages |
37 | 37 | * @return int a STATUS_* constant |
38 | 38 | */ |
39 | - protected function processPages( array $pages ) : int { |
|
40 | - $donePages = []; |
|
39 | + protected function processPages ( array $pages ) : int { |
|
40 | + $donePages = [ ]; |
|
41 | 41 | foreach ( $pages as $page ) { |
42 | 42 | if ( $page->hasOpposition() && !$page->isVote() ) { |
43 | 43 | $this->openVote( $page ); |
44 | - $donePages[] = $page; |
|
44 | + $donePages[ ] = $page; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @param PageRiconferma $page |
61 | 61 | */ |
62 | - protected function openVote( PageRiconferma $page ) { |
|
62 | + protected function openVote ( PageRiconferma $page ) { |
|
63 | 63 | $this->getLogger()->info( "Starting vote on $page" ); |
64 | 64 | |
65 | 65 | $content = $page->getContent(); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * @see SimpleUpdates::updateVotazioni() |
99 | 99 | * @see OpenUpdates::addToVotazioni() |
100 | 100 | */ |
101 | - protected function updateVotazioni( array $pages ) { |
|
101 | + protected function updateVotazioni ( array $pages ) { |
|
102 | 102 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
103 | 103 | |
104 | - $users = []; |
|
104 | + $users = [ ]; |
|
105 | 105 | foreach ( $pages as $page ) { |
106 | - $users[] = $page->getUser(); |
|
106 | + $users[ ] = $page->getUser(); |
|
107 | 107 | } |
108 | 108 | $usersReg = Element::regexFromArray( $users ); |
109 | 109 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @see SimpleUpdates::updateNews() |
142 | 142 | * @see OpenUpdates::addToNews() |
143 | 143 | */ |
144 | - protected function updateNews( int $amount ) { |
|
144 | + protected function updateNews ( int $amount ) { |
|
145 | 145 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
146 | 146 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
147 | 147 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | throw new TaskException( 'Param "voto" not found in news page' ); |
157 | 157 | } |
158 | 158 | |
159 | - $newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: ''; |
|
160 | - $newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: ''; |
|
159 | + $newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: ''; |
|
160 | + $newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: ''; |
|
161 | 161 | |
162 | 162 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
163 | 163 | $newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent ); |