Passed
Push — master ( ba2710...df8555 )
by Daimona
01:51
created
includes/ContextSource.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	/** @var Controller */
20 20
 	private $controller;
21 21
 
22
-	public function __construct() {
22
+	public function __construct () {
23 23
 		$this->setLogger( new Logger );
24 24
 		$this->setConfig( Config::getInstance() );
25 25
 		$this->setController( new Controller );
@@ -28,42 +28,42 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @return LoggerInterface
30 30
 	 */
31
-	protected function getLogger() : LoggerInterface {
31
+	protected function getLogger () : LoggerInterface {
32 32
 		return $this->logger;
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @inheritDoc
37 37
 	 */
38
-	public function setLogger( LoggerInterface $logger ) {
38
+	public function setLogger ( LoggerInterface $logger ) {
39 39
 		$this->logger = $logger;
40 40
 	}
41 41
 
42 42
 	/**
43 43
 	 * @return Config
44 44
 	 */
45
-	protected function getConfig() : Config {
45
+	protected function getConfig () : Config {
46 46
 		return $this->config;
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * @param Config $cfg
51 51
 	 */
52
-	protected function setConfig( Config $cfg ) {
52
+	protected function setConfig ( Config $cfg ) {
53 53
 		$this->config = $cfg;
54 54
 	}
55 55
 
56 56
 	/**
57 57
 	 * @return Controller
58 58
 	 */
59
-	protected function getController() : Controller {
59
+	protected function getController () : Controller {
60 60
 		return $this->controller;
61 61
 	}
62 62
 
63 63
 	/**
64 64
 	 * @param Controller $controller
65 65
 	 */
66
-	protected function setController( Controller $controller ) {
66
+	protected function setController ( Controller $controller ) {
67 67
 		$this->controller = $controller;
68 68
 	}
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param string $key
74 74
 	 * @return Message
75 75
 	 */
76
-	protected function msg( string $key ) : Message {
76
+	protected function msg ( string $key ) : Message {
77 77
 		return new Message( $key );
78 78
 	}
79 79
 }
Please login to merge, or discard this patch.
includes/Page/Page.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\Page;
4 4
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param string $title
21 21
 	 * @param string $domain The site where the page lives, if different from default
22 22
 	 */
23
-	public function __construct( string $title, string $domain = DEFAULT_URL ) {
23
+	public function __construct ( string $title, string $domain = DEFAULT_URL ) {
24 24
 		$this->title = $title;
25 25
 		$this->controller = new Controller( $domain );
26 26
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @return string
30 30
 	 */
31
-	public function getTitle() : string {
31
+	public function getTitle () : string {
32 32
 		return $this->title;
33 33
 	}
34 34
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param int|null $section A section number to retrieve the content of that section
39 39
 	 * @return string
40 40
 	 */
41
-	public function getContent( int $section = null ) : string {
41
+	public function getContent ( int $section = null ) : string {
42 42
 		if ( $this->content === null ) {
43 43
 			$this->content = $this->controller->getPageContent( $this->title, $section );
44 44
 		}
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param array $params
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->controller->editPage( $params );
59
-		if ( isset( $params['text'] ) ) {
60
-			$this->content = $params['text'];
61
-		} elseif ( isset( $params['appendtext'] ) ) {
62
-			$this->content .= $params['appendtext'];
59
+		if ( isset( $params[ 'text' ] ) ) {
60
+			$this->content = $params[ 'text' ];
61
+		} elseif ( isset( $params[ 'appendtext' ] ) ) {
62
+			$this->content .= $params[ 'appendtext' ];
63 63
 		} else {
64 64
 			// Clear the cache anyway
65 65
 			( new Logger )->warning( 'Resetting content cache. Params: ' . var_export( $params, true ) );
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param string $regex
74 74
 	 * @return bool
75 75
 	 */
76
-	public function matches( string $regex ) : bool {
76
+	public function matches ( string $regex ) : bool {
77 77
 		return (bool)preg_match( $regex, $this->getContent() );
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return string[]
86 86
 	 * @throws \Exception
87 87
 	 */
88
-	public function getMatch( string $regex ) : array {
89
-		$ret = [];
88
+	public function getMatch ( string $regex ) : array {
89
+		$ret = [ ];
90 90
 		if ( preg_match( $regex, $this->getContent(), $ret ) === 0 ) {
91 91
 			throw new \Exception( 'The content does not match the given regex' );
92 92
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return string
100 100
 	 */
101
-	public function __toString() {
101
+	public function __toString () {
102 102
 		return $this->getTitle();
103 103
 	}
104 104
 }
Please login to merge, or discard this patch.
includes/Wiki/Controller.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\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
 	}
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return string
41 41
 	 * @throws MissingPageException
42 42
 	 */
43
-	public function getPageContent( string $title, int $section = null ) : string {
43
+	public function getPageContent ( string $title, int $section = null ) : string {
44 44
 		$this->logger->debug( "Retrieving content of page $title" );
45 45
 		$params = [
46 46
 			'action' => 'query',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		];
52 52
 
53 53
 		if ( $section !== null ) {
54
-			$params['rvsection'] = $section;
54
+			$params[ 'rvsection' ] = $section;
55 55
 		}
56 56
 
57 57
 		$req = RequestBase::newFromParams( $params )->setUrl( $this->domain );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			throw new MissingPageException( $title );
62 62
 		}
63 63
 
64
-		$mainSlot = $page->revisions[0]->slots->main;
64
+		$mainSlot = $page->revisions[ 0 ]->slots->main;
65 65
 
66 66
 		if ( $section !== null && isset( $mainSlot->nosuchsection ) ) {
67 67
 			throw new MissingSectionException( $title, $section );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param array $params
76 76
 	 * @throws EditException
77 77
 	 */
78
-	public function editPage( array $params ) {
78
+	public function editPage ( array $params ) {
79 79
 		$this->login();
80 80
 
81 81
 		$params = [
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
98 98
 	 * @throws LoginException
99 99
 	 */
100
-	public function login() {
100
+	public function login () {
101 101
 		if ( self::$loggedIn ) {
102 102
 			$this->logger->debug( 'Already logged in' );
103 103
 			return;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		self::$loggedIn = true;
126 126
 		// Clear tokens cache
127
-		$this->tokens = [];
127
+		$this->tokens = [ ];
128 128
 		$this->logger->info( 'Login succeeded' );
129 129
 	}
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param string $type
135 135
 	 * @return string
136 136
 	 */
137
-	public function getToken( string $type ) : string {
137
+	public function getToken ( string $type ) : string {
138 138
 		if ( !isset( $this->tokens[ $type ] ) ) {
139 139
 			$params = [
140 140
 				'action' => 'query',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param string $title
158 158
 	 * @return int
159 159
 	 */
160
-	public function getPageCreationTS( string $title ) : int {
160
+	public function getPageCreationTS ( string $title ) : int {
161 161
 		$params = [
162 162
 			'action' => 'query',
163 163
 			'prop' => 'revisions',
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$res = RequestBase::newFromParams( $params )->setUrl( $this->domain )->execute();
172 172
 		$data = $res->query->pages;
173
-		return strtotime( reset( $data )->revisions[0]->timestamp );
173
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
174 174
 	}
175 175
 
176 176
 	/**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param string $title
180 180
 	 * @param string $reason
181 181
 	 */
182
-	public function protectPage( string $title, string $reason ) {
182
+	public function protectPage ( string $title, string $reason ) {
183 183
 		$this->logger->info( "Protecting page $title" );
184 184
 		$this->login();
185 185
 
Please login to merge, or discard this patch.