Passed
Push — master ( df8555...a1b33e )
by Daimona
02:22 queued 28s
created
includes/Wiki/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\Wiki\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/Wiki/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\Wiki\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/Page/PageBotList.php 1 patch
Spacing   +4 added lines, -4 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\Page;
4 4
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @private Use self::get()
13 13
 	 */
14
-	public function __construct() {
14
+	public function __construct () {
15 15
 		parent::__construct( Config::getInstance()->get( 'list-title' ) );
16 16
 	}
17 17
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return self
22 22
 	 */
23
-	public static function get() : self {
23
+	public static function get () : self {
24 24
 		static $instance = null;
25 25
 		if ( $instance === null ) {
26 26
 			$instance = new self;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return array[]
35 35
 	 */
36
-	public function getAdminsList() : array {
36
+	public function getAdminsList () : array {
37 37
 		return json_decode( $this->getContent(), true );
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.