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