Passed
Push — master ( f946ea...c739e9 )
by Daimona
02:07
created
run.php 1 patch
Spacing   +6 added lines, -6 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
  * Entry point for the bot, called by CLI
4 4
  */
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 /* URL (for debugging purpose) */
41 41
 $urlParam = getopt( '', [ 'force-url:' ] );
42
-$url = $urlParam['force-url'] ?? 'https://it.wikipedia.org/w/api.php';
42
+$url = $urlParam[ 'force-url' ] ?? 'https://it.wikipedia.org/w/api.php';
43 43
 
44 44
 define( 'DEFAULT_URL', $url );
45 45
 define( 'META_URL', 'https://meta.wikimedia.org/w/api.php' );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 /* START */
77 77
 
78 78
 $errParam = getopt( '', [ 'error-title::' ] );
79
-$errTitle = $errParam['error-title'] ?? null;
79
+$errTitle = $errParam[ 'error-title' ] ?? null;
80 80
 
81 81
 $simpleLogger = new \BotRiconferme\Logger\SimpleLogger();
82 82
 // @fixme
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 if ( $errTitle !== null ) {
87 87
 	$errPage = new \BotRiconferme\Wiki\Page\Page( $errTitle, $wiki );
88
-	$wikiLogger = new \BotRiconferme\Logger\WikiLogger( $errPage, \Psr\Log\LogLevel::ERROR );// Fixme this will log the login
88
+	$wikiLogger = new \BotRiconferme\Logger\WikiLogger( $errPage, \Psr\Log\LogLevel::ERROR ); // Fixme this will log the login
89 89
 	$mainLogger = new \BotRiconferme\Logger\MultiLogger( $simpleLogger, $wikiLogger );
90 90
 } else {
91 91
 	$mainLogger = $simpleLogger;
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 
105 105
 if ( count( $taskOpts ) === 2 ) {
106 106
 	throw new InvalidArgumentException( 'Cannot specify both task and subtask.' );
107
-} elseif ( isset( $taskOpts['task'] ) ) {
107
+} elseif ( isset( $taskOpts[ 'task' ] ) ) {
108 108
 	$bot->runTask( $taskOpts[ 'task' ] );
109
-} elseif ( isset( $taskOpts['subtask'] ) ) {
109
+} elseif ( isset( $taskOpts[ 'subtask' ] ) ) {
110 110
 	$bot->runSubtask( $taskOpts[ 'subtask' ] );
111 111
 } else {
112 112
 	$bot->runAll();
Please login to merge, or discard this patch.
includes/Logger/SimpleLogger.php 1 patch
Spacing   +3 added lines, -3 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\Logger;
4 4
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @param string $minlevel
19 19
 	 */
20
-	public function __construct( $minlevel = LogLevel::INFO ) {
20
+	public function __construct ( $minlevel = LogLevel::INFO ) {
21 21
 		$this->minLevel = $this->levelToInt( $minlevel );
22 22
 	}
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @inheritDoc
26 26
 	 * @suppress PhanUnusedPublicMethodParameter
27 27
 	 */
28
-	public function log( $level, $message, array $context = [] ) {
28
+	public function log ( $level, $message, array $context = [ ] ) {
29 29
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
30 30
 			echo $this->getFormattedMessage( $level, $message );
31 31
 		}
Please login to merge, or discard this patch.
includes/Logger/MultiLogger.php 1 patch
Spacing   +4 added lines, -4 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\Logger;
4 4
 
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class MultiLogger extends AbstractLogger {
12 12
 	/** @var LoggerInterface[] */
13
-	private $loggers = [];
13
+	private $loggers = [ ];
14 14
 
15 15
 	/**
16 16
 	 * @param LoggerInterface ...$loggers
17 17
 	 */
18
-	public function __construct( LoggerInterface ...$loggers ) {
18
+	public function __construct ( LoggerInterface ...$loggers ) {
19 19
 		$this->loggers = $loggers;
20 20
 	}
21 21
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @inheritDoc
24 24
 	 * @suppress PhanUnusedPublicMethodParameter
25 25
 	 */
26
-	public function log( $level, $message, array $context = [] ) {
26
+	public function log ( $level, $message, array $context = [ ] ) {
27 27
 		foreach ( $this->loggers as $logger ) {
28 28
 			$logger->log( $level, $message );
29 29
 		}
Please login to merge, or discard this patch.
includes/Logger/LoggerTrait.php 1 patch
Spacing   +3 added lines, -3 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\Logger;
4 4
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	 * @param string $level
12 12
 	 * @return int
13 13
 	 */
14
-	protected function levelToInt( string $level ) : int {
14
+	protected function levelToInt ( string $level ) : int {
15 15
 		// Order matters
16 16
 		$mapping = [
17 17
 			LogLevel::DEBUG,
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $message
32 32
 	 * @return string
33 33
 	 */
34
-	protected function getFormattedMessage( string $level, string $message ) {
34
+	protected function getFormattedMessage ( string $level, string $message ) {
35 35
 		return sprintf( "%s [%s] - %s\n", date( 'd M H:i:s' ), $level, $message );
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
includes/Logger/WikiLogger.php 1 patch
Spacing   +6 added lines, -6 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\Logger;
4 4
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param Page $logPage
27 27
 	 * @param string $minlevel
28 28
 	 */
29
-	public function __construct( Page $logPage, $minlevel = LogLevel::INFO ) {
29
+	public function __construct ( Page $logPage, $minlevel = LogLevel::INFO ) {
30 30
 		$this->logPage = $logPage;
31 31
 		$this->minLevel = $this->levelToInt( $minlevel );
32 32
 	}
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	 * @inheritDoc
36 36
 	 * @suppress PhanUnusedPublicMethodParameter
37 37
 	 */
38
-	public function log( $level, $message, array $context = [] ) {
38
+	public function log ( $level, $message, array $context = [ ] ) {
39 39
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
40
-			$this->buffer[] = $this->getFormattedMessage( $level, $message );
40
+			$this->buffer[ ] = $this->getFormattedMessage( $level, $message );
41 41
 		}
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * Actually writes data to the wiki
46 46
 	 */
47
-	public function doOutput() {
47
+	public function doOutput () {
48 48
 		if ( $this->buffer ) {
49 49
 			$this->logPage->edit( [
50 50
 				'appendtext' => implode( "\n", $this->buffer ),
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * @todo Can we move this?
58 58
 	 */
59
-	public function __destruct() {
59
+	public function __destruct () {
60 60
 		$this->doOutput();
61 61
 	}
62 62
 }
Please login to merge, or discard this patch.