Passed
Push — master ( 3cc4a0...9623d2 )
by Daimona
08:26
created
includes/Wiki/Wiki.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\Wiki;
4 4
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param LoggerInterface $logger
35 35
 	 * @param RequestFactory $requestFactory
36 36
 	 */
37
-	public function __construct(
37
+	public function __construct (
38 38
 		LoginInfo $li,
39 39
 		LoggerInterface $logger,
40 40
 		RequestFactory $requestFactory
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 	/**
48 48
 	 * @return LoginInfo
49 49
 	 */
50
-	public function getLoginInfo() : LoginInfo {
50
+	public function getLoginInfo () : LoginInfo {
51 51
 		return $this->loginInfo;
52 52
 	}
53 53
 
54 54
 	/**
55 55
 	 * @return RequestFactory
56 56
 	 */
57
-	public function getRequestFactory() : RequestFactory {
57
+	public function getRequestFactory () : RequestFactory {
58 58
 		return $this->requestFactory;
59 59
 	}
60 60
 
61 61
 	/**
62 62
 	 * @param string $ident
63 63
 	 */
64
-	public function setLocalUserIdentifier( string $ident ) : void {
64
+	public function setLocalUserIdentifier ( string $ident ) : void {
65 65
 		$this->localUserIdentifier = $ident;
66 66
 	}
67 67
 
68 68
 	/**
69 69
 	 * @return string
70 70
 	 */
71
-	public function getLocalUserIdentifier() : string {
71
+	public function getLocalUserIdentifier () : string {
72 72
 		return $this->localUserIdentifier;
73 73
 	}
74 74
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @throws MissingPageException
82 82
 	 * @throws MissingSectionException
83 83
 	 */
84
-	public function getPageContent( string $title, int $section = null ) : string {
84
+	public function getPageContent ( string $title, int $section = null ) : string {
85 85
 		$msg = "Retrieving content of $title" . ( $section !== null ? ", section $section" : '' );
86 86
 		$this->logger->debug( $msg );
87 87
 		$params = [
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		];
94 94
 
95 95
 		if ( $section !== null ) {
96
-			$params['rvsection'] = $section;
96
+			$params[ 'rvsection' ] = $section;
97 97
 		}
98 98
 
99 99
 		$req = $this->buildRequest( $params );
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			throw new MissingPageException( $title );
104 104
 		}
105 105
 
106
-		$mainSlot = $page->revisions[0]->slots->main;
106
+		$mainSlot = $page->revisions[ 0 ]->slots->main;
107 107
 
108 108
 		if ( $section !== null && isset( $mainSlot->nosuchsection ) ) {
109 109
 			throw new MissingSectionException( $title, $section );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param array $params
118 118
 	 * @throws EditException
119 119
 	 */
120
-	public function editPage( array $params ) : void {
120
+	public function editPage ( array $params ) : void {
121 121
 		$this->login();
122 122
 
123 123
 		$params = [
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		] + $params;
127 127
 
128 128
 		if ( BOT_EDITS === true ) {
129
-			$params['bot'] = 1;
129
+			$params[ 'bot' ] = 1;
130 130
 		}
131 131
 
132 132
 		$res = $this->buildRequest( $params )->setPost()->execute();
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
145 145
 	 * @throws LoginException
146 146
 	 */
147
-	public function login() : void {
147
+	public function login () : void {
148 148
 		if ( $this->loginInfo === null ) {
149 149
 			throw new CannotLoginException( 'Missing login data' );
150 150
 		}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 		self::$loggedIn = true;
176 176
 		// Clear tokens cache
177
-		$this->tokens = [];
177
+		$this->tokens = [ ];
178 178
 		$this->logger->info( 'Login succeeded' );
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 * @param string $type
185 185
 	 * @return string
186 186
 	 */
187
-	public function getToken( string $type ) : string {
187
+	public function getToken ( string $type ) : string {
188 188
 		if ( !isset( $this->tokens[ $type ] ) ) {
189 189
 			$params = [
190 190
 				'action' => 'query',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param string $title
208 208
 	 * @return int
209 209
 	 */
210
-	public function getPageCreationTS( string $title ) : int {
210
+	public function getPageCreationTS ( string $title ) : int {
211 211
 		$params = [
212 212
 			'action' => 'query',
213 213
 			'prop' => 'revisions',
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
 		$res = $this->buildRequest( $params )->execute();
222 222
 		$data = $res->query->pages;
223
-		return strtotime( reset( $data )->revisions[0]->timestamp );
223
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
224 224
 	}
225 225
 
226 226
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @param string $title
230 230
 	 * @param string $reason
231 231
 	 */
232
-	public function protectPage( string $title, string $reason ) : void {
232
+	public function protectPage ( string $title, string $reason ) : void {
233 233
 		$this->logger->info( "Protecting page $title" );
234 234
 		$this->login();
235 235
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @param array $params
251 251
 	 * @return RequestBase
252 252
 	 */
253
-	private function buildRequest( array $params ) : RequestBase {
253
+	private function buildRequest ( array $params ) : RequestBase {
254 254
 		return $this->requestFactory->newFromParams( $params );
255 255
 	}
256 256
 }
Please login to merge, or discard this patch.