Passed
Push — master ( a192f6...3a1f1a )
by Daimona
02:01
created
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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string $summary
30 30
 	 * @param string $minlevel
31 31
 	 */
32
-	public function __construct( Page $logPage, string $summary, $minlevel = LogLevel::INFO ) {
32
+	public function __construct ( Page $logPage, string $summary, $minlevel = LogLevel::INFO ) {
33 33
 		$this->minLevel = $this->levelToInt( $minlevel );
34 34
 		$this->logPage = $logPage;
35 35
 		$this->summary = $summary;
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 	 * @inheritDoc
40 40
 	 * @suppress PhanUnusedPublicMethodParameter
41 41
 	 */
42
-	public function log( $level, $message, array $context = [] ) :void {
42
+	public function log ( $level, $message, array $context = [ ] ) :void {
43 43
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
44
-			$this->buffer[] = $this->getFormattedMessage( $level, $message );
44
+			$this->buffer[ ] = $this->getFormattedMessage( $level, $message );
45 45
 		}
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * @return string
50 50
 	 */
51
-	protected function getOutput() : string {
51
+	protected function getOutput () : string {
52 52
 		$line = str_repeat( '-', 80 );
53 53
 		return "\n\n" . implode( "\n", $this->buffer ) . "\n$line\n\n";
54 54
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * @inheritDoc
58 58
 	 */
59
-	public function flush() : void {
59
+	public function flush () : void {
60 60
 		if ( $this->buffer ) {
61 61
 			$this->logPage->edit( [
62 62
 				'appendtext' => $this->getOutput(),
Please login to merge, or discard this patch.
includes/ContextSource.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param Wiki $wiki
30 30
 	 * @param MessageProvider $mp
31 31
 	 */
32
-	public function __construct( LoggerInterface $logger, Wiki $wiki, MessageProvider $mp ) {
32
+	public function __construct ( LoggerInterface $logger, Wiki $wiki, MessageProvider $mp ) {
33 33
 		$this->setLogger( $logger );
34 34
 		$this->setConfig( Config::getInstance() );
35 35
 		$this->setWiki( $wiki );
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * @return LoggerInterface
41 41
 	 */
42
-	protected function getLogger() : LoggerInterface {
42
+	protected function getLogger () : LoggerInterface {
43 43
 		return $this->logger;
44 44
 	}
45 45
 
46 46
 	/**
47 47
 	 * @inheritDoc
48 48
 	 */
49
-	public function setLogger( LoggerInterface $logger ) : void {
49
+	public function setLogger ( LoggerInterface $logger ) : void {
50 50
 		$this->logger = $logger;
51 51
 	}
52 52
 
@@ -56,49 +56,49 @@  discard block
 block discarded – undo
56 56
 	 * @param string $optname
57 57
 	 * @return mixed
58 58
 	 */
59
-	protected function getOpt( string $optname ) {
59
+	protected function getOpt ( string $optname ) {
60 60
 		return $this->getConfig()->get( $optname );
61 61
 	}
62 62
 
63 63
 	/**
64 64
 	 * @return Config
65 65
 	 */
66
-	protected function getConfig() : Config {
66
+	protected function getConfig () : Config {
67 67
 		return $this->config;
68 68
 	}
69 69
 
70 70
 	/**
71 71
 	 * @param Config $cfg
72 72
 	 */
73
-	protected function setConfig( Config $cfg ) : void {
73
+	protected function setConfig ( Config $cfg ) : void {
74 74
 		$this->config = $cfg;
75 75
 	}
76 76
 
77 77
 	/**
78 78
 	 * @return Wiki
79 79
 	 */
80
-	protected function getWiki() : Wiki {
80
+	protected function getWiki () : Wiki {
81 81
 		return $this->wiki;
82 82
 	}
83 83
 
84 84
 	/**
85 85
 	 * @param Wiki $wiki
86 86
 	 */
87
-	protected function setWiki( Wiki $wiki ) : void {
87
+	protected function setWiki ( Wiki $wiki ) : void {
88 88
 		$this->wiki = $wiki;
89 89
 	}
90 90
 
91 91
 	/**
92 92
 	 * @return MessageProvider
93 93
 	 */
94
-	protected function getMessageProvider() : MessageProvider {
94
+	protected function getMessageProvider () : MessageProvider {
95 95
 		return $this->messageProvider;
96 96
 	}
97 97
 
98 98
 	/**
99 99
 	 * @param MessageProvider $mp
100 100
 	 */
101
-	protected function setMessageProvider( MessageProvider $mp ) : void {
101
+	protected function setMessageProvider ( MessageProvider $mp ) : void {
102 102
 		$this->messageProvider = $mp;
103 103
 	}
104 104
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param string $key
109 109
 	 * @return Message
110 110
 	 */
111
-	protected function msg( string $key ) : Message {
111
+	protected function msg ( string $key ) : Message {
112 112
 		return $this->messageProvider->getMessage( $key );
113 113
 	}
114 114
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @param string $title
119 119
 	 * @return Page
120 120
 	 */
121
-	protected function getPage( string $title ) : Page {
121
+	protected function getPage ( string $title ) : Page {
122 122
 		return new Page( $title, $this->getWiki() );
123 123
 	}
124 124
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @param string $name
129 129
 	 * @return User
130 130
 	 */
131
-	protected function getUser( string $name ) : User {
131
+	protected function getUser ( string $name ) : User {
132 132
 		return new User( $name, $this->getWiki() );
133 133
 	}
134 134
 }
Please login to merge, or discard this patch.
includes/TaskManager.php 1 patch
Spacing   +8 added lines, -8 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
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @param Wiki $wiki
59 59
 	 * @param MessageProvider $mp
60 60
 	 */
61
-	public function __construct( LoggerInterface $logger, Wiki $wiki, MessageProvider $mp ) {
61
+	public function __construct ( LoggerInterface $logger, Wiki $wiki, MessageProvider $mp ) {
62 62
 		$this->logger = $logger;
63 63
 		$this->wiki = $wiki;
64 64
 		$this->messageProvider = $mp;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param string|null $name Only used in MODE_TASK and MODE_SUBTASK
73 73
 	 * @return TaskResult
74 74
 	 */
75
-	public function run( string $mode, string $name = null ) : TaskResult {
75
+	public function run ( string $mode, string $name = null ) : TaskResult {
76 76
 		if ( $mode === self::MODE_COMPLETE ) {
77 77
 			return $this->runAllTasks();
78 78
 		} elseif ( $name === null ) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return TaskResult
89 89
 	 */
90
-	protected function runAllTasks() : TaskResult {
90
+	protected function runAllTasks () : TaskResult {
91 91
 		$orderedList = [
92 92
 			'update-list',
93 93
 			'start-new',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @param string $name
110 110
 	 * @return TaskResult
111 111
 	 */
112
-	protected function runTask( string $name ) : TaskResult {
112
+	protected function runTask ( string $name ) : TaskResult {
113 113
 		if ( !isset( self::TASKS_MAP[ $name ] ) ) {
114 114
 			throw new \InvalidArgumentException( "'$name' is not a valid task." );
115 115
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @param string $name
124 124
 	 * @return TaskResult
125 125
 	 */
126
-	protected function runSubtask( string $name ) : TaskResult {
126
+	protected function runSubtask ( string $name ) : TaskResult {
127 127
 		if ( !isset( self::SUBTASKS_MAP[ $name ] ) ) {
128 128
 			throw new \InvalidArgumentException( "'$name' is not a valid subtask." );
129 129
 		}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @param string $name
139 139
 	 * @return Task
140 140
 	 */
141
-	private function getTaskInstance( string $name ) : Task {
141
+	private function getTaskInstance ( string $name ) : Task {
142 142
 		$class = self::TASKS_MAP[ $name ];
143 143
 		/** @var Task $ret */
144 144
 		$ret = new $class( $this->logger, $this->wiki, $this->provider, $this->messageProvider );
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @param string $class
152 152
 	 * @return Subtask
153 153
 	 */
154
-	private function getSubtaskInstance( string $class ) : Subtask {
154
+	private function getSubtaskInstance ( string $class ) : Subtask {
155 155
 		/** @var Subtask $ret */
156 156
 		$ret = new $class( $this->logger, $this->wiki, $this->provider, $this->messageProvider );
157 157
 		return $ret;
Please login to merge, or discard this patch.
includes/Bot.php 1 patch
Spacing   +7 added lines, -8 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
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param Wiki $wiki
22 22
 	 * @param MessageProvider $mp
23 23
 	 */
24
-	public function __construct( LoggerInterface $logger, Wiki $wiki, MessageProvider $mp ) {
24
+	public function __construct ( LoggerInterface $logger, Wiki $wiki, MessageProvider $mp ) {
25 25
 		$this->logger = $logger;
26 26
 		$this->wiki = $wiki;
27 27
 		$this->messageProvider = $mp;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param string $mode
34 34
 	 * @param string|null $name
35 35
 	 */
36
-	private function run( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) : void {
36
+	private function run ( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) : void {
37 37
 		$activity = $mode === TaskManager::MODE_COMPLETE ? TaskManager::MODE_COMPLETE : "$mode $name";
38 38
 		$this->logger->info( "Running $activity" );
39 39
 		$manager = new TaskManager( $this->logger, $this->wiki, $this->messageProvider );
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
 		$base = "Execution of $activity";
42 42
 		if ( $res->isOK() ) {
43 43
 			$msg = $res->getStatus() === TaskResult::STATUS_NOTHING ?
44
-				': nothing to do' :
45
-				' completed successfully';
44
+				': nothing to do' : ' completed successfully';
46 45
 			$this->logger->info( $base . $msg );
47 46
 		} else {
48 47
 			$this->logger->error( "$base failed.\n$res" );
@@ -52,7 +51,7 @@  discard block
 block discarded – undo
52 51
 	/**
53 52
 	 * Entry point for the whole process
54 53
 	 */
55
-	public function runAll() : void {
54
+	public function runAll () : void {
56 55
 		$this->run();
57 56
 	}
58 57
 
@@ -61,7 +60,7 @@  discard block
 block discarded – undo
61 60
 	 *
62 61
 	 * @param string $task
63 62
 	 */
64
-	public function runTask( string $task ) : void {
63
+	public function runTask ( string $task ) : void {
65 64
 		$this->run( TaskManager::MODE_TASK, $task );
66 65
 	}
67 66
 
@@ -70,7 +69,7 @@  discard block
 block discarded – undo
70 69
 	 *
71 70
 	 * @param string $subtask
72 71
 	 */
73
-	public function runSubtask( string $subtask ) : void {
72
+	public function runSubtask ( string $subtask ) : void {
74 73
 		$this->run( TaskManager::MODE_SUBTASK, $subtask );
75 74
 	}
76 75
 }
Please login to merge, or discard this patch.