Passed
Push — master ( 497244...3c4aed )
by Daimona
02:35
created
includes/Task/TaskBase.php 1 patch
Spacing   +7 added lines, -7 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\Task;
4 4
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  */
16 16
 abstract class TaskBase extends ContextSource {
17 17
 	/** @var string[] */
18
-	protected $errors = [];
18
+	protected $errors = [ ];
19 19
 	/** @var TaskDataProvider */
20 20
 	protected $dataProvider;
21 21
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param MessageProvider $mp
29 29
 	 * @param PageBotList $pbl
30 30
 	 */
31
-	final public function __construct(
31
+	final public function __construct (
32 32
 		LoggerInterface $logger,
33 33
 		WikiGroup $wikiGroup,
34 34
 		TaskDataProvider $dataProvider,
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @return \BotRiconferme\TaskHelper\TaskResult
46 46
 	 */
47
-	final public function run() : TaskResult {
47
+	final public function run () : TaskResult {
48 48
 		$class = ( new \ReflectionClass( $this ) )->getShortName();
49 49
 		$opName = $this->getOperationName();
50 50
 		$this->getLogger()->info( "Starting $opName $class" );
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return int One of the STATUS_* constants
77 77
 	 */
78
-	abstract protected function runInternal() : int;
78
+	abstract protected function runInternal () : int;
79 79
 
80 80
 	/**
81 81
 	 * How this operation should be called in logs
82 82
 	 *
83 83
 	 * @return string
84 84
 	 */
85
-	abstract public function getOperationName() : string;
85
+	abstract public function getOperationName () : string;
86 86
 
87 87
 	/**
88 88
 	 * @return TaskDataProvider
89 89
 	 */
90
-	protected function getDataProvider() : TaskDataProvider {
90
+	protected function getDataProvider () : TaskDataProvider {
91 91
 		return $this->dataProvider;
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.
includes/Bot.php 1 patch
Spacing   +11 added lines, -12 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
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 === 'task' ) {
63
-				$this->runInternal( TaskManager::MODE_TASK, $taskOpt['task'] );
63
+				$this->runInternal( TaskManager::MODE_TASK, $taskOpt[ 'task' ] );
64 64
 			} elseif ( $type === 'subtask' ) {
65
-				$this->runInternal( TaskManager::MODE_SUBTASK, $taskOpt['subtask'] );
65
+				$this->runInternal( TaskManager::MODE_SUBTASK, $taskOpt[ 'subtask' ] );
66 66
 			} else {
67 67
 				$this->runInternal();
68 68
 			}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param IFlushingAwareLogger $baseLogger
102 102
 	 */
103
-	private function createMainLogger( IFlushingAwareLogger $baseLogger ) : void {
103
+	private function createMainLogger ( IFlushingAwareLogger $baseLogger ) : void {
104 104
 		$mainWiki = $this->wikiGroup->getMainWiki();
105 105
 		$mp = $this->messageProvider;
106 106
 		$errTitle = $this->cli->getOpt( 'error-title' );
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * Create the Config
129 129
 	 */
130
-	private function initConfig() : void {
130
+	private function initConfig () : void {
131 131
 		$wiki = $this->wikiGroup->getMainWiki();
132 132
 		try {
133 133
 			$confValues = json_decode( $wiki->getPageContent( $this->cli->getOpt( 'config-title' ) ), true );
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $mode
145 145
 	 * @param string|null $name
146 146
 	 */
147
-	private function runInternal(
147
+	private function runInternal (
148 148
 		string $mode = TaskManager::MODE_COMPLETE,
149 149
 		string $name = null
150 150
 	) : void {
@@ -164,8 +164,7 @@  discard block
 block discarded – undo
164 164
 		$base = "Execution of $activity";
165 165
 		if ( $res->isOK() ) {
166 166
 			$msg = $res->getStatus() === TaskResult::STATUS_NOTHING ?
167
-				': nothing to do' :
168
-				' completed successfully';
167
+				': nothing to do' : ' completed successfully';
169 168
 			$this->mainLogger->info( $base . $msg );
170 169
 		} else {
171 170
 			$this->mainLogger->error( "$base failed.\n$res" );
Please login to merge, or discard this patch.