Passed
Push — master ( 148f21...393b08 )
by Daimona
01:35
created
includes/Wiki/Page/PageRiconferma.php 1 patch
Spacing   +22 added lines, -22 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
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	private $supportSection;
14 14
 	private $opposeSection;
15 15
 	/** @var array Counts of votes for each section */
16
-	private $sectionCounts = [];
16
+	private $sectionCounts = [ ];
17 17
 
18 18
 	// Possible outcomes of a vote
19 19
 	const OUTCOME_OK = 0;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * because they can vary depending on whether the page is a vote, which is relatively
33 33
 	 * expensive to know since it requires parsing the content of the page.
34 34
 	 */
35
-	private function defineSections() {
35
+	private function defineSections () {
36 36
 		$this->supportSection = $this->isVote() ? 3 : 0;
37 37
 		$this->opposeSection = $this->isVote() ? 4 : 3;
38 38
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return User
44 44
 	 */
45
-	public function getUser() : User {
46
-		$name = explode( '/', $this->title )[2];
45
+	public function getUser () : User {
46
+		$name = explode( '/', $this->title )[ 2 ];
47 47
 		return new User( $name );
48 48
 	}
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return int
54 54
 	 */
55
-	public function getNum() : int {
55
+	public function getNum () : int {
56 56
 		$bits = explode( '/', $this->getTitle() );
57 57
 		return intval( end( $bits ) );
58 58
 	}
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string
64 64
 	 */
65
-	public function getUserNum() : string {
66
-		return explode( '/', $this->getTitle(), 3 )[2];
65
+	public function getUserNum () : string {
66
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
67 67
 	}
68 68
 
69 69
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return string
73 73
 	 */
74
-	public function getBaseTitle() : string {
74
+	public function getBaseTitle () : string {
75 75
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
76 76
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
77 77
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return int
83 83
 	 */
84
-	public function getOpposingCount() : int {
84
+	public function getOpposingCount () : int {
85 85
 		$this->defineSections();
86 86
 		return $this->getCountForSection( $this->opposeSection );
87 87
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return int
93 93
 	 * @throws \BadMethodCallException
94 94
 	 */
95
-	public function getSupportCount() : int {
95
+	public function getSupportCount () : int {
96 96
 		if ( !$this->isVote() ) {
97 97
 			throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' );
98 98
 		}
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	 * @param int $secNum
107 107
 	 * @return int
108 108
 	 */
109
-	protected function getCountForSection( int $secNum ) : int {
109
+	protected function getCountForSection ( int $secNum ) : int {
110 110
 		if ( !isset( $this->sectionCounts[ $secNum ] ) ) {
111 111
 			$content = $this->controller->getPageContent( $this->title, $secNum );
112 112
 			// Let's hope that this is good enough...
113
-			$this->sectionCounts[$secNum] = preg_match_all( "/^\# *(?![# *:]|\.\.\.$)/m", $content );
113
+			$this->sectionCounts[ $secNum ] = preg_match_all( "/^\# *(?![# *:]|\.\.\.$)/m", $content );
114 114
 		}
115
-		return $this->sectionCounts[$secNum];
115
+		return $this->sectionCounts[ $secNum ];
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @return int
122 122
 	 */
123
-	protected function getQuorum() : int {
123
+	protected function getQuorum () : int {
124 124
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
125
-		return intval( $this->getMatch( $reg )[1] );
125
+		return intval( $this->getMatch( $reg )[ 1 ] );
126 126
 	}
127 127
 
128 128
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return bool
132 132
 	 */
133
-	public function hasOpposition() : bool {
133
+	public function hasOpposition () : bool {
134 134
 		return $this->getOpposingCount() >= self::REQUIRED_OPPOSE;
135 135
 	}
136 136
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @return int One of the OUTCOME_* constants
141 141
 	 */
142
-	public function getOutcome() : int {
142
+	public function getOutcome () : int {
143 143
 		if ( !$this->isVote() ) {
144 144
 			return self::OUTCOME_OK;
145 145
 		}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * @throws \BadMethodCallException
163 163
 	 * @throws \LogicException
164 164
 	 */
165
-	public function getOutcomeText() : string {
165
+	public function getOutcomeText () : string {
166 166
 		if ( !$this->isVote() ) {
167 167
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
168 168
 		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return bool
198 198
 	 */
199
-	public function isVote() : bool {
199
+	public function isVote () : bool {
200 200
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
201 201
 		return !$this->matches( $sectionReg );
202 202
 	}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return int
208 208
 	 */
209
-	public function getCreationTimestamp() : int {
209
+	public function getCreationTimestamp () : int {
210 210
 		return $this->controller->getPageCreationTS( $this->title );
211 211
 	}
212 212
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return int
217 217
 	 */
218
-	public function getEndTimestamp() : int {
218
+	public function getEndTimestamp () : int {
219 219
 		if ( $this->isVote() ) {
220 220
 			$reg = "!La votazione ha inizio il.+ alle ore ([\d:]+) e ha termine il (.+) alla stessa ora!";
221 221
 			list( , $hours, $day ) = $this->getMatch( $reg );
Please login to merge, or discard this patch.