Passed
Push — master ( e5c8bb...3e6709 )
by Daimona
01:38
created
includes/Task/StartNew.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\Task;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function runInternal() : int {
17
+	public function runInternal () : int {
18 18
 		$orderedList = [
19 19
 			'create-pages',
20 20
 			'updates-around',
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @inheritDoc
34 34
 	 */
35
-	protected function getSubtasksMap() : array {
35
+	protected function getSubtasksMap () : array {
36 36
 		return [
37 37
 			'create-pages' => CreatePages::class,
38 38
 			'updates-around' => UpdatesAround::class,
Please login to merge, or discard this patch.
includes/Page/PageRiconferma.php 1 patch
Spacing   +18 added lines, -18 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\Page;
4 4
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * @param string $title
23 23
 	 */
24
-	public function __construct( string $title ) {
24
+	public function __construct ( string $title ) {
25 25
 		parent::__construct( $title );
26 26
 		$this->supportSection = $this->isVote() ? 3 : 0;
27 27
 		$this->opposeSection = $this->isVote() ? 4 : 3;
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return string
34 34
 	 */
35
-	public function getUser() : string {
36
-		return explode( '/', $this->title )[2];
35
+	public function getUser () : string {
36
+		return explode( '/', $this->title )[ 2 ];
37 37
 	}
38 38
 
39 39
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return int
43 43
 	 */
44
-	public function getNum() : int {
44
+	public function getNum () : int {
45 45
 		$bits = explode( '/', $this->getTitle() );
46 46
 		return intval( end( $bits ) );
47 47
 	}
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return string
53 53
 	 */
54
-	public function getUserNum() : string {
55
-		return explode( '/', $this->getTitle(), 3 )[2];
54
+	public function getUserNum () : string {
55
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
56 56
 	}
57 57
 
58 58
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return string
62 62
 	 */
63
-	public function getBaseTitle() : string {
63
+	public function getBaseTitle () : string {
64 64
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
65 65
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
66 66
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return int
72 72
 	 */
73
-	public function getOpposingCount() : int {
73
+	public function getOpposingCount () : int {
74 74
 		return $this->getCountForSection( $this->opposeSection );
75 75
 	}
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return int
81 81
 	 * @throws \BadMethodCallException
82 82
 	 */
83
-	public function getSupportCount() : int {
83
+	public function getSupportCount () : int {
84 84
 		if ( !$this->isVote() ) {
85 85
 			throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' );
86 86
 		}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param int $secNum
94 94
 	 * @return int
95 95
 	 */
96
-	protected function getCountForSection( int $secNum ) : int {
96
+	protected function getCountForSection ( int $secNum ) : int {
97 97
 		$content = $this->controller->getPageContent( $this->title, $secNum );
98 98
 		// Let's hope that this is good enough...
99 99
 		return substr_count( $content, "\n\# *(?![#*])" );
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return int
106 106
 	 */
107
-	protected function getQuorum() : int {
107
+	protected function getQuorum () : int {
108 108
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
109
-		return intval( $this->getMatch( $reg )[1] );
109
+		return intval( $this->getMatch( $reg )[ 1 ] );
110 110
 	}
111 111
 
112 112
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return bool
116 116
 	 */
117
-	public function hasOpposition() : bool {
117
+	public function hasOpposition () : bool {
118 118
 		return $this->getOpposingCount() >= 15;
119 119
 	}
120 120
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return int One of the OUTCOME_* constants
125 125
 	 * @throws \BadMethodCallException
126 126
 	 */
127
-	public function getOutcome() : int {
127
+	public function getOutcome () : int {
128 128
 		if ( !$this->isVote() ) {
129 129
 			throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' );
130 130
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @throws \BadMethodCallException
145 145
 	 * @throws \LogicException
146 146
 	 */
147
-	public function getOutcomeText() : string {
147
+	public function getOutcomeText () : string {
148 148
 		if ( !$this->isVote() ) {
149 149
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
150 150
 		}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return bool
180 180
 	 */
181
-	public function isVote() : bool {
181
+	public function isVote () : bool {
182 182
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
183 183
 		return !$this->matches( $sectionReg );
184 184
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return int
190 190
 	 */
191
-	public function getEndTimestamp() : int {
191
+	public function getEndTimestamp () : int {
192 192
 		if ( $this->isVote() ) {
193 193
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
194 194
 			list( , $day, $hours ) = $this->getMatch( $reg );
Please login to merge, or discard this patch.
includes/WikiController.php 1 patch
Spacing   +12 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
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	/**
26 26
 	 * @param string $domain The URL of the wiki, if different from default
27 27
 	 */
28
-	public function __construct( string $domain = DEFAULT_URL ) {
28
+	public function __construct ( string $domain = DEFAULT_URL ) {
29 29
 		$this->logger = new Logger;
30 30
 		$this->domain = $domain;
31 31
 	}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @return string
39 39
 	 * @throws MissingPageException
40 40
 	 */
41
-	public function getPageContent( string $title, int $section = null ) : string {
41
+	public function getPageContent ( string $title, int $section = null ) : string {
42 42
 		$this->logger->debug( "Retrieving page $title" );
43 43
 		$params = [
44 44
 			'action' => 'query',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		];
50 50
 
51 51
 		if ( $section !== null ) {
52
-			$params['rvsection'] = $section;
52
+			$params[ 'rvsection' ] = $section;
53 53
 		}
54 54
 
55 55
 		$req = RequestBase::newFromParams( $params )->setUrl( $this->domain );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			throw new MissingPageException( $title );
60 60
 		}
61 61
 
62
-		$mainSlot = $page->revisions[0]->slots->main;
62
+		$mainSlot = $page->revisions[ 0 ]->slots->main;
63 63
 
64 64
 		if ( isset( $mainSlot->nosuchsection ) ) {
65 65
 			throw new MissingSectionException( $title, $section );
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param array $params
74 74
 	 * @throws EditException
75 75
 	 */
76
-	public function editPage( array $params ) {
76
+	public function editPage ( array $params ) {
77 77
 		$this->login();
78 78
 
79 79
 		$params = [
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
96 96
 	 * @throws LoginException
97 97
 	 */
98
-	public function login() {
98
+	public function login () {
99 99
 		if ( self::$loggedIn ) {
100 100
 			$this->logger->debug( 'Already logged in' );
101 101
 			return;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		self::$loggedIn = true;
124 124
 		// Clear tokens cache
125
-		$this->tokens = [];
125
+		$this->tokens = [ ];
126 126
 		$this->logger->info( 'Login succeeded' );
127 127
 	}
128 128
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @param string $type
133 133
 	 * @return string
134 134
 	 */
135
-	public function getToken( string $type ) : string {
135
+	public function getToken ( string $type ) : string {
136 136
 		if ( !isset( $this->tokens[ $type ] ) ) {
137 137
 			$params = [
138 138
 				'action' => 'query',
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param string $title
156 156
 	 * @return int
157 157
 	 */
158
-	public function getPageCreationTS( string $title ) : int {
158
+	public function getPageCreationTS ( string $title ) : int {
159 159
 		$params = [
160 160
 			'action' => 'query',
161 161
 			'prop' => 'revisions',
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 		$res = RequestBase::newFromParams( $params )->setUrl( $this->domain )->execute();
170 170
 		$data = $res->query->pages;
171
-		return strtotime( reset( $data )->revisions[0]->timestamp );
171
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
172 172
 	}
173 173
 
174 174
 	/**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param string $title
178 178
 	 * @param string $reason
179 179
 	 */
180
-	public function protectPage( string $title, string $reason ) {
180
+	public function protectPage ( string $title, string $reason ) {
181 181
 		$this->logger->info( "Protecting page $title" );
182 182
 		$this->login();
183 183
 
Please login to merge, or discard this patch.
includes/Exception/MissingSectionException.php 1 patch
Spacing   +2 added lines, -2 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\Exception;
4 4
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * @param string $title
11 11
 	 * @param int|string $section Number or title
12 12
 	 */
13
-	public function __construct( string $title = '[unavailable]', $section = '[unavailable]' ) {
13
+	public function __construct ( string $title = '[unavailable]', $section = '[unavailable]' ) {
14 14
 		parent::__construct( "The section $section in the page $title doesn't exist." );
15 15
 	}
16 16
 }
Please login to merge, or discard this patch.