@@ -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 | |
@@ -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 | $users = $this->getDataProvider()->getUsersToProcess(); |
20 | 20 | |
21 | 21 | if ( !$users ) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param User $user |
36 | 36 | */ |
37 | - protected function processUser( User $user ) : void { |
|
37 | + protected function processUser ( User $user ) : void { |
|
38 | 38 | $this->getLogger()->info( "Processing user $user" ); |
39 | 39 | try { |
40 | 40 | $num = $this->getLastPageNum( $user ) + 1; |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @return int |
70 | 70 | * @throws TaskException |
71 | 71 | */ |
72 | - protected function getLastPageNum( User $user ) : int { |
|
72 | + protected function getLastPageNum ( User $user ) : int { |
|
73 | 73 | $this->getLogger()->info( "Retrieving previous pages for $user" ); |
74 | 74 | |
75 | - $unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[1]; |
|
75 | + $unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[ 1 ]; |
|
76 | 76 | |
77 | 77 | $prefixes = [ "$unprefixedTitle/$user/" ]; |
78 | 78 | foreach ( $user->getAliases() as $alias ) { |
79 | - $prefixes[] = "$unprefixedTitle/$alias/"; |
|
79 | + $prefixes[ ] = "$unprefixedTitle/$alias/"; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $params = [ |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | 'apprefix' => implode( '|', $prefixes ), |
87 | 87 | 'aplimit' => 'max' |
88 | 88 | ]; |
89 | - $foundPages = []; |
|
89 | + $foundPages = [ ]; |
|
90 | 90 | foreach ( $prefixes as $prefix ) { |
91 | - $params['apprefix'] = $prefix; |
|
91 | + $params[ 'apprefix' ] = $prefix; |
|
92 | 92 | $res = $this->getRequestFactory()->newFromParams( $params )->execute(); |
93 | 93 | $foundPages = array_merge( $foundPages, $res->query->allpages ); |
94 | 94 | } |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | * @param string $title |
115 | 115 | * @param User $user |
116 | 116 | */ |
117 | - protected function createPage( string $title, User $user ) : void { |
|
117 | + protected function createPage ( string $title, User $user ) : void { |
|
118 | 118 | $this->getLogger()->info( "Creating page $title" ); |
119 | 119 | $groups = $user->getGroupsWithDates(); |
120 | 120 | $textParams = [ |
121 | 121 | '$user' => $user->getName(), |
122 | - '$date' => $groups['sysop'], |
|
123 | - '$burocrate' => $groups['bureaucrat'] ?? '', |
|
124 | - '$checkuser' => $groups['checkuser'] ?? '' |
|
122 | + '$date' => $groups[ 'sysop' ], |
|
123 | + '$burocrate' => $groups[ 'bureaucrat' ] ?? '', |
|
124 | + '$checkuser' => $groups[ 'checkuser' ] ?? '' |
|
125 | 125 | ]; |
126 | 126 | |
127 | 127 | $params = [ |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param Page $basePage |
140 | 140 | * @param string $newText |
141 | 141 | */ |
142 | - protected function createBasePage( Page $basePage, string $newText ) : void { |
|
142 | + protected function createBasePage ( Page $basePage, string $newText ) : void { |
|
143 | 143 | $this->getLogger()->info( "Creating base page $basePage" ); |
144 | 144 | |
145 | 145 | $params = [ |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param Page $basePage |
156 | 156 | * @param string $newText |
157 | 157 | */ |
158 | - protected function updateBasePage( Page $basePage, string $newText ) : void { |
|
158 | + protected function updateBasePage ( Page $basePage, string $newText ) : void { |
|
159 | 159 | $this->getLogger()->info( "Updating base page $basePage" ); |
160 | 160 | |
161 | 161 | $params = [ |