Passed
Push — master ( 591692...e26f3b )
by Daimona
01:45
created
includes/PageRiconferma.php 1 patch
Spacing   +16 added lines, -16 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
 	 * @param string $title
20 20
 	 * @param WikiController $controller
21 21
 	 */
22
-	public function __construct( string $title, WikiController $controller ) {
22
+	public function __construct ( string $title, WikiController $controller ) {
23 23
 		$this->title = $title;
24 24
 		$this->controller = $controller;
25 25
 	}
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @return string
29 29
 	 */
30
-	public function getTitle() : string {
30
+	public function getTitle () : string {
31 31
 		return $this->title;
32 32
 	}
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return string
38 38
 	 */
39
-	public function getUser() : string {
40
-		return explode( '/', $this->title )[2];
39
+	public function getUser () : string {
40
+		return explode( '/', $this->title )[ 2 ];
41 41
 	}
42 42
 
43 43
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return int
47 47
 	 */
48
-	public function getNum() : int {
48
+	public function getNum () : int {
49 49
 		$bits = explode( '/', $this->getTitle() );
50 50
 		return intval( end( $bits ) );
51 51
 	}
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return string
57 57
 	 */
58
-	public function getUserNum() : string {
59
-		return explode( '/', $this->getTitle(), 3 )[2];
58
+	public function getUserNum () : string {
59
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
60 60
 	}
61 61
 
62 62
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function getBaseTitle() : string {
67
+	public function getBaseTitle () : string {
68 68
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
69 69
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
70 70
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return string
76 76
 	 */
77
-	public function getContent() : string {
77
+	public function getContent () : string {
78 78
 		if ( $this->content === null ) {
79 79
 			$this->content = $this->controller->getPageContent( $this->title );
80 80
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return bool
88 88
 	 */
89
-	public function hasOpposition() : bool {
89
+	public function hasOpposition () : bool {
90 90
 		$params = [
91 91
 			'action' => 'query',
92 92
 			'prop' => 'revisions',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		];
98 98
 		$res = RequestBase::newFromParams( $params )->execute();
99 99
 		$page = reset( $res->query->pages );
100
-		$content = $page->revisions[0]->slots->main->{ '*' };
100
+		$content = $page->revisions[ 0 ]->slots->main->{ '*' };
101 101
 		// Let's hope that this is good enough...
102 102
 		$votes = substr_count( $content, "\n\# *(?![#*])" );
103 103
 		return $votes >= 15;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public function isVote() : bool {
111
+	public function isVote () : bool {
112 112
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
113 113
 		return preg_match( $sectionReg, $this->getContent() ) === false;
114 114
 	}
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return int
120 120
 	 */
121
-	public function getEndTimestamp() : int {
121
+	public function getEndTimestamp () : int {
122 122
 		if ( $this->isVote() ) {
123
-			$matches = [];
123
+			$matches = [ ];
124 124
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
125 125
 			preg_match( $reg, $this->getContent(), $matches );
126 126
 			list( , $day, $hours ) = $matches;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 	}
134 134
 
135
-	public function __toString() {
135
+	public function __toString () {
136 136
 		return $this->getTitle();
137 137
 	}
138 138
 }
Please login to merge, or discard this patch.