Passed
Push — master ( 393b08...0ea8f2 )
by Daimona
08:52
created
includes/Wiki/Controller.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\Wiki;
4 4
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @param string $domain The URL of the wiki, if different from default
29 29
 	 */
30
-	public function __construct( string $domain = DEFAULT_URL ) {
30
+	public function __construct ( string $domain = DEFAULT_URL ) {
31 31
 		$this->logger = new Logger;
32 32
 		$this->domain = $domain;
33 33
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @throws MissingPageException
42 42
 	 * @throws MissingSectionException
43 43
 	 */
44
-	public function getPageContent( string $title, int $section = null ) : string {
44
+	public function getPageContent ( string $title, int $section = null ) : string {
45 45
 		$msg = "Retrieving content of page $title" . ( $section !== null ? ", section $section" : '' );
46 46
 		$this->logger->debug( $msg );
47 47
 		$params = [
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		];
54 54
 
55 55
 		if ( $section !== null ) {
56
-			$params['rvsection'] = $section;
56
+			$params[ 'rvsection' ] = $section;
57 57
 		}
58 58
 
59 59
 		$req = RequestBase::newFromParams( $params )->setUrl( $this->domain );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			throw new MissingPageException( $title );
64 64
 		}
65 65
 
66
-		$mainSlot = $page->revisions[0]->slots->main;
66
+		$mainSlot = $page->revisions[ 0 ]->slots->main;
67 67
 
68 68
 		if ( $section !== null && isset( $mainSlot->nosuchsection ) ) {
69 69
 			throw new MissingSectionException( $title, $section );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param array $params
78 78
 	 * @throws EditException
79 79
 	 */
80
-	public function editPage( array $params ) {
80
+	public function editPage ( array $params ) {
81 81
 		$this->login();
82 82
 
83 83
 		$params = [
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		] + $params;
87 87
 
88 88
 		if ( Config::getInstance()->get( 'bot-edits' ) ) {
89
-			$params['bot'] = 1;
89
+			$params[ 'bot' ] = 1;
90 90
 		}
91 91
 
92 92
 		$res = RequestBase::newFromParams( $params )
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
108 108
 	 * @throws LoginException
109 109
 	 */
110
-	public function login() {
110
+	public function login () {
111 111
 		if ( self::$loggedIn ) {
112 112
 			return;
113 113
 		}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 		self::$loggedIn = true;
136 136
 		// Clear tokens cache
137
-		$this->tokens = [];
137
+		$this->tokens = [ ];
138 138
 		$this->logger->info( 'Login succeeded' );
139 139
 	}
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $type
145 145
 	 * @return string
146 146
 	 */
147
-	public function getToken( string $type ) : string {
147
+	public function getToken ( string $type ) : string {
148 148
 		if ( !isset( $this->tokens[ $type ] ) ) {
149 149
 			$params = [
150 150
 				'action' => 'query',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param string $title
168 168
 	 * @return int
169 169
 	 */
170
-	public function getPageCreationTS( string $title ) : int {
170
+	public function getPageCreationTS ( string $title ) : int {
171 171
 		$params = [
172 172
 			'action' => 'query',
173 173
 			'prop' => 'revisions',
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$res = RequestBase::newFromParams( $params )->setUrl( $this->domain )->execute();
182 182
 		$data = $res->query->pages;
183
-		return strtotime( reset( $data )->revisions[0]->timestamp );
183
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
184 184
 	}
185 185
 
186 186
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param string $title
190 190
 	 * @param string $reason
191 191
 	 */
192
-	public function protectPage( string $title, string $reason ) {
192
+	public function protectPage ( string $title, string $reason ) {
193 193
 		$this->logger->info( "Protecting page $title" );
194 194
 		$this->login();
195 195
 
Please login to merge, or discard this patch.