Passed
Push — master ( 2f436c...0d0277 )
by Daimona
02:05
created
includes/Wiki/Wiki.php 1 patch
Spacing   +19 added lines, -19 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
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @param LoggerInterface $logger
37 37
 	 * @param RequestFactory $requestFactory
38 38
 	 */
39
-	public function __construct(
39
+	public function __construct (
40 40
 		LoginInfo $li,
41 41
 		LoggerInterface $logger,
42 42
 		RequestFactory $requestFactory
@@ -49,35 +49,35 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * @return LoginInfo
51 51
 	 */
52
-	public function getLoginInfo() : LoginInfo {
52
+	public function getLoginInfo () : LoginInfo {
53 53
 		return $this->loginInfo;
54 54
 	}
55 55
 
56 56
 	/**
57 57
 	 * @return RequestFactory
58 58
 	 */
59
-	public function getRequestFactory() : RequestFactory {
59
+	public function getRequestFactory () : RequestFactory {
60 60
 		return $this->requestFactory;
61 61
 	}
62 62
 
63 63
 	/**
64 64
 	 * @param string $prefix
65 65
 	 */
66
-	public function setPagePrefix( string $prefix ) : void {
66
+	public function setPagePrefix ( string $prefix ) : void {
67 67
 		$this->pagePrefix = $prefix;
68 68
 	}
69 69
 
70 70
 	/**
71 71
 	 * @param string $ident
72 72
 	 */
73
-	public function setLocalUserIdentifier( string $ident ) : void {
73
+	public function setLocalUserIdentifier ( string $ident ) : void {
74 74
 		$this->localUserIdentifier = $ident;
75 75
 	}
76 76
 
77 77
 	/**
78 78
 	 * @return string
79 79
 	 */
80
-	public function getLocalUserIdentifier() : string {
80
+	public function getLocalUserIdentifier () : string {
81 81
 		return $this->localUserIdentifier;
82 82
 	}
83 83
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @throws MissingPageException
91 91
 	 * @throws MissingSectionException
92 92
 	 */
93
-	public function getPageContent( string $title, int $section = null ) : string {
93
+	public function getPageContent ( string $title, int $section = null ) : string {
94 94
 		$fullTitle = $this->pagePrefix . $title;
95 95
 		$msg = "Retrieving content of $fullTitle" . ( $section !== null ? ", section $section" : '' );
96 96
 		$this->logger->info( $msg );
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		];
104 104
 
105 105
 		if ( $section !== null ) {
106
-			$params['rvsection'] = $section;
106
+			$params[ 'rvsection' ] = $section;
107 107
 		}
108 108
 
109 109
 		$req = $this->buildRequest( $params );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			throw new MissingPageException( $title );
114 114
 		}
115 115
 
116
-		$mainSlot = $page->revisions[0]->slots->main;
116
+		$mainSlot = $page->revisions[ 0 ]->slots->main;
117 117
 
118 118
 		if ( $section !== null && isset( $mainSlot->nosuchsection ) ) {
119 119
 			throw new MissingSectionException( $title, $section );
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param array $params
128 128
 	 * @throws EditException
129 129
 	 */
130
-	public function editPage( array $params ) : void {
130
+	public function editPage ( array $params ) : void {
131 131
 		$this->login();
132 132
 
133 133
 		$params = [
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		] + $params;
137 137
 
138 138
 		if ( BOT_EDITS === true ) {
139
-			$params['bot'] = 1;
139
+			$params[ 'bot' ] = 1;
140 140
 		}
141 141
 
142 142
 		$res = $this->buildRequest( $params )->setPost()->execute();
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
155 155
 	 * @throws LoginException
156 156
 	 */
157
-	public function login() : void {
157
+	public function login () : void {
158 158
 		if ( $this->loginInfo === null ) {
159 159
 			throw new CannotLoginException( 'Missing login data' );
160 160
 		}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
 		$this->loggedIn = true;
186 186
 		// Clear tokens cache
187
-		$this->tokens = [];
187
+		$this->tokens = [ ];
188 188
 		$this->logger->info( 'Login succeeded' );
189 189
 	}
190 190
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @param string $type
195 195
 	 * @return string
196 196
 	 */
197
-	public function getToken( string $type ) : string {
197
+	public function getToken ( string $type ) : string {
198 198
 		if ( !isset( $this->tokens[ $type ] ) ) {
199 199
 			$params = [
200 200
 				'action' => 'query',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @param string $title
218 218
 	 * @return int
219 219
 	 */
220
-	public function getPageCreationTS( string $title ) : int {
220
+	public function getPageCreationTS ( string $title ) : int {
221 221
 		$params = [
222 222
 			'action' => 'query',
223 223
 			'prop' => 'revisions',
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$res = $this->buildRequest( $params )->execute();
232 232
 		$data = $res->query->pages;
233
-		return strtotime( reset( $data )->revisions[0]->timestamp );
233
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
234 234
 	}
235 235
 
236 236
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @param string $title
240 240
 	 * @param string $reason
241 241
 	 */
242
-	public function protectPage( string $title, string $reason ) : void {
242
+	public function protectPage ( string $title, string $reason ) : void {
243 243
 		$fullTitle = $this->pagePrefix . $title;
244 244
 		$this->logger->info( "Protecting page $fullTitle" );
245 245
 		$this->login();
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @param array $params
262 262
 	 * @return RequestBase
263 263
 	 */
264
-	private function buildRequest( array $params ) : RequestBase {
264
+	private function buildRequest ( array $params ) : RequestBase {
265 265
 		return $this->requestFactory->newFromParams( $params );
266 266
 	}
267 267
 }
Please login to merge, or discard this patch.