Passed
Push — master ( 766431...dd1fbc )
by Daimona
01:29
created
includes/PageRiconferma.php 1 patch
Spacing   +19 added lines, -19 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
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return string
23 23
 	 */
24
-	public function getUser() : string {
25
-		return explode( '/', $this->title )[2];
24
+	public function getUser () : string {
25
+		return explode( '/', $this->title )[ 2 ];
26 26
 	}
27 27
 
28 28
 	/**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return int
32 32
 	 */
33
-	public function getNum() : int {
33
+	public function getNum () : int {
34 34
 		$bits = explode( '/', $this->getTitle() );
35 35
 		return intval( end( $bits ) );
36 36
 	}
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return string
42 42
 	 */
43
-	public function getUserNum() : string {
44
-		return explode( '/', $this->getTitle(), 3 )[2];
43
+	public function getUserNum () : string {
44
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
45 45
 	}
46 46
 
47 47
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string
51 51
 	 */
52
-	public function getBaseTitle() : string {
52
+	public function getBaseTitle () : string {
53 53
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
54 54
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
55 55
 	}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return int
61 61
 	 */
62
-	public function getOpposingCount() : int {
62
+	public function getOpposingCount () : int {
63 63
 		return $this->getCountForSection( self::SECTION_OPPOSE );
64 64
 	}
65 65
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @return int
70 70
 	 */
71
-	public function getSupportCount() : int {
71
+	public function getSupportCount () : int {
72 72
 		return $this->getCountForSection( self::SECTION_SUPPORT );
73 73
 	}
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param int $secNum
79 79
 	 * @return int
80 80
 	 */
81
-	protected function getCountForSection( int $secNum ) : int {
81
+	protected function getCountForSection ( int $secNum ) : int {
82 82
 		$content = $this->controller->getPageContent( $this->title, $secNum );
83 83
 		// Let's hope that this is good enough...
84 84
 		return substr_count( $content, "\n\# *(?![#*])" );
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return int
91 91
 	 */
92
-	protected function getQuorum() : int {
92
+	protected function getQuorum () : int {
93 93
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
94
-		$matches = [];
94
+		$matches = [ ];
95 95
 		preg_match( $reg, $this->getContent(), $matches );
96
-		return intval( $matches[1] );
96
+		return intval( $matches[ 1 ] );
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return bool
103 103
 	 */
104
-	public function hasOpposition() : bool {
104
+	public function hasOpposition () : bool {
105 105
 		return $this->getOpposingCount() >= 15;
106 106
 	}
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return int One of the OUTCOME_* constants
112 112
 	 * @throws \BadMethodCallException
113 113
 	 */
114
-	public function getOutcome() : int {
114
+	public function getOutcome () : int {
115 115
 		if ( !$this->isVote() ) {
116 116
 			throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' );
117 117
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @throws \BadMethodCallException
132 132
 	 * @throws \LogicException
133 133
 	 */
134
-	public function getOutcomeText() : string {
134
+	public function getOutcomeText () : string {
135 135
 		if ( !$this->isVote() ) {
136 136
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
137 137
 		}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return bool
167 167
 	 */
168
-	public function isVote() : bool {
168
+	public function isVote () : bool {
169 169
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
170 170
 		return preg_match( $sectionReg, $this->getContent() ) === false;
171 171
 	}
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return int
177 177
 	 */
178
-	public function getEndTimestamp() : int {
178
+	public function getEndTimestamp () : int {
179 179
 		if ( $this->isVote() ) {
180
-			$matches = [];
180
+			$matches = [ ];
181 181
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
182 182
 			preg_match( $reg, $this->getContent(), $matches );
183 183
 			list( , $day, $hours ) = $matches;
Please login to merge, or discard this patch.
includes/Task/Subtask/ArchivePages.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\Task\Subtask;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	/**
14 14
 	 * @inheritDoc
15 15
 	 */
16
-	public function run() : TaskResult {
16
+	public function run () : TaskResult {
17 17
 		$this->getLogger()->info( 'Starting task ArchivePages' );
18 18
 
19 19
 		$pages = $this->getDataProvider()->getPagesToClose();
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 	 * @param PageRiconferma[] $pages
31 31
 	 * @see UpdatesAround::addToMainPage()
32 32
 	 */
33
-	protected function removeFromMainPage( array $pages ) {
33
+	protected function removeFromMainPage ( array $pages ) {
34 34
 		$this->getLogger()->info(
35 35
 			'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) )
36 36
 		);
37 37
 
38 38
 		$mainPage = new Page( $this->getConfig()->get( 'ric-main-page' ) );
39
-		$remove = [];
39
+		$remove = [ ];
40 40
 		foreach ( $pages as $page ) {
41
-			$remove[] = '{{' . $page->getTitle() . '}}';
41
+			$remove[ ] = '{{' . $page->getTitle() . '}}';
42 42
 		}
43 43
 
44 44
 		$mainPage->edit( [
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param PageRiconferma[] $pages
54 54
 	 */
55
-	protected function addToArchive( array $pages ) {
55
+	protected function addToArchive ( array $pages ) {
56 56
 		$this->getLogger()->info(
57 57
 			'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) )
58 58
 		);
59 59
 
60
-		$simple = $votes = [];
60
+		$simple = $votes = [ ];
61 61
 		foreach ( $pages as $page ) {
62 62
 			if ( $page->isVote() ) {
63
-				$votes[] = $page;
63
+				$votes[ ] = $page;
64 64
 			} else {
65
-				$simple[] = $page;
65
+				$simple[ ] = $page;
66 66
 			}
67 67
 		}
68 68
 
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 	 * @param string $archiveTitle
80 80
 	 * @param array $pages
81 81
 	 */
82
-	private function reallyAddToArchive( string $archiveTitle, array $pages ) {
82
+	private function reallyAddToArchive ( string $archiveTitle, array $pages ) {
83 83
 		$archivePage = new Page( "$archiveTitle/" . date( 'Y' ) );
84 84
 
85 85
 		$append = '';
86
-		$archivedList = [];
86
+		$archivedList = [ ];
87 87
 		foreach ( $pages as $page ) {
88 88
 			$append .= '{{' . $page->getTitle() . "}}\n";
89
-			$archivedList[] = $page->getUserNum();
89
+			$archivedList[ ] = $page->getUserNum();
90 90
 		}
91 91
 
92 92
 		if ( count( $archivedList ) > 1 ) {
93 93
 			$last = array_pop( $archivedList );
94 94
 			$userNums = implode( ', ', $archivedList ) . " e $last";
95 95
 		} else {
96
-			$userNums = $archivedList[0];
96
+			$userNums = $archivedList[ 0 ];
97 97
 		}
98 98
 
99 99
 		$summary = $this->msg( 'close-archive-summary' )
Please login to merge, or discard this patch.