Passed
Push — master ( a1b33e...10aa7b )
by Daimona
01:45
created
includes/ContextSource.php 1 patch
Spacing   +9 added lines, -9 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
 	/** @var Controller */
20 20
 	private $controller;
21 21
 
22
-	public function __construct() {
22
+	public function __construct () {
23 23
 		$this->setLogger( new Logger );
24 24
 		$this->setConfig( Config::getInstance() );
25 25
 		$this->setController( new Controller );
@@ -28,42 +28,42 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @return LoggerInterface
30 30
 	 */
31
-	protected function getLogger() : LoggerInterface {
31
+	protected function getLogger () : LoggerInterface {
32 32
 		return $this->logger;
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @inheritDoc
37 37
 	 */
38
-	public function setLogger( LoggerInterface $logger ) {
38
+	public function setLogger ( LoggerInterface $logger ) {
39 39
 		$this->logger = $logger;
40 40
 	}
41 41
 
42 42
 	/**
43 43
 	 * @return Config
44 44
 	 */
45
-	protected function getConfig() : Config {
45
+	protected function getConfig () : Config {
46 46
 		return $this->config;
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * @param Config $cfg
51 51
 	 */
52
-	protected function setConfig( Config $cfg ) {
52
+	protected function setConfig ( Config $cfg ) {
53 53
 		$this->config = $cfg;
54 54
 	}
55 55
 
56 56
 	/**
57 57
 	 * @return Controller
58 58
 	 */
59
-	protected function getController() : Controller {
59
+	protected function getController () : Controller {
60 60
 		return $this->controller;
61 61
 	}
62 62
 
63 63
 	/**
64 64
 	 * @param Controller $controller
65 65
 	 */
66
-	protected function setController( Controller $controller ) {
66
+	protected function setController ( Controller $controller ) {
67 67
 		$this->controller = $controller;
68 68
 	}
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param string $key
74 74
 	 * @return Message
75 75
 	 */
76
-	protected function msg( string $key ) : Message {
76
+	protected function msg ( string $key ) : Message {
77 77
 		return new Message( $key );
78 78
 	}
79 79
 }
Please login to merge, or discard this patch.
includes/Wiki/Controller.php 1 patch
Spacing   +12 added lines, -12 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;
4 4
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @param string $domain The URL of the wiki, if different from default
29 29
 	 */
30
-	public function __construct( string $domain = DEFAULT_URL ) {
30
+	public function __construct ( string $domain = DEFAULT_URL ) {
31 31
 		$this->logger = new Logger;
32 32
 		$this->domain = $domain;
33 33
 	}
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return string
41 41
 	 * @throws MissingPageException
42 42
 	 */
43
-	public function getPageContent( string $title, int $section = null ) : string {
43
+	public function getPageContent ( string $title, int $section = null ) : string {
44 44
 		$this->logger->debug( "Retrieving content of page $title" );
45 45
 		$params = [
46 46
 			'action' => 'query',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		];
52 52
 
53 53
 		if ( $section !== null ) {
54
-			$params['rvsection'] = $section;
54
+			$params[ 'rvsection' ] = $section;
55 55
 		}
56 56
 
57 57
 		$req = RequestBase::newFromParams( $params )->setUrl( $this->domain );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			throw new MissingPageException( $title );
62 62
 		}
63 63
 
64
-		$mainSlot = $page->revisions[0]->slots->main;
64
+		$mainSlot = $page->revisions[ 0 ]->slots->main;
65 65
 
66 66
 		if ( $section !== null && isset( $mainSlot->nosuchsection ) ) {
67 67
 			throw new MissingSectionException( $title, $section );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param array $params
76 76
 	 * @throws EditException
77 77
 	 */
78
-	public function editPage( array $params ) {
78
+	public function editPage ( array $params ) {
79 79
 		$this->login();
80 80
 
81 81
 		$params = [
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
98 98
 	 * @throws LoginException
99 99
 	 */
100
-	public function login() {
100
+	public function login () {
101 101
 		if ( self::$loggedIn ) {
102 102
 			$this->logger->debug( 'Already logged in' );
103 103
 			return;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		self::$loggedIn = true;
126 126
 		// Clear tokens cache
127
-		$this->tokens = [];
127
+		$this->tokens = [ ];
128 128
 		$this->logger->info( 'Login succeeded' );
129 129
 	}
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param string $type
135 135
 	 * @return string
136 136
 	 */
137
-	public function getToken( string $type ) : string {
137
+	public function getToken ( string $type ) : string {
138 138
 		if ( !isset( $this->tokens[ $type ] ) ) {
139 139
 			$params = [
140 140
 				'action' => 'query',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param string $title
158 158
 	 * @return int
159 159
 	 */
160
-	public function getPageCreationTS( string $title ) : int {
160
+	public function getPageCreationTS ( string $title ) : int {
161 161
 		$params = [
162 162
 			'action' => 'query',
163 163
 			'prop' => 'revisions',
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$res = RequestBase::newFromParams( $params )->setUrl( $this->domain )->execute();
172 172
 		$data = $res->query->pages;
173
-		return strtotime( reset( $data )->revisions[0]->timestamp );
173
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
174 174
 	}
175 175
 
176 176
 	/**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param string $title
180 180
 	 * @param string $reason
181 181
 	 */
182
-	public function protectPage( string $title, string $reason ) {
182
+	public function protectPage ( string $title, string $reason ) {
183 183
 		$this->logger->info( "Protecting page $title" );
184 184
 		$this->login();
185 185
 
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.
includes/Wiki/User.php 1 patch
Spacing   +6 added lines, -6 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;
4 4
 
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @param string $name
18 18
 	 */
19
-	public function __construct( string $name ) {
19
+	public function __construct ( string $name ) {
20 20
 		$this->name = $name;
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @return string
25 25
 	 */
26
-	public function getName() : string {
26
+	public function getName () : string {
27 27
 		return $this->name;
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @return string[]
32 32
 	 */
33
-	public function getGroups() : array {
33
+	public function getGroups () : array {
34 34
 		if ( $this->groups === null ) {
35 35
 			$usersList = PageBotList::get()->getAdminsList();
36 36
 			$this->groups = array_keys( $usersList[ $this->name ] );
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 	 * @param string $groupName
45 45
 	 * @return bool
46 46
 	 */
47
-	public function inGroup( string $groupName ) : bool {
47
+	public function inGroup ( string $groupName ) : bool {
48 48
 		return in_array( $groupName, $this->getGroups() );
49 49
 	}
50 50
 
51 51
 	/**
52 52
 	 * @return string
53 53
 	 */
54
-	public function __toString() {
54
+	public function __toString () {
55 55
 		return $this->name;
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
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
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @param string $title
24 24
 	 */
25
-	public function __construct( string $title ) {
25
+	public function __construct ( string $title ) {
26 26
 		parent::__construct( $title );
27 27
 		$this->supportSection = $this->isVote() ? 3 : 0;
28 28
 		$this->opposeSection = $this->isVote() ? 4 : 3;
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return User
35 35
 	 */
36
-	public function getUser() : User {
37
-		$name = explode( '/', $this->title )[2];
36
+	public function getUser () : User {
37
+		$name = explode( '/', $this->title )[ 2 ];
38 38
 		return new User( $name );
39 39
 	}
40 40
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return int
45 45
 	 */
46
-	public function getNum() : int {
46
+	public function getNum () : int {
47 47
 		$bits = explode( '/', $this->getTitle() );
48 48
 		return intval( end( $bits ) );
49 49
 	}
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return string
55 55
 	 */
56
-	public function getUserNum() : string {
57
-		return explode( '/', $this->getTitle(), 3 )[2];
56
+	public function getUserNum () : string {
57
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
58 58
 	}
59 59
 
60 60
 	/**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string
64 64
 	 */
65
-	public function getBaseTitle() : string {
65
+	public function getBaseTitle () : string {
66 66
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
67 67
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
68 68
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return int
74 74
 	 */
75
-	public function getOpposingCount() : int {
75
+	public function getOpposingCount () : int {
76 76
 		return $this->getCountForSection( $this->opposeSection );
77 77
 	}
78 78
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return int
83 83
 	 * @throws \BadMethodCallException
84 84
 	 */
85
-	public function getSupportCount() : int {
85
+	public function getSupportCount () : int {
86 86
 		if ( !$this->isVote() ) {
87 87
 			throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' );
88 88
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param int $secNum
96 96
 	 * @return int
97 97
 	 */
98
-	protected function getCountForSection( int $secNum ) : int {
98
+	protected function getCountForSection ( int $secNum ) : int {
99 99
 		$content = $this->controller->getPageContent( $this->title, $secNum );
100 100
 		// Let's hope that this is good enough...
101 101
 		return substr_count( $content, "\n\# *(?![#*])" );
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return int
108 108
 	 */
109
-	protected function getQuorum() : int {
109
+	protected function getQuorum () : int {
110 110
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
111
-		return intval( $this->getMatch( $reg )[1] );
111
+		return intval( $this->getMatch( $reg )[ 1 ] );
112 112
 	}
113 113
 
114 114
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return bool
118 118
 	 */
119
-	public function hasOpposition() : bool {
119
+	public function hasOpposition () : bool {
120 120
 		return $this->getOpposingCount() >= 15;
121 121
 	}
122 122
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return int One of the OUTCOME_* constants
127 127
 	 * @throws \BadMethodCallException
128 128
 	 */
129
-	public function getOutcome() : int {
129
+	public function getOutcome () : int {
130 130
 		if ( !$this->isVote() ) {
131 131
 			throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' );
132 132
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @throws \BadMethodCallException
147 147
 	 * @throws \LogicException
148 148
 	 */
149
-	public function getOutcomeText() : string {
149
+	public function getOutcomeText () : string {
150 150
 		if ( !$this->isVote() ) {
151 151
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
152 152
 		}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return bool
182 182
 	 */
183
-	public function isVote() : bool {
183
+	public function isVote () : bool {
184 184
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
185 185
 		return !$this->matches( $sectionReg );
186 186
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @return int
192 192
 	 */
193
-	public function getEndTimestamp() : int {
193
+	public function getEndTimestamp () : int {
194 194
 		if ( $this->isVote() ) {
195 195
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
196 196
 			list( , $day, $hours ) = $this->getMatch( $reg );
Please login to merge, or discard this patch.
includes/Task/Subtask/UserNotice.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\Task\Subtask;
4 4
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @inheritDoc
13 13
 	 */
14
-	public function runInternal() : int {
14
+	public function runInternal () : int {
15 15
 		$pages = $this->getDataProvider()->getCreatedPages();
16 16
 		$users = $this->getDataProvider()->getUsersToProcess();
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 			return TaskResult::STATUS_NOTHING;
20 20
 		}
21 21
 
22
-		$ricNums = [];
22
+		$ricNums = [ ];
23 23
 		foreach ( $pages as $page ) {
24 24
 			$ricNums[ $page->getUser()->getName() ] = $page->getNum();
25 25
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param string $user
38 38
 	 * @param int $ricNum
39 39
 	 */
40
-	protected function addMsg( string $user, int $ricNum ) {
40
+	protected function addMsg ( string $user, int $ricNum ) {
41 41
 		$this->getLogger()->info( "Leaving msg to $user" );
42 42
 		$msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text();
43 43
 
Please login to merge, or discard this patch.
includes/Task/Subtask/FailedUpdates.php 1 patch
Spacing   +15 added lines, -15 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function runInternal() : int {
17
+	public function runInternal () : int {
18 18
 		$failed = $this->getFailures();
19 19
 		if ( $failed ) {
20 20
 			$this->updateBurList( $failed );
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return PageRiconferma[]
33 33
 	 */
34
-	private function getFailures() : array {
35
-		$ret = [];
34
+	private function getFailures () : array {
35
+		$ret = [ ];
36 36
 		$allPages = $this->getDataProvider()->getPagesToClose();
37 37
 		foreach ( $allPages as $page ) {
38 38
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
39
-				$ret[] = $page;
39
+				$ret[ ] = $page;
40 40
 			}
41 41
 		}
42 42
 		return $ret;
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	/**
46 46
 	 * @param PageRiconferma[] $pages
47 47
 	 */
48
-	protected function updateBurList( array $pages ) {
48
+	protected function updateBurList ( array $pages ) {
49 49
 		$this->getLogger()->info( 'Checking if bur list needs updating.' );
50 50
 
51
-		$remove = [];
51
+		$remove = [ ];
52 52
 		foreach ( $pages as $page ) {
53 53
 			$user = $page->getUser();
54 54
 			if ( $user->inGroup( 'bureaucrat' ) &&
55 55
 				$page->getOutcome() & PageRiconferma::OUTCOME_FAIL
56 56
 			) {
57
-				$remove[] = $user->getName();
57
+				$remove[ ] = $user->getName();
58 58
 			}
59 59
 		}
60 60
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @param PageRiconferma[] $pages
86 86
 	 */
87
-	protected function requestRemoval( array $pages ) {
87
+	protected function requestRemoval ( array $pages ) {
88 88
 		$this->getLogger()->info(
89 89
 			'Requesting removal on meta for: ' . implode( ', ', array_map( 'strval', $pages ) )
90 90
 		);
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param PageRiconferma[] $pages
124 124
 	 */
125
-	protected function updateAnnunci( array $pages ) {
125
+	protected function updateAnnunci ( array $pages ) {
126 126
 		$this->getLogger()->info( 'Updating annunci' );
127 127
 
128
-		$names = [];
128
+		$names = [ ];
129 129
 		$text = '';
130 130
 		foreach ( $pages as $page ) {
131 131
 			$user = $page->getUser()->getName();
132
-			$names[] = $user;
132
+			$names[ ] = $user;
133 133
 			$text .= "{{Breve|admin|{{subst:#time:j}}|[[Utente:$user|]] " .
134 134
 				"non è stato riconfermato [[WP:A|amministratore]].}}\n";
135 135
 		}
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @param PageRiconferma[] $pages
165 165
 	 */
166
-	protected function updateUltimeNotizie( array $pages ) {
166
+	protected function updateUltimeNotizie ( array $pages ) {
167 167
 		$this->getLogger()->info( 'Updating ultime notizie' );
168 168
 		$notiziePage = new Page( $this->getConfig()->get( 'ultimenotizie-page-title' ) );
169 169
 
170
-		$names = [];
170
+		$names = [ ];
171 171
 		$text = '';
172 172
 		foreach ( $pages as $page ) {
173 173
 			$user = $page->getUser()->getName();
174 174
 			$title = $page->getTitle();
175
-			$names[] = $user;
175
+			$names[ ] = $user;
176 176
 			$text .= "'''{{subst:#time:j F}}''': [[Utente:$user|]] non è stato [[$title|riconfermato]] " .
177 177
 				'[[WP:A|amministratore]]; ora gli admin sono {{subst:#expr: {{NUMBEROFADMINS}} - 1}}.';
178 178
 		}
Please login to merge, or discard this patch.
includes/Task/Subtask/SimpleUpdates.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\Task\Subtask;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function runInternal() : int {
17
+	public function runInternal () : int {
18 18
 		$pages = $this->getDataProvider()->getPagesToClose();
19 19
 
20 20
 		if ( !$pages ) {
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 	 * @param PageRiconferma[] $pages
34 34
 	 * @see UpdatesAround::addToVotazioni()
35 35
 	 */
36
-	protected function updateVotazioni( array $pages ) {
36
+	protected function updateVotazioni ( array $pages ) {
37 37
 		$this->getLogger()->info(
38 38
 			'Updating votazioni: ' . implode( ', ', array_map( 'strval', $pages ) )
39 39
 		);
40 40
 		$votePage = new Page( $this->getConfig()->get( 'vote-page-title' ) );
41 41
 
42
-		$titles = [];
42
+		$titles = [ ];
43 43
 		foreach ( $pages as $page ) {
44
-			$titles[] = preg_quote( $page->getTitle() );
44
+			$titles[ ] = preg_quote( $page->getTitle() );
45 45
 		}
46 46
 
47 47
 		$titleReg = implode( '|', $titles );
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @param array $pages
71 71
 	 * @see UpdatesAround::addToNews()
72 72
 	 */
73
-	protected function updateNews( array $pages ) {
73
+	protected function updateNews ( array $pages ) {
74 74
 		$simpleAmount = $voteAmount = 0;
75 75
 		foreach ( $pages as $page ) {
76 76
 			if ( $page->isVote() ) {
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
94 94
 		$voteMatches = $newsPage->getMatch( $voteReg );
95 95
 
96
-		$newSimp = (int)$simpleMatches[2] - $simpleAmount ?: '';
97
-		$newVote = (int)$voteMatches[2] - $voteAmount ?: '';
96
+		$newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: '';
97
+		$newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: '';
98 98
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content );
99 99
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
100 100
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @param PageRiconferma[] $pages
114 114
 	 */
115
-	protected function updateAdminList( array $pages ) {
115
+	protected function updateAdminList ( array $pages ) {
116 116
 		$this->getLogger()->info(
117 117
 			'Updating admin list: ' . implode( ', ', array_map( 'strval', $pages ) )
118 118
 		);
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 		$newContent = $adminsPage->getContent();
121 121
 		$newDate = date( 'Ymd', strtotime( '+1 year' ) );
122 122
 
123
-		$riconfNames = $removeNames = [];
123
+		$riconfNames = $removeNames = [ ];
124 124
 		foreach ( $pages as $page ) {
125 125
 			$user = $page->getUser()->getName();
126 126
 			$reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!";
127 127
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
128 128
 				// Remove the line
129 129
 				$newContent = preg_replace( $reg, '', $newContent );
130
-				$removeNames[] = $user;
130
+				$removeNames[ ] = $user;
131 131
 			} else {
132 132
 				$newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent );
133
-				$riconfNames[] = $user;
133
+				$riconfNames[ ] = $user;
134 134
 			}
135 135
 		}
136 136
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	/**
151 151
 	 * @param PageRiconferma[] $pages
152 152
 	 */
153
-	protected function updateCUList( array $pages ) {
153
+	protected function updateCUList ( array $pages ) {
154 154
 		$this->getLogger()->info( 'Checking if CU list needs updating.' );
155 155
 		$cuList = new Page( $this->getConfig()->get( 'cu-list-title' ) );
156 156
 		$newContent = $cuList->getContent();
157 157
 
158
-		$riconfNames = $removeNames = [];
158
+		$riconfNames = $removeNames = [ ];
159 159
 		foreach ( $pages as $page ) {
160 160
 			$user = $page->getUser();
161 161
 			if ( $user->inGroup( 'checkuser' ) ) {
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 				if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
164 164
 					// Remove the line
165 165
 					$newContent = preg_replace( $reg, '', $newContent );
166
-					$removeNames[] = $user->getName();
166
+					$removeNames[ ] = $user->getName();
167 167
 				} else {
168 168
 					$newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent );
169
-					$riconfNames[] = $user->getName();
169
+					$riconfNames[ ] = $user->getName();
170 170
 				}
171 171
 			}
172 172
 		}
Please login to merge, or discard this patch.