Passed
Push — master ( 4deb8c...54b834 )
by Daimona
01:42
created
includes/ContextSource.php 1 patch
Spacing   +10 added lines, -10 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,14 +28,14 @@  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
 
@@ -45,35 +45,35 @@  discard block
 block discarded – undo
45 45
 	 * @param string $optname
46 46
 	 * @return mixed
47 47
 	 */
48
-	protected function getOpt( string $optname ) {
48
+	protected function getOpt ( string $optname ) {
49 49
 		return $this->getConfig()->get( $optname );
50 50
 	}
51 51
 
52 52
 	/**
53 53
 	 * @return Config
54 54
 	 */
55
-	protected function getConfig() : Config {
55
+	protected function getConfig () : Config {
56 56
 		return $this->config;
57 57
 	}
58 58
 
59 59
 	/**
60 60
 	 * @param Config $cfg
61 61
 	 */
62
-	protected function setConfig( Config $cfg ) {
62
+	protected function setConfig ( Config $cfg ) {
63 63
 		$this->config = $cfg;
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * @return Controller
68 68
 	 */
69
-	protected function getController() : Controller {
69
+	protected function getController () : Controller {
70 70
 		return $this->controller;
71 71
 	}
72 72
 
73 73
 	/**
74 74
 	 * @param Controller $controller
75 75
 	 */
76
-	protected function setController( Controller $controller ) {
76
+	protected function setController ( Controller $controller ) {
77 77
 		$this->controller = $controller;
78 78
 	}
79 79
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param string $key
84 84
 	 * @return Message
85 85
 	 */
86
-	protected function msg( string $key ) : Message {
86
+	protected function msg ( string $key ) : Message {
87 87
 		return new Message( $key );
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/Message.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @param string $key
30 30
 	 */
31
-	public function __construct( string $key ) {
31
+	public function __construct ( string $key ) {
32 32
 		$this->key = $key;
33 33
 		$this->value = Config::getInstance()->getWikiMessage( $key );
34 34
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param array $args
38 38
 	 * @return self
39 39
 	 */
40
-	public function params( array $args ) : self {
40
+	public function params ( array $args ) : self {
41 41
 		$this->value = strtr( $this->value, $args );
42 42
 		return $this;
43 43
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	/**
46 46
 	 * @return string
47 47
 	 */
48
-	public function text() : string {
48
+	public function text () : string {
49 49
 		$this->parsePlurals();
50 50
 		return $this->value;
51 51
 	}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * Replace {{$plur|<amount>|sing|plur}}
55 55
 	 */
56
-	protected function parsePlurals() {
56
+	protected function parsePlurals () {
57 57
 		$reg = '!\{\{\$plur\|(?P<amount>\d+)\|(?P<sing>[^}|]+)\|(?P<plur>[^|}]+)}}!';
58 58
 
59 59
 		if ( preg_match( $reg, $this->value ) === 0 ) {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		$this->value = preg_replace_callback(
63 63
 			$reg,
64 64
 			function ( $matches ) {
65
-				return intval( $matches['amount'] ) > 1 ? trim( $matches['plur'] ) : trim( $matches['sing'] );
65
+				return intval( $matches[ 'amount' ] ) > 1 ? trim( $matches[ 'plur' ] ) : trim( $matches[ 'sing' ] );
66 66
 			},
67 67
 			$this->value
68 68
 		);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param int $timestamp
75 75
 	 * @return string
76 76
 	 */
77
-	public static function getTimeWithArticle( int $timestamp ) : string {
77
+	public static function getTimeWithArticle ( int $timestamp ) : string {
78 78
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
79 79
 		$timeString = strftime( '%e %B alle %R', $timestamp );
80 80
 		// Remove the left space if day has a single digit
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $timeString Full format, e.g. "15 aprile 2019 18:27"
92 92
 	 * @return int
93 93
 	 */
94
-	public static function getTimestampFromLocalTime( string $timeString ) : int {
94
+	public static function getTimestampFromLocalTime ( string $timeString ) : int {
95 95
 		$englishTime = str_ireplace(
96 96
 			array_values( self::MONTHS ),
97 97
 			array_keys( self::MONTHS ),
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 	 * @param string $emptyText
110 110
 	 * @return string
111 111
 	 */
112
-	public static function commaList( array $data, string $emptyText = 'nessuno' ) : string {
112
+	public static function commaList ( array $data, string $emptyText = 'nessuno' ) : string {
113 113
 		if ( count( $data ) > 1 ) {
114 114
 			$last = array_pop( $data );
115 115
 			$ret = implode( ', ', $data ) . " e $last";
116 116
 		} elseif ( $data ) {
117
-			$ret = (string)$data[0];
117
+			$ret = (string)$data[ 0 ];
118 118
 		} else {
119 119
 			$ret = $emptyText;
120 120
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		return $ret;
123 123
 	}
124 124
 
125
-	public function __toString() {
125
+	public function __toString () {
126 126
 		return $this->text();
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
includes/TaskDataProvider.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;
4 4
 
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 	/** @var array[] */
15 15
 	private $processUsers;
16 16
 	/** @var PageRiconferma[] */
17
-	private $createdPages = [];
17
+	private $createdPages = [ ];
18 18
 
19 19
 	/**
20 20
 	 * Get a list of users to execute tasks on.
21 21
 	 *
22 22
 	 * @return array[]
23 23
 	 */
24
-	public function getUsersToProcess() : array {
24
+	public function getUsersToProcess () : array {
25 25
 		if ( $this->processUsers === null ) {
26
-			$this->processUsers = [];
26
+			$this->processUsers = [ ];
27 27
 			foreach ( PageBotList::get()->getAdminsList() as $user => $groups ) {
28 28
 				if ( $this->shouldAddUser( $groups ) ) {
29 29
 					$this->processUsers[ $user ] = $groups;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param string[] $groups
41 41
 	 * @return bool
42 42
 	 */
43
-	private function shouldAddUser( array $groups ) : bool {
43
+	private function shouldAddUser ( array $groups ) : bool {
44 44
 		$override = true;
45 45
 		$timestamp = PageBotList::getOverrideTimestamp( $groups );
46 46
 
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return PageRiconferma[]
61 61
 	 */
62
-	public function getOpenPages() : array {
62
+	public function getOpenPages () : array {
63 63
 		static $list = null;
64 64
 		if ( $list === null ) {
65
-			$list = [];
65
+			$list = [ ];
66 66
 			$mainTitle = $this->getOpt( 'main-page-title' );
67 67
 			$params = [
68 68
 				'action' => 'query',
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$pages = RequestBase::newFromParams( $params )->execute()->query->pages;
77 77
 			foreach ( reset( $pages )->templates as $page ) {
78 78
 				if ( preg_match( "!$titleReg\/[^\/]+\/\d!", $page->title ) ) {
79
-					$list[] = new PageRiconferma( $page->title );
79
+					$list[ ] = new PageRiconferma( $page->title );
80 80
 				}
81 81
 			}
82 82
 		}
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return PageRiconferma[]
91 91
 	 */
92
-	public function getPagesToClose() : array {
92
+	public function getPagesToClose () : array {
93 93
 		static $list = null;
94 94
 		if ( $list === null ) {
95
-			$list = [];
95
+			$list = [ ];
96 96
 			foreach ( $this->getOpenPages() as $page ) {
97 97
 				if ( time() > $page->getEndTimestamp() ) {
98
-					$list[] = $page;
98
+					$list[ ] = $page;
99 99
 				}
100 100
 			}
101 101
 		}
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @param string $name
109 109
 	 */
110
-	public function removeUser( string $name ) {
110
+	public function removeUser ( string $name ) {
111 111
 		unset( $this->processUsers[ $name ] );
112 112
 	}
113 113
 
114 114
 	/**
115 115
 	 * @return PageRiconferma[]
116 116
 	 */
117
-	public function getCreatedPages() : array {
117
+	public function getCreatedPages () : array {
118 118
 		return $this->createdPages;
119 119
 	}
120 120
 
121 121
 	/**
122 122
 	 * @param PageRiconferma $page
123 123
 	 */
124
-	public function addCreatedPages( PageRiconferma $page ) {
125
-		$this->createdPages[] = $page;
124
+	public function addCreatedPages ( PageRiconferma $page ) {
125
+		$this->createdPages[ ] = $page;
126 126
 	}
127 127
 }
Please login to merge, or discard this patch.
includes/Task/Subtask/CreatePages.php 1 patch
Spacing   +11 added lines, -11 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
 		$users = $this->getDataProvider()->getUsersToProcess();
19 19
 
20 20
 		if ( !$users ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $user
35 35
 	 * @param array $groups
36 36
 	 */
37
-	protected function processUser( string $user, array $groups ) {
37
+	protected function processUser ( string $user, array $groups ) {
38 38
 		try {
39 39
 			$num = $this->getLastPageNum( $user ) + 1;
40 40
 		} catch ( TaskException $e ) {
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @return int
67 67
 	 * @throws TaskException
68 68
 	 */
69
-	protected function getLastPageNum( string $user ) : int {
69
+	protected function getLastPageNum ( string $user ) : int {
70 70
 		$this->getLogger()->debug( "Retrieving previous pages for $user" );
71
-		$unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[1];
71
+		$unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[ 1 ];
72 72
 		$params = [
73 73
 			'action' => 'query',
74 74
 			'list' => 'allpages',
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 * @param string $user
104 104
 	 * @param array $groups
105 105
 	 */
106
-	protected function createPage( string $title, string $user, array $groups ) {
106
+	protected function createPage ( string $title, string $user, array $groups ) {
107 107
 		$this->getLogger()->info( "Creating page $title" );
108 108
 		$textParams = [
109 109
 			'$user' => $user,
110
-			'$date' => $groups['sysop'],
111
-			'$burocrate' => $groups['bureaucrat'] ?? '',
112
-			'$checkuser' => $groups['checkuser'] ?? ''
110
+			'$date' => $groups[ 'sysop' ],
111
+			'$burocrate' => $groups[ 'bureaucrat' ] ?? '',
112
+			'$checkuser' => $groups[ 'checkuser' ] ?? ''
113 113
 		];
114 114
 
115 115
 		$params = [
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string $title
128 128
 	 * @param string $newText
129 129
 	 */
130
-	protected function createBasePage( string $title, string $newText ) {
130
+	protected function createBasePage ( string $title, string $newText ) {
131 131
 		$this->getLogger()->info( "Creating base page $title" );
132 132
 
133 133
 		$params = [
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $title
145 145
 	 * @param string $newText
146 146
 	 */
147
-	protected function updateBasePage( string $title, string $newText ) {
147
+	protected function updateBasePage ( string $title, string $newText ) {
148 148
 		$this->getLogger()->info( "Updating base page $title" );
149 149
 
150 150
 		$params = [
Please login to merge, or discard this patch.
includes/Wiki/Page/Page.php 1 patch
Spacing   +17 added lines, -17 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
 	 * @param string $title
23 23
 	 * @param string $domain The site where the page lives, if different from default
24 24
 	 */
25
-	public function __construct( string $title, string $domain = DEFAULT_URL ) {
25
+	public function __construct ( string $title, string $domain = DEFAULT_URL ) {
26 26
 		$this->title = $title;
27 27
 		$this->controller = new Controller( $domain );
28 28
 	}
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @return string
32 32
 	 */
33
-	public function getTitle() : string {
33
+	public function getTitle () : string {
34 34
 		return $this->title;
35 35
 	}
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param int|null $section A section number to retrieve the content of that section
41 41
 	 * @return string
42 42
 	 */
43
-	public function getContent( int $section = null ) : string {
43
+	public function getContent ( int $section = null ) : string {
44 44
 		if ( $this->content === null ) {
45 45
 			$this->content = $this->controller->getPageContent( $this->title, $section );
46 46
 		}
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 	 * @param array $params
54 54
 	 * @throws \LogicException
55 55
 	 */
56
-	public function edit( array $params ) {
56
+	public function edit ( array $params ) {
57 57
 		$params = [
58 58
 			'title' => $this->getTitle()
59 59
 		] + $params;
60 60
 
61 61
 		$this->controller->editPage( $params );
62
-		if ( isset( $params['text'] ) ) {
63
-			$this->content = $params['text'];
64
-		} elseif ( isset( $params['appendtext'] ) ) {
65
-			$this->content .= $params['appendtext'];
66
-		} elseif ( isset( $params['prependtext'] ) ) {
67
-			$this->content = $params['prependtext'] . $this->content;
62
+		if ( isset( $params[ 'text' ] ) ) {
63
+			$this->content = $params[ 'text' ];
64
+		} elseif ( isset( $params[ 'appendtext' ] ) ) {
65
+			$this->content .= $params[ 'appendtext' ];
66
+		} elseif ( isset( $params[ 'prependtext' ] ) ) {
67
+			$this->content = $params[ 'prependtext' ] . $this->content;
68 68
 		} else {
69 69
 			throw new \LogicException(
70 70
 				'Unrecognized text param for edit. Params: ' . var_export( $params, true )
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return bool
79 79
 	 */
80
-	public function exists() : bool {
80
+	public function exists () : bool {
81 81
 		$res = RequestBase::newFromParams( [
82 82
 			'action' => 'query',
83 83
 			'titles' => $this->getTitle()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @param string $regex
93 93
 	 * @return bool
94 94
 	 */
95
-	public function matches( string $regex ) : bool {
95
+	public function matches ( string $regex ) : bool {
96 96
 		return (bool)preg_match( $regex, $this->getContent() );
97 97
 	}
98 98
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @return string[]
105 105
 	 * @throws \Exception
106 106
 	 */
107
-	public function getMatch( string $regex ) : array {
108
-		$ret = [];
107
+	public function getMatch ( string $regex ) : array {
108
+		$ret = [ ];
109 109
 		if ( preg_match( $regex, $this->getContent(), $ret ) === 0 ) {
110 110
 			throw new \Exception( 'The content does not match the given regex' );
111 111
 		}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @inheritDoc
119 119
 	 */
120
-	public function getRegex() : string {
120
+	public function getRegex () : string {
121 121
 		return str_replace( ' ', '[ _]', preg_quote( $this->title ) );
122 122
 	}
123 123
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return string
128 128
 	 */
129
-	public function __toString() {
129
+	public function __toString () {
130 130
 		return $this->getTitle();
131 131
 	}
132 132
 }
Please login to merge, or discard this patch.
includes/Task/Subtask/OpenUpdates.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\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()->getCreatedPages();
19 19
 
20 20
 		if ( !$pages ) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param PageRiconferma[] $pages
38 38
 	 */
39
-	protected function addToMainPage( array $pages ) {
39
+	protected function addToMainPage ( array $pages ) {
40 40
 		$this->getLogger()->info(
41 41
 			'Adding the following to main: ' . implode( ', ', $pages )
42 42
 		);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param PageRiconferma[] $pages
71 71
 	 */
72
-	protected function addToVotazioni( array $pages ) {
72
+	protected function addToVotazioni ( array $pages ) {
73 73
 		$this->getLogger()->info(
74 74
 			'Adding the following to votes: ' . implode( ', ', $pages )
75 75
 		);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param int $amount
107 107
 	 * @throws TaskException
108 108
 	 */
109
-	protected function addToNews( int $amount ) {
109
+	protected function addToNews ( int $amount ) {
110 110
 		$this->getLogger()->info( "Increasing the news counter by $amount" );
111 111
 		$newsPage = new Page( $this->getOpt( 'news-page-title' ) );
112 112
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			throw new TaskException( 'Param not found in news page' );
120 120
 		}
121 121
 
122
-		$newNum = (int)$matches[2] + $amount;
122
+		$newNum = (int)$matches[ 2 ] + $amount;
123 123
 		$newContent = preg_replace( $reg, '${1}' . $newNum, $content );
124 124
 
125 125
 		$summary = $this->msg( 'news-page-summary' )
Please login to merge, or discard this patch.
includes/Task/StartNew.php 1 patch
Spacing   +3 added lines, -3 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;
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
 		$orderedList = [
19 19
 			'create-pages',
20 20
 			'open-updates',
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @inheritDoc
34 34
 	 */
35
-	protected function getSubtasksMap() : array {
35
+	protected function getSubtasksMap () : array {
36 36
 		return [
37 37
 			'create-pages' => CreatePages::class,
38 38
 			'open-updates' => OpenUpdates::class,
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +14 added lines, -14 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;
4 4
 
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	protected function getSubtasksMap(): array {
18
+	protected function getSubtasksMap (): array {
19 19
 		// Everything is done here.
20
-		return [];
20
+		return [ ];
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @inheritDoc
25 25
 	 */
26
-	public function runInternal() : int {
26
+	public function runInternal () : int {
27 27
 		$pages = $this->getDataProvider()->getOpenPages();
28 28
 
29 29
 		if ( !$pages ) {
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	 * @param PageRiconferma[] $pages
38 38
 	 * @return int a STATUS_* constant
39 39
 	 */
40
-	protected function processPages( array $pages ) : int {
41
-		$donePages = [];
40
+	protected function processPages ( array $pages ) : int {
41
+		$donePages = [ ];
42 42
 		foreach ( $pages as $page ) {
43 43
 			if ( $page->hasOpposition() && !$page->isVote() ) {
44 44
 				$this->openVote( $page );
45
-				$donePages[] = $page;
45
+				$donePages[ ] = $page;
46 46
 			}
47 47
 		}
48 48
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param PageRiconferma $page
62 62
 	 */
63
-	protected function openVote( PageRiconferma $page ) {
63
+	protected function openVote ( PageRiconferma $page ) {
64 64
 		$this->getLogger()->info( "Starting vote on $page" );
65 65
 
66 66
 		$content = $page->getContent();
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 	 * @see SimpleUpdates::updateVotazioni()
100 100
 	 * @see OpenUpdates::addToVotazioni()
101 101
 	 */
102
-	protected function updateVotazioni( array $pages ) {
102
+	protected function updateVotazioni ( array $pages ) {
103 103
 		$votePage = new Page( $this->getOpt( 'vote-page-title' ) );
104 104
 
105
-		$users = [];
105
+		$users = [ ];
106 106
 		foreach ( $pages as $page ) {
107
-			$users[] = $page->getUser();
107
+			$users[ ] = $page->getUser();
108 108
 		}
109 109
 		$usersReg = Element::regexFromArray( $users );
110 110
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @see SimpleUpdates::updateNews()
143 143
 	 * @see OpenUpdates::addToNews()
144 144
 	 */
145
-	protected function updateNews( int $amount ) {
145
+	protected function updateNews ( int $amount ) {
146 146
 		$this->getLogger()->info( "Turning $amount pages into votes" );
147 147
 		$newsPage = new Page( $this->getOpt( 'news-page-title' ) );
148 148
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 			throw new TaskException( 'Param "voto" not found in news page' );
158 158
 		}
159 159
 
160
-		$newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: '';
161
-		$newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: '';
160
+		$newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: '';
161
+		$newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: '';
162 162
 
163 163
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
164 164
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
Please login to merge, or discard this patch.
includes/Logger.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;
4 4
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @param string $minlevel
17 17
 	 */
18
-	public function __construct( $minlevel = LogLevel::INFO ) {
18
+	public function __construct ( $minlevel = LogLevel::INFO ) {
19 19
 		$this->minLevel = $this->levelToInt( $minlevel );
20 20
 	}
21 21
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $level
26 26
 	 * @return int
27 27
 	 */
28
-	private function levelToInt( string $level ) : int {
28
+	private function levelToInt ( string $level ) : int {
29 29
 		// Order matters
30 30
 		$mapping = [
31 31
 			LogLevel::DEBUG,
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	/**
44 44
 	 * @inheritDoc
45 45
 	 */
46
-	public function log( $level, $message, array $context = [] ) {
46
+	public function log ( $level, $message, array $context = [ ] ) {
47 47
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
48 48
 			printf( "%s [%s] - %s\n", date( 'd M H:i:s' ), $level, $message );
49 49
 		}
Please login to merge, or discard this patch.