Passed
Push — master ( 4aa823...68f7f1 )
by Daimona
01:25
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 = 3;
14 14
 	private $opposeSection = 4;
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;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @param string $title
31 31
 	 */
32
-	public function __construct( string $title ) {
32
+	public function __construct ( string $title ) {
33 33
 		parent::__construct( $title );
34 34
 		$this->supportSection = $this->isVote() ? 3 : 0;
35 35
 		$this->opposeSection = $this->isVote() ? 4 : 3;
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return User
42 42
 	 */
43
-	public function getUser() : User {
44
-		$name = explode( '/', $this->title )[2];
43
+	public function getUser () : User {
44
+		$name = explode( '/', $this->title )[ 2 ];
45 45
 		return new User( $name );
46 46
 	}
47 47
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return int
52 52
 	 */
53
-	public function getNum() : int {
53
+	public function getNum () : int {
54 54
 		$bits = explode( '/', $this->getTitle() );
55 55
 		return intval( end( $bits ) );
56 56
 	}
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return string
62 62
 	 */
63
-	public function getUserNum() : string {
64
-		return explode( '/', $this->getTitle(), 3 )[2];
63
+	public function getUserNum () : string {
64
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
65 65
 	}
66 66
 
67 67
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return string
71 71
 	 */
72
-	public function getBaseTitle() : string {
72
+	public function getBaseTitle () : string {
73 73
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
74 74
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
75 75
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return int
81 81
 	 */
82
-	public function getOpposingCount() : int {
82
+	public function getOpposingCount () : int {
83 83
 		return $this->getCountForSection( $this->opposeSection );
84 84
 	}
85 85
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return int
90 90
 	 * @throws \BadMethodCallException
91 91
 	 */
92
-	public function getSupportCount() : int {
92
+	public function getSupportCount () : int {
93 93
 		if ( !$this->isVote() ) {
94 94
 			throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' );
95 95
 		}
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 	 * @param int $secNum
103 103
 	 * @return int
104 104
 	 */
105
-	protected function getCountForSection( int $secNum ) : int {
105
+	protected function getCountForSection ( int $secNum ) : int {
106 106
 		if ( !isset( $this->sectionCounts[ $secNum ] ) ) {
107 107
 			$content = $this->controller->getPageContent( $this->title, $secNum );
108 108
 			// Let's hope that this is good enough...
109
-			$this->sectionCounts[$secNum] = preg_match_all( "/^\# *(?![# *]|\.\.\.$)/m", $content );
109
+			$this->sectionCounts[ $secNum ] = preg_match_all( "/^\# *(?![# *]|\.\.\.$)/m", $content );
110 110
 		}
111
-		return $this->sectionCounts[$secNum];
111
+		return $this->sectionCounts[ $secNum ];
112 112
 	}
113 113
 
114 114
 	/**
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return int
118 118
 	 */
119
-	protected function getQuorum() : int {
119
+	protected function getQuorum () : int {
120 120
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
121
-		return intval( $this->getMatch( $reg )[1] );
121
+		return intval( $this->getMatch( $reg )[ 1 ] );
122 122
 	}
123 123
 
124 124
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return bool
128 128
 	 */
129
-	public function hasOpposition() : bool {
129
+	public function hasOpposition () : bool {
130 130
 		return $this->getOpposingCount() >= self::REQUIRED_OPPOSE;
131 131
 	}
132 132
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return int One of the OUTCOME_* constants
137 137
 	 */
138
-	public function getOutcome() : int {
138
+	public function getOutcome () : int {
139 139
 		if ( !$this->isVote() ) {
140 140
 			return self::OUTCOME_OK;
141 141
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @throws \BadMethodCallException
156 156
 	 * @throws \LogicException
157 157
 	 */
158
-	public function getOutcomeText() : string {
158
+	public function getOutcomeText () : string {
159 159
 		if ( !$this->isVote() ) {
160 160
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
161 161
 		}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return bool
191 191
 	 */
192
-	public function isVote() : bool {
192
+	public function isVote () : bool {
193 193
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
194 194
 		return !$this->matches( $sectionReg );
195 195
 	}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return int
201 201
 	 */
202
-	public function getCreationTimestamp() : int {
202
+	public function getCreationTimestamp () : int {
203 203
 		return $this->controller->getPageCreationTS( $this->title );
204 204
 	}
205 205
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return int
209 209
 	 */
210
-	public function getEndTimestamp() : int {
210
+	public function getEndTimestamp () : int {
211 211
 		if ( $this->isVote() ) {
212 212
 			$reg = "!La votazione ha inizio il.+ alle ore ([\d:]+) e ha termine il (.+) alla stessa ora!";
213 213
 			list( , $hours, $day ) = $this->getMatch( $reg );
Please login to merge, or discard this patch.