@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme; |
4 | 4 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @param CLI $cli |
35 | 35 | */ |
36 | - public function __construct( CLI $cli ) { |
|
36 | + public function __construct ( CLI $cli ) { |
|
37 | 37 | $this->cli = $cli; |
38 | 38 | $this->initialize(); |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Initialize all members. |
43 | 43 | */ |
44 | - private function initialize() : void { |
|
44 | + private function initialize () : void { |
|
45 | 45 | $simpleLogger = new SimpleLogger(); |
46 | 46 | $this->createWikiGroup( $simpleLogger ); |
47 | 47 | $this->messageProvider = new MessageProvider( |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Main entry point |
57 | 57 | */ |
58 | - public function run() : void { |
|
58 | + public function run () : void { |
|
59 | 59 | $taskOpt = $this->cli->getTaskOpt(); |
60 | 60 | $type = current( array_keys( $taskOpt ) ); |
61 | 61 | try { |
62 | 62 | if ( $type === 'tasks' ) { |
63 | - $this->runInternal( TaskManager::MODE_TASK, explode( ',', $taskOpt['tasks'] ) ); |
|
63 | + $this->runInternal( TaskManager::MODE_TASK, explode( ',', $taskOpt[ 'tasks' ] ) ); |
|
64 | 64 | } elseif ( $type === 'subtasks' ) { |
65 | - $this->runInternal( TaskManager::MODE_SUBTASK, explode( ',', $taskOpt['subtasks'] ) ); |
|
65 | + $this->runInternal( TaskManager::MODE_SUBTASK, explode( ',', $taskOpt[ 'subtasks' ] ) ); |
|
66 | 66 | } else { |
67 | 67 | $this->runInternal(); |
68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * @param LoggerInterface $baseLogger |
78 | 78 | */ |
79 | - private function createWikiGroup( LoggerInterface $baseLogger ) : void { |
|
79 | + private function createWikiGroup ( LoggerInterface $baseLogger ) : void { |
|
80 | 80 | // FIXME Hardcoded |
81 | 81 | $url = $this->cli->getURL() ?? 'https://it.wikipedia.org/w/api.php'; |
82 | 82 | $localUserIdentifier = '@itwiki'; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param IFlushingAwareLogger $baseLogger |
116 | 116 | */ |
117 | - private function createMainLogger( IFlushingAwareLogger $baseLogger ) : void { |
|
117 | + private function createMainLogger ( IFlushingAwareLogger $baseLogger ) : void { |
|
118 | 118 | $mainWiki = $this->wikiGroup->getMainWiki(); |
119 | 119 | $mp = $this->messageProvider; |
120 | 120 | $errTitle = $this->cli->getOpt( 'error-title' ); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * Create the Config |
143 | 143 | */ |
144 | - private function initConfig() : void { |
|
144 | + private function initConfig () : void { |
|
145 | 145 | $wiki = $this->wikiGroup->getMainWiki(); |
146 | 146 | try { |
147 | 147 | $confValues = json_decode( $wiki->getPageContent( $this->cli->getOpt( 'config-title' ) ), true ); |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param string $mode |
159 | 159 | * @param string[] $taskNames |
160 | 160 | */ |
161 | - private function runInternal( |
|
161 | + private function runInternal ( |
|
162 | 162 | string $mode = TaskManager::MODE_COMPLETE, |
163 | - array $taskNames = [] |
|
163 | + array $taskNames = [ ] |
|
164 | 164 | ) : void { |
165 | 165 | $activity = $mode === TaskManager::MODE_COMPLETE |
166 | 166 | ? 'full process' |
@@ -180,8 +180,7 @@ discard block |
||
180 | 180 | $base = "Execution of $activity"; |
181 | 181 | if ( $res->isOK() ) { |
182 | 182 | $msg = $res->getStatus() === TaskResult::STATUS_NOTHING ? |
183 | - ': nothing to do' : |
|
184 | - ' completed successfully'; |
|
183 | + ': nothing to do' : ' completed successfully'; |
|
185 | 184 | $this->mainLogger->info( $base . $msg ); |
186 | 185 | } else { |
187 | 186 | $this->mainLogger->error( "$base failed.\n$res" ); |