Passed
Push — master ( fd4e50...5cd30c )
by Daimona
01:54
created
includes/Wiki/Page/Page.php 1 patch
Spacing   +17 added lines, -17 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\Wiki\Page;
4 4
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param string $title
20 20
 	 * @param Wiki $wiki For the site where the page lives
21 21
 	 */
22
-	public function __construct( string $title, Wiki $wiki ) {
22
+	public function __construct ( string $title, Wiki $wiki ) {
23 23
 		parent::__construct( $wiki );
24 24
 		$this->title = $title;
25 25
 	}
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @return string
29 29
 	 */
30
-	public function getTitle() : string {
30
+	public function getTitle () : string {
31 31
 		return $this->title;
32 32
 	}
33 33
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param int|null $section A section number to retrieve the content of that section
38 38
 	 * @return string
39 39
 	 */
40
-	public function getContent( int $section = null ) : string {
40
+	public function getContent ( int $section = null ) : string {
41 41
 		if ( $this->content === null ) {
42 42
 			$this->content = $this->wiki->getPageContent( $this->title, $section );
43 43
 		}
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	 * @param array $params
51 51
 	 * @throws \LogicException
52 52
 	 */
53
-	public function edit( array $params ) {
53
+	public function edit ( array $params ) {
54 54
 		$params = [
55 55
 			'title' => $this->getTitle()
56 56
 		] + $params;
57 57
 
58 58
 		$this->wiki->editPage( $params );
59
-		if ( isset( $params['text'] ) ) {
60
-			$this->content = $params['text'];
61
-		} elseif ( isset( $params['appendtext'] ) ) {
62
-			$this->content .= $params['appendtext'];
63
-		} elseif ( isset( $params['prependtext'] ) ) {
64
-			$this->content = $params['prependtext'] . $this->content;
59
+		if ( isset( $params[ 'text' ] ) ) {
60
+			$this->content = $params[ 'text' ];
61
+		} elseif ( isset( $params[ 'appendtext' ] ) ) {
62
+			$this->content .= $params[ 'appendtext' ];
63
+		} elseif ( isset( $params[ 'prependtext' ] ) ) {
64
+			$this->content = $params[ 'prependtext' ] . $this->content;
65 65
 		} else {
66 66
 			throw new \LogicException(
67 67
 				'Unrecognized text param for edit. Params: ' . var_export( $params, true )
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return bool
76 76
 	 */
77
-	public function exists() : bool {
77
+	public function exists () : bool {
78 78
 		$res = RequestBase::newFromParams( [
79 79
 			'action' => 'query',
80 80
 			'titles' => $this->getTitle()
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @param string $regex
90 90
 	 * @return bool
91 91
 	 */
92
-	public function matches( string $regex ) : bool {
92
+	public function matches ( string $regex ) : bool {
93 93
 		return (bool)preg_match( $regex, $this->getContent() );
94 94
 	}
95 95
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @return string[]
102 102
 	 * @throws \Exception
103 103
 	 */
104
-	public function getMatch( string $regex ) : array {
105
-		$ret = [];
104
+	public function getMatch ( string $regex ) : array {
105
+		$ret = [ ];
106 106
 		if ( preg_match( $regex, $this->getContent(), $ret ) === 0 ) {
107 107
 			throw new \Exception( "The content of $this does not match the given regex $regex" );
108 108
 		}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @inheritDoc
116 116
 	 */
117
-	public function getRegex() : string {
117
+	public function getRegex () : string {
118 118
 		return str_replace( ' ', '[ _]', preg_quote( $this->title ) );
119 119
 	}
120 120
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @return string
125 125
 	 */
126
-	public function __toString() {
126
+	public function __toString () {
127 127
 		return $this->getTitle();
128 128
 	}
129 129
 }
Please login to merge, or discard this patch.
includes/Wiki/Page/PageRiconferma.php 1 patch
Spacing   +22 added lines, -22 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\Wiki\Page;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	private $supportSection;
14 14
 	private $opposeSection;
15 15
 	/** @var array Counts of votes for each section */
16
-	private $sectionCounts = [];
16
+	private $sectionCounts = [ ];
17 17
 
18 18
 	// Possible outcomes of a vote
19 19
 	public const OUTCOME_OK = 0;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * because they can vary depending on whether the page is a vote, which is relatively
33 33
 	 * expensive to know since it requires parsing the content of the page.
34 34
 	 */
35
-	private function defineSections() {
35
+	private function defineSections () {
36 36
 		$this->supportSection = $this->isVote() ? 3 : 0;
37 37
 		$this->opposeSection = $this->isVote() ? 4 : 3;
38 38
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return User
44 44
 	 */
45
-	public function getUser() : User {
46
-		$name = explode( '/', $this->title )[2];
45
+	public function getUser () : User {
46
+		$name = explode( '/', $this->title )[ 2 ];
47 47
 		return new User( $name, $this->wiki );
48 48
 	}
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return int
54 54
 	 */
55
-	public function getNum() : int {
55
+	public function getNum () : int {
56 56
 		$bits = explode( '/', $this->getTitle() );
57 57
 		return intval( end( $bits ) );
58 58
 	}
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string
64 64
 	 */
65
-	public function getUserNum() : string {
66
-		return explode( '/', $this->getTitle(), 3 )[2];
65
+	public function getUserNum () : string {
66
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
67 67
 	}
68 68
 
69 69
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return string
73 73
 	 */
74
-	public function getBaseTitle() : string {
74
+	public function getBaseTitle () : string {
75 75
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
76 76
 	}
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return int
82 82
 	 */
83
-	public function getOpposingCount() : int {
83
+	public function getOpposingCount () : int {
84 84
 		$this->defineSections();
85 85
 		return $this->getCountForSection( $this->opposeSection );
86 86
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return int
92 92
 	 * @throws \BadMethodCallException
93 93
 	 */
94
-	public function getSupportCount() : int {
94
+	public function getSupportCount () : int {
95 95
 		if ( !$this->isVote() ) {
96 96
 			throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' );
97 97
 		}
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 	 * @param int $secNum
106 106
 	 * @return int
107 107
 	 */
108
-	protected function getCountForSection( int $secNum ) : int {
108
+	protected function getCountForSection ( int $secNum ) : int {
109 109
 		if ( !isset( $this->sectionCounts[ $secNum ] ) ) {
110 110
 			$content = $this->wiki->getPageContent( $this->title, $secNum );
111 111
 			// Let's hope that this is good enough...
112
-			$this->sectionCounts[$secNum] = preg_match_all( "/^\# *(?![# *:]|\.\.\.$)/m", $content );
112
+			$this->sectionCounts[ $secNum ] = preg_match_all( "/^\# *(?![# *:]|\.\.\.$)/m", $content );
113 113
 		}
114
-		return $this->sectionCounts[$secNum];
114
+		return $this->sectionCounts[ $secNum ];
115 115
 	}
116 116
 
117 117
 	/**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return int
121 121
 	 */
122
-	protected function getQuorum() : int {
122
+	protected function getQuorum () : int {
123 123
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
124
-		return intval( $this->getMatch( $reg )[1] );
124
+		return intval( $this->getMatch( $reg )[ 1 ] );
125 125
 	}
126 126
 
127 127
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return bool
131 131
 	 */
132
-	public function hasOpposition() : bool {
132
+	public function hasOpposition () : bool {
133 133
 		return $this->getOpposingCount() >= self::REQUIRED_OPPOSE;
134 134
 	}
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return int One of the OUTCOME_* constants
140 140
 	 */
141
-	public function getOutcome() : int {
141
+	public function getOutcome () : int {
142 142
 		if ( !$this->isVote() ) {
143 143
 			return self::OUTCOME_OK;
144 144
 		}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @throws \BadMethodCallException
162 162
 	 * @throws \LogicException
163 163
 	 */
164
-	public function getOutcomeText() : string {
164
+	public function getOutcomeText () : string {
165 165
 		if ( !$this->isVote() ) {
166 166
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
167 167
 		}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return bool
197 197
 	 */
198
-	public function isVote() : bool {
198
+	public function isVote () : bool {
199 199
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
200 200
 		return !$this->matches( $sectionReg );
201 201
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return int
207 207
 	 */
208
-	public function getCreationTimestamp() : int {
208
+	public function getCreationTimestamp () : int {
209 209
 		return $this->wiki->getPageCreationTS( $this->title );
210 210
 	}
211 211
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return int
216 216
 	 */
217
-	public function getEndTimestamp() : int {
217
+	public function getEndTimestamp () : int {
218 218
 		if ( $this->isVote() ) {
219 219
 			$reg = "!La votazione ha inizio il.+ alle ore ([\d:]+) e ha termine il (.+) alla stessa ora!";
220 220
 			list( , $hours, $day ) = $this->getMatch( $reg );
Please login to merge, or discard this patch.
includes/Wiki/Element.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\Wiki;
4 4
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	/**
13 13
 	 * @param Wiki $wiki
14 14
 	 */
15
-	public function __construct( Wiki $wiki ) {
15
+	public function __construct ( Wiki $wiki ) {
16 16
 		$this->wiki = $wiki;
17 17
 	}
18 18
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return string
23 23
 	 */
24
-	abstract public function getRegex() : string;
24
+	abstract public function getRegex () : string;
25 25
 
26 26
 	/**
27 27
 	 * Get a regex matching any element in the given array
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	 * @return string
31 31
 	 * @todo Is this the right place?
32 32
 	 */
33
-	public static function regexFromArray( array $elements ) : string {
34
-		$bits = [];
33
+	public static function regexFromArray ( array $elements ) : string {
34
+		$bits = [ ];
35 35
 		foreach ( $elements as $el ) {
36
-			$bits[] = $el->getRegex();
36
+			$bits[ ] = $el->getRegex();
37 37
 		}
38 38
 		return '(?:' . implode( '|', $bits ) . ')';
39 39
 	}
Please login to merge, or discard this patch.
includes/Task/Task.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 	 *
15 15
 	 * @return string[]
16 16
 	 */
17
-	abstract protected function getSubtasksMap() : array;
17
+	abstract protected function getSubtasksMap () : array;
18 18
 
19 19
 	/**
20 20
 	 * @param string $subtask Defined in self::SUBTASKS_MAP
21 21
 	 * @return TaskResult
22 22
 	 */
23
-	protected function runSubtask( string $subtask ) : TaskResult {
23
+	protected function runSubtask ( string $subtask ) : TaskResult {
24 24
 		$map = $this->getSubtasksMap();
25 25
 		if ( !isset( $map[ $subtask ] ) ) {
26 26
 			throw new \InvalidArgumentException( "'$subtask' is not a valid task." );
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * @inheritDoc
35 35
 	 */
36
-	final public function getOperationName(): string {
36
+	final public function getOperationName (): string {
37 37
 		return 'task';
38 38
 	}
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param string $class
44 44
 	 * @return Subtask
45 45
 	 */
46
-	private function getSubtaskInstance( string $class ) : Subtask {
46
+	private function getSubtaskInstance ( string $class ) : Subtask {
47 47
 		return new $class( $this->getLogger(), $this->getWiki(), $this->getDataProvider() );
48 48
 	}
49 49
 }
Please login to merge, or discard this patch.
includes/Task/Subtask/FailedUpdates.php 1 patch
Spacing   +16 added lines, -16 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\Subtask;
4 4
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @inheritDoc
19 19
 	 */
20
-	public function runInternal() : int {
20
+	public function runInternal () : int {
21 21
 		$failed = $this->getFailures();
22 22
 		if ( !$failed ) {
23 23
 			return TaskResult::STATUS_NOTHING;
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return PageRiconferma[]
41 41
 	 */
42
-	private function getFailures() : array {
43
-		$ret = [];
42
+	private function getFailures () : array {
43
+		$ret = [ ];
44 44
 		$allPages = $this->getDataProvider()->getPagesToClose();
45 45
 		foreach ( $allPages as $page ) {
46 46
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
47
-				$ret[] = $page;
47
+				$ret[ ] = $page;
48 48
 			}
49 49
 		}
50 50
 		return $ret;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @param User[] $users
55 55
 	 */
56
-	protected function updateBurList( array $users ) {
56
+	protected function updateBurList ( array $users ) {
57 57
 		$this->getLogger()->info( 'Updating bur list. Removing: ' . implode( ', ', $users ) );
58 58
 		$remList = Element::regexFromArray( $users );
59 59
 		$burList = $this->getPage( $this->getOpt( 'bur-list-title' ) );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param PageRiconferma[] $pages
78 78
 	 */
79
-	protected function requestRemoval( array $pages ) {
79
+	protected function requestRemoval ( array $pages ) {
80 80
 		$this->getLogger()->info( 'Requesting flag removal for: ' . implode( ', ', $pages ) );
81 81
 
82 82
 		$metaWiki = new Wiki( $this->getLogger(), META_URL );
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @param PageRiconferma[] $pages
115 115
 	 */
116
-	protected function updateAnnunci( array $pages ) {
116
+	protected function updateAnnunci ( array $pages ) {
117 117
 		$this->getLogger()->info( 'Updating annunci' );
118 118
 		$section = 1;
119 119
 
120
-		$names = [];
120
+		$names = [ ];
121 121
 		$text = '';
122 122
 		foreach ( $pages as $page ) {
123 123
 			$user = $page->getUser()->getName();
124
-			$names[] = $user;
124
+			$names[ ] = $user;
125 125
 			$text .= $this->msg( 'annunci-text' )->params( [ '$user' => $user ] )->text();
126 126
 		}
127 127
 
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 	 *
154 154
 	 * @param PageRiconferma[] $pages
155 155
 	 */
156
-	protected function updateUltimeNotizie( array $pages ) {
156
+	protected function updateUltimeNotizie ( array $pages ) {
157 157
 		$this->getLogger()->info( 'Updating ultime notizie' );
158 158
 		$notiziePage = $this->getPage( $this->getOpt( 'ultimenotizie-page-title' ) );
159 159
 
160
-		$names = [];
160
+		$names = [ ];
161 161
 		$text = '';
162 162
 		$msg = $this->msg( 'ultimenotizie-text' );
163 163
 		foreach ( $pages as $page ) {
164 164
 			$user = $page->getUser()->getName();
165
-			$names[] = $user;
165
+			$names[ ] = $user;
166 166
 			$text .= $msg->params( [ '$user' => $user, '$title' => $page->getTitle() ] )->text();
167 167
 		}
168 168
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 	 * @param PageRiconferma[] $pages
192 192
 	 * @return User[]
193 193
 	 */
194
-	private function getFailedBureaucrats( array $pages ) : array {
195
-		$ret = [];
194
+	private function getFailedBureaucrats ( array $pages ) : array {
195
+		$ret = [ ];
196 196
 		foreach ( $pages as $page ) {
197 197
 			$user = $page->getUser();
198 198
 			if ( $user->inGroup( 'bureaucrat' ) ) {
199
-				$ret[] = $user;
199
+				$ret[ ] = $user;
200 200
 			}
201 201
 		}
202 202
 		return $ret;
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
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param LoggerInterface $logger
56 56
 	 * @param Wiki $wiki
57 57
 	 */
58
-	public function __construct( LoggerInterface $logger, Wiki $wiki ) {
58
+	public function __construct ( LoggerInterface $logger, Wiki $wiki ) {
59 59
 		$this->logger = $logger;
60 60
 		$this->wiki = $wiki;
61 61
 		$this->provider = new TaskDataProvider( $this->logger, $this->wiki );
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param string|null $name Only used in MODE_TASK and MODE_SUBTASK
69 69
 	 * @return TaskResult
70 70
 	 */
71
-	public function run( string $mode, string $name = null ) : TaskResult {
71
+	public function run ( string $mode, string $name = null ) : TaskResult {
72 72
 		if ( $mode === self::MODE_COMPLETE ) {
73 73
 			return $this->runAllTasks();
74 74
 		} elseif ( $name === null ) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return TaskResult
85 85
 	 */
86
-	protected function runAllTasks() : TaskResult {
86
+	protected function runAllTasks () : TaskResult {
87 87
 		$orderedList = [
88 88
 			'update-list',
89 89
 			'start-new',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string $name
106 106
 	 * @return TaskResult
107 107
 	 */
108
-	protected function runTask( string $name ) : TaskResult {
108
+	protected function runTask ( string $name ) : TaskResult {
109 109
 		if ( !isset( self::TASKS_MAP[ $name ] ) ) {
110 110
 			throw new \InvalidArgumentException( "'$name' is not a valid task." );
111 111
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @param string $name
121 121
 	 * @return TaskResult
122 122
 	 */
123
-	protected function runSubtask( string $name ) : TaskResult {
123
+	protected function runSubtask ( string $name ) : TaskResult {
124 124
 		if ( !isset( self::SUBTASKS_MAP[ $name ] ) ) {
125 125
 			throw new \InvalidArgumentException( "'$name' is not a valid subtask." );
126 126
 		}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @param string $class
136 136
 	 * @return Task
137 137
 	 */
138
-	private function getTaskInstance( string $class ) : Task {
138
+	private function getTaskInstance ( string $class ) : Task {
139 139
 		return new $class( $this->logger, $this->wiki, $this->provider );
140 140
 	}
141 141
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @param string $class
146 146
 	 * @return Subtask
147 147
 	 */
148
-	private function getSubtaskInstance( string $class ) : Subtask {
148
+	private function getSubtaskInstance ( string $class ) : Subtask {
149 149
 		return new $class( $this->logger, $this->wiki, $this->provider );
150 150
 	}
151 151
 }
Please login to merge, or discard this patch.
includes/ContextSource.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param LoggerInterface $logger
25 25
 	 * @param Wiki $wiki
26 26
 	 */
27
-	public function __construct( LoggerInterface $logger, Wiki $wiki ) {
27
+	public function __construct ( LoggerInterface $logger, Wiki $wiki ) {
28 28
 		$this->setLogger( $logger );
29 29
 		$this->setConfig( Config::getInstance() );
30 30
 		$this->setWiki( $wiki );
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * @return LoggerInterface
35 35
 	 */
36
-	protected function getLogger() : LoggerInterface {
36
+	protected function getLogger () : LoggerInterface {
37 37
 		return $this->logger;
38 38
 	}
39 39
 
40 40
 	/**
41 41
 	 * @inheritDoc
42 42
 	 */
43
-	public function setLogger( LoggerInterface $logger ) {
43
+	public function setLogger ( LoggerInterface $logger ) {
44 44
 		$this->logger = $logger;
45 45
 	}
46 46
 
@@ -50,35 +50,35 @@  discard block
 block discarded – undo
50 50
 	 * @param string $optname
51 51
 	 * @return mixed
52 52
 	 */
53
-	protected function getOpt( string $optname ) {
53
+	protected function getOpt ( string $optname ) {
54 54
 		return $this->getConfig()->get( $optname );
55 55
 	}
56 56
 
57 57
 	/**
58 58
 	 * @return Config
59 59
 	 */
60
-	protected function getConfig() : Config {
60
+	protected function getConfig () : Config {
61 61
 		return $this->config;
62 62
 	}
63 63
 
64 64
 	/**
65 65
 	 * @param Config $cfg
66 66
 	 */
67
-	protected function setConfig( Config $cfg ) {
67
+	protected function setConfig ( Config $cfg ) {
68 68
 		$this->config = $cfg;
69 69
 	}
70 70
 
71 71
 	/**
72 72
 	 * @return Wiki
73 73
 	 */
74
-	protected function getWiki() : Wiki {
74
+	protected function getWiki () : Wiki {
75 75
 		return $this->wiki;
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @param Wiki $wiki
80 80
 	 */
81
-	protected function setWiki( Wiki $wiki ) {
81
+	protected function setWiki ( Wiki $wiki ) {
82 82
 		$this->wiki = $wiki;
83 83
 	}
84 84
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @param string $key
89 89
 	 * @return Message
90 90
 	 */
91
-	protected function msg( string $key ) : Message {
91
+	protected function msg ( string $key ) : Message {
92 92
 		return new Message( $key );
93 93
 	}
94 94
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param string $title
99 99
 	 * @return Page
100 100
 	 */
101
-	protected function getPage( string $title ) : Page {
101
+	protected function getPage ( string $title ) : Page {
102 102
 		return new Page( $title, $this->getWiki() );
103 103
 	}
104 104
 }
Please login to merge, or discard this patch.
includes/Config.php 1 patch
Spacing   +13 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
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	/** @var self */
14 14
 	private static $instance;
15 15
 	/** @var array */
16
-	private $opts = [];
16
+	private $opts = [ ];
17 17
 	/** @var array|null Lazy-loaded to avoid unnecessary requests */
18 18
 	private $messages;
19 19
 	/** @var Wiki */
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param Wiki $wiki
26 26
 	 */
27
-	private function __construct( Wiki $wiki ) {
27
+	private function __construct ( Wiki $wiki ) {
28 28
 		$this->wiki = $wiki;
29 29
 	}
30 30
 
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	 * @param Wiki $wiki
36 36
 	 * @throws ConfigException
37 37
 	 */
38
-	public static function init( array $defaults, Wiki $wiki ) {
38
+	public static function init ( array $defaults, Wiki $wiki ) {
39 39
 		if ( self::$instance ) {
40 40
 			throw new ConfigException( 'Config was already initialized' );
41 41
 		}
42 42
 
43 43
 		$inst = new self( $wiki );
44
-		$inst->set( 'list-title', $defaults['list-title'] );
45
-		$inst->set( 'msg-title', $defaults['msg-title'] );
46
-		$inst->set( 'username', $defaults['username'] );
47
-		$inst->set( 'password', $defaults['password'] );
44
+		$inst->set( 'list-title', $defaults[ 'list-title' ] );
45
+		$inst->set( 'msg-title', $defaults[ 'msg-title' ] );
46
+		$inst->set( 'username', $defaults[ 'username' ] );
47
+		$inst->set( 'password', $defaults[ 'password' ] );
48 48
 
49 49
 		// On-wiki values
50 50
 		try {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return string
65 65
 	 * @throws ConfigException
66 66
 	 */
67
-	public function getWikiMessage( string $key ) : string {
67
+	public function getWikiMessage ( string $key ) : string {
68 68
 		if ( $this->messages === null ) {
69 69
 			try {
70 70
 				$cont = $this->wiki->getPageContent( $this->opts[ 'msg-title' ] );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		if ( !isset( $this->messages[ $key ] ) ) {
77 77
 			throw new ConfigException( "Message '$key' does not exist." );
78 78
 		}
79
-		return $this->messages[$key];
79
+		return $this->messages[ $key ];
80 80
 	}
81 81
 
82 82
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @param string $key
86 86
 	 * @param mixed $value
87 87
 	 */
88
-	protected function set( string $key, $value ) {
88
+	protected function set ( string $key, $value ) {
89 89
 		$this->opts[ $key ] = $value;
90 90
 	}
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return self
96 96
 	 * @throws ConfigException
97 97
 	 */
98
-	public static function getInstance() : self {
98
+	public static function getInstance () : self {
99 99
 		if ( !self::$instance ) {
100 100
 			throw new ConfigException( 'Config not yet initialized' );
101 101
 		}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return mixed
110 110
 	 * @throws ConfigException
111 111
 	 */
112
-	public function get( string $opt ) {
112
+	public function get ( string $opt ) {
113 113
 		if ( !isset( $this->opts[ $opt ] ) ) {
114 114
 			throw new ConfigException( "Config option '$opt' not set." );
115 115
 		}
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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param LoggerInterface $logger
21 21
 	 * @param Wiki $wiki
22 22
 	 */
23
-	public function __construct( LoggerInterface $logger, Wiki $wiki ) {
23
+	public function __construct ( LoggerInterface $logger, Wiki $wiki ) {
24 24
 		$this->logger = $logger;
25 25
 		$this->wiki = $wiki;
26 26
 	}
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $mode
32 32
 	 * @param string|null $name
33 33
 	 */
34
-	private function run( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) {
34
+	private function run ( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) {
35 35
 		$activity = $mode === TaskManager::MODE_COMPLETE ? TaskManager::MODE_COMPLETE : "$mode $name";
36 36
 		$this->logger->info( "Running $activity" );
37 37
 		$manager = new TaskManager( $this->logger, $this->wiki );
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
 		$base = "Execution of $activity";
40 40
 		if ( $res->isOK() ) {
41 41
 			$msg = $res->getStatus() === TaskResult::STATUS_NOTHING ?
42
-				': nothing to do' :
43
-				' completed successfully';
42
+				': nothing to do' : ' completed successfully';
44 43
 			$this->logger->info( $base . $msg );
45 44
 		} else {
46 45
 			$this->logger->error( "$base failed.\n$res" );
@@ -50,7 +49,7 @@  discard block
 block discarded – undo
50 49
 	/**
51 50
 	 * Entry point for the whole process
52 51
 	 */
53
-	public function runAll() {
52
+	public function runAll () {
54 53
 		$this->run();
55 54
 	}
56 55
 
@@ -59,7 +58,7 @@  discard block
 block discarded – undo
59 58
 	 *
60 59
 	 * @param string $task
61 60
 	 */
62
-	public function runTask( string $task ) {
61
+	public function runTask ( string $task ) {
63 62
 		$this->run( TaskManager::MODE_TASK, $task );
64 63
 	}
65 64
 
@@ -68,7 +67,7 @@  discard block
 block discarded – undo
68 67
 	 *
69 68
 	 * @param string $subtask
70 69
 	 */
71
-	public function runSubtask( string $subtask ) {
70
+	public function runSubtask ( string $subtask ) {
72 71
 		$this->run( TaskManager::MODE_SUBTASK, $subtask );
73 72
 	}
74 73
 }
Please login to merge, or discard this patch.