Passed
Push — master ( ebe4f4...85a9ba )
by Daimona
02:09
created
includes/TaskResult.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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param int $status One of the Task::STATUS_* constants
21 21
 	 * @param string[] $errors
22 22
 	 */
23
-	public function __construct( int $status, array $errors = [] ) {
23
+	public function __construct ( int $status, array $errors = [ ] ) {
24 24
 		$this->status = $status;
25 25
 		$this->errors = $errors;
26 26
 	}
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @return int
30 30
 	 */
31
-	public function getStatus() : int {
31
+	public function getStatus () : int {
32 32
 		return $this->status;
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @return string[]
37 37
 	 */
38
-	public function getErrors() {
38
+	public function getErrors () {
39 39
 		return $this->errors;
40 40
 	}
41 41
 
42 42
 	/**
43 43
 	 * @param TaskResult $that
44 44
 	 */
45
-	public function merge( TaskResult $that ) {
45
+	public function merge ( TaskResult $that ) {
46 46
 		$this->status |= $that->status;
47 47
 		$this->errors = array_merge( $this->errors, $that->errors );
48 48
 	}
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * @return string
52 52
 	 */
53
-	public function __toString() {
53
+	public function __toString () {
54 54
 		if ( $this->isOK() ) {
55 55
 			$stat = 'OK';
56 56
 			$errs = "\tNo errors.";
57 57
 		} else {
58 58
 			$stat = 'ERROR';
59
-			$formattedErrs = [];
59
+			$formattedErrs = [ ];
60 60
 			foreach ( $this->errors as $err ) {
61
-				$formattedErrs[] = "\t - $err";
61
+				$formattedErrs[ ] = "\t - $err";
62 62
 			}
63 63
 			$errs = implode( "\n", $formattedErrs );
64 64
 		}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return bool
72 72
 	 */
73
-	public function isOK() : bool {
73
+	public function isOK () : bool {
74 74
 		return $this->status === self::STATUS_OK;
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.
includes/TaskDataProvider.php 1 patch
Spacing   +11 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;
4 4
 
@@ -10,20 +10,20 @@  discard block
 block discarded – undo
10 10
 	private $users;
11 11
 
12 12
 	/** @var string[] */
13
-	private $createdPages = [];
13
+	private $createdPages = [ ];
14 14
 
15 15
 	/**
16 16
 	 * Get a list of users to execute tasks on.
17 17
 	 *
18 18
 	 * @return array[]
19 19
 	 */
20
-	public function getUsersToProcess() : array {
20
+	public function getUsersToProcess () : array {
21 21
 		if ( $this->users === null ) {
22 22
 			$this->getLogger()->debug( 'Retrieving users list' );
23 23
 			$content = $this->getController()->getPageContent( $this->getConfig()->get( 'list-title' ) );
24 24
 			$listUsers = json_decode( $content, true );
25 25
 
26
-			$this->users = [];
26
+			$this->users = [ ];
27 27
 			foreach ( $listUsers as $user => $groups ) {
28 28
 				$timestamp = $this->getValidTimestamp( $groups );
29 29
 
@@ -45,13 +45,11 @@  discard block
 block discarded – undo
45 45
 	 * @param array $groups
46 46
 	 * @return int
47 47
 	 */
48
-	private function getValidTimestamp( array $groups ) : int {
48
+	private function getValidTimestamp ( array $groups ) : int {
49 49
 		$checkuser = isset( $groups[ 'checkuser' ] ) ?
50
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() :
51
-			0;
50
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0;
52 51
 		$bureaucrat = isset( $groups[ 'bureaucrat' ] ) ?
53
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() :
54
-			0;
52
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0;
55 53
 
56 54
 		$timestamp = max( $bureaucrat, $checkuser );
57 55
 		if ( $timestamp === 0 ) {
@@ -65,21 +63,21 @@  discard block
 block discarded – undo
65 63
 	 *
66 64
 	 * @param string $name
67 65
 	 */
68
-	public function removeUser( string $name ) {
66
+	public function removeUser ( string $name ) {
69 67
 		unset( $this->users[ $name ] );
70 68
 	}
71 69
 
72 70
 	/**
73 71
 	 * @return string[]
74 72
 	 */
75
-	public function getCreatedPages() : array {
73
+	public function getCreatedPages () : array {
76 74
 		return $this->createdPages;
77 75
 	}
78 76
 
79 77
 	/**
80 78
 	 * @param string $title
81 79
 	 */
82
-	public function addCreatedPages( string $title ) {
83
-		$this->createdPages[] = $title;
80
+	public function addCreatedPages ( string $title ) {
81
+		$this->createdPages[ ] = $title;
84 82
 	}
85 83
 }
Please login to merge, or discard this patch.
includes/Request/CurlRequest.php 1 patch
Spacing   +5 added lines, -5 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\Request;
4 4
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @inheritDoc
13 13
 	 */
14
-	protected function reallyMakeRequest( string $params ) : string {
14
+	protected function reallyMakeRequest ( string $params ) : string {
15 15
 		$curl = curl_init();
16 16
 		if ( $curl === false ) {
17 17
 			throw new APIRequestException( 'Cannot open cURL handler.' );
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 * @return int
54 54
 	 * @internal Only used as CB for cURL
55 55
 	 */
56
-	public function headersHandler( $ch, string $header ) : int {
56
+	public function headersHandler ( $ch, string $header ) : int {
57 57
 		$bits = explode( ':', $header, 2 );
58
-		if ( trim( $bits[0] ) === 'Set-Cookie' ) {
59
-			$this->newCookies[] = $bits[1];
58
+		if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) {
59
+			$this->newCookies[ ] = $bits[ 1 ];
60 60
 		}
61 61
 		// @phan-suppress-next-line PhanTypeMismatchReturn WTF? Why does phan thinks this is a string?
62 62
 		return strlen( $header );
Please login to merge, or discard this patch.
includes/Request/NativeRequest.php 1 patch
Spacing   +5 added lines, -5 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\Request;
4 4
 
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	/**
10 10
 	 * @inheritDoc
11 11
 	 */
12
-	protected function reallyMakeRequest( string $params ) : string {
12
+	protected function reallyMakeRequest ( string $params ) : string {
13 13
 		$context = [
14 14
 			'http' => [
15 15
 				'method' => $this->method,
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		];
19 19
 		$url = self::$url;
20 20
 		if ( $this->method === 'POST' ) {
21
-			$context['http']['content'] = $params;
21
+			$context[ 'http' ][ 'content' ] = $params;
22 22
 		} else {
23 23
 			$url = "$url?$params";
24 24
 		}
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
 		foreach ( $http_response_header as $header ) {
29 29
 			$bits = explode( ':', $header, 2 );
30
-			if ( trim( $bits[0] ) === 'Set-Cookie' ) {
31
-				$this->newCookies[] = $bits[1];
30
+			if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) {
31
+				$this->newCookies[ ] = $bits[ 1 ];
32 32
 			}
33 33
 		}
34 34
 
Please login to merge, or discard this patch.
includes/Config.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
 
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 	/** @var self */
13 13
 	private static $instance;
14 14
 	/** @var array */
15
-	private $opts = [];
15
+	private $opts = [ ];
16 16
 
17 17
 	/**
18 18
 	 * Use self::init() and self::getInstance()
19 19
 	 */
20
-	private function __construct() {
20
+	private function __construct () {
21 21
 	}
22 22
 
23 23
 	/**
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 	 * @param array $defaults
27 27
 	 * @throws ConfigException
28 28
 	 */
29
-	public static function init( array $defaults ) {
29
+	public static function init ( array $defaults ) {
30 30
 		if ( self::$instance ) {
31 31
 			throw new ConfigException( 'Config was already initialized' );
32 32
 		}
33 33
 
34 34
 		$inst = new self;
35
-		$inst->set( 'list-title', $defaults['list-title'] );
36
-		$inst->set( 'username', $defaults['username'] );
37
-		$inst->set( 'password', $defaults['password'] );
35
+		$inst->set( 'list-title', $defaults[ 'list-title' ] );
36
+		$inst->set( 'username', $defaults[ 'username' ] );
37
+		$inst->set( 'password', $defaults[ 'password' ] );
38 38
 		self::$instance = $inst;
39 39
 
40 40
 		// On-wiki values
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param string $key
56 56
 	 * @param mixed $value
57 57
 	 */
58
-	protected function set( string $key, $value ) {
58
+	protected function set ( string $key, $value ) {
59 59
 		$this->opts[ $key ] = $value;
60 60
 	}
61 61
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @return self
66 66
 	 * @throws ConfigException
67 67
 	 */
68
-	public static function getInstance() : self {
68
+	public static function getInstance () : self {
69 69
 		if ( !self::$instance ) {
70 70
 			throw new ConfigException( 'Config not yet initialized' );
71 71
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return mixed
80 80
 	 * @throws ConfigException
81 81
 	 */
82
-	public function get( string $opt ) {
82
+	public function get ( string $opt ) {
83 83
 		if ( !isset( $this->opts[ $opt ] ) ) {
84 84
 			throw new ConfigException( "Config option '$opt' not set." );
85 85
 		}
Please login to merge, or discard this patch.
includes/Bot.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
 
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 	const VERSION = 1.0;
13 13
 
14
-	public function __construct() {
14
+	public function __construct () {
15 15
 		$this->logger = new Logger;
16 16
 	}
17 17
 
18 18
 	/**
19 19
 	 * Entry point for the whole process
20 20
 	 */
21
-	public function run() {
21
+	public function run () {
22 22
 		$this->logger->info( 'Starting full process.' );
23 23
 		$manager = new TaskManager;
24 24
 		$res = $manager->run( TaskManager::MODE_COMPLETE );
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param string $task
37 37
 	 */
38
-	public function runSingle( string $task ) {
38
+	public function runSingle ( string $task ) {
39 39
 		$this->logger->info( "Starting single task $task." );
40 40
 		$manager = new TaskManager;
41 41
 		$res = $manager->run( TaskManager::MODE_SINGLE, $task );
Please login to merge, or discard this patch.
includes/Task/CreatePage.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;
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 CreatePage' );
18 18
 		$users = $this->getDataProvider()->getUsersToProcess();
19 19
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $user
32 32
 	 * @param array $groups
33 33
 	 */
34
-	protected function processUser( string $user, array $groups ) {
34
+	protected function processUser ( string $user, array $groups ) {
35 35
 		try {
36 36
 			$num = $this->getLastPageNum( $user ) + 1;
37 37
 		} catch ( TaskException $e ) {
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @return int
62 62
 	 * @throws TaskException
63 63
 	 */
64
-	protected function getLastPageNum( string $user ) : int {
64
+	protected function getLastPageNum ( string $user ) : int {
65 65
 		$this->getLogger()->debug( "Retrieving previous pages for $user" );
66
-		$unprefixedTitle = explode( ':', $this->getConfig()->get( 'ric-main-page' ), 2 )[1];
66
+		$unprefixedTitle = explode( ':', $this->getConfig()->get( 'ric-main-page' ), 2 )[ 1 ];
67 67
 		$params = [
68 68
 			'action' => 'query',
69 69
 			'list' => 'allpages',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @param string $title
93 93
 	 * @return bool
94 94
 	 */
95
-	private function pageWasCreatedToday( string $title ) : bool {
95
+	private function pageWasCreatedToday ( string $title ) : bool {
96 96
 		$params = [
97 97
 			'action' => 'query',
98 98
 			'prop' => 'revisions',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 		$res = ( RequestBase::newFromParams( $params ) )->execute();
107 107
 		$data = $res->query->pages;
108
-		$time = strtotime( reset( $data )->revisions[0]->timestamp );
108
+		$time = strtotime( reset( $data )->revisions[ 0 ]->timestamp );
109 109
 		return date( 'z/Y' ) === date( 'z/Y', $time );
110 110
 	}
111 111
 
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 	 * @param string $user
117 117
 	 * @param array $groups
118 118
 	 */
119
-	protected function doCreatePage( string $title, string $user, array $groups ) {
119
+	protected function doCreatePage ( string $title, string $user, array $groups ) {
120 120
 		$this->getLogger()->info( "Creating page $title" );
121 121
 		$text = $this->getConfig()->get( 'ric-page-text' );
122 122
 		$textParams = [
123 123
 			'$user' => $user,
124
-			'$date' => $groups['sysop'],
125
-			'$burocrate' => $groups['bureaucrat'] ?? '',
126
-			'$checkuser' => $groups['checkuser'] ?? ''
124
+			'$date' => $groups[ 'sysop' ],
125
+			'$burocrate' => $groups[ 'bureaucrat' ] ?? '',
126
+			'$checkuser' => $groups[ 'checkuser' ] ?? ''
127 127
 		];
128 128
 		$text = strtr( $text, $textParams );
129 129
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param string $title
143 143
 	 * @param string $newText
144 144
 	 */
145
-	protected function createBasePage( string $title, string $newText ) {
145
+	protected function createBasePage ( string $title, string $newText ) {
146 146
 		$this->getLogger()->info( "Creating base page $title" );
147 147
 
148 148
 		$params = [
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string $title
160 160
 	 * @param string $newText
161 161
 	 */
162
-	protected function updateBasePage( string $title, string $newText ) {
162
+	protected function updateBasePage ( string $title, string $newText ) {
163 163
 		$this->getLogger()->info( "Updating base page $title" );
164 164
 
165 165
 		$params = [
Please login to merge, or discard this patch.
includes/Task/Task.php 1 patch
Spacing   +8 added lines, -8 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
 	const STATUS_OK = 0;
15 15
 	const STATUS_ERROR = 1;
16 16
 	/** @var string[] */
17
-	protected $errors = [];
17
+	protected $errors = [ ];
18 18
 	/** @var TaskDataProvider */
19 19
 	private $dataProvider;
20 20
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param TaskDataProvider $dataProvider
25 25
 	 */
26
-	final public function __construct( TaskDataProvider $dataProvider ) {
26
+	final public function __construct ( TaskDataProvider $dataProvider ) {
27 27
 		set_exception_handler( [ $this, 'handleException' ] );
28 28
 		set_error_handler( [ $this, 'handleError' ] );
29 29
 		parent::__construct();
30 30
 		$this->dataProvider = $dataProvider;
31 31
 	}
32 32
 
33
-	public function __destruct() {
33
+	public function __destruct () {
34 34
 		restore_error_handler();
35 35
 		restore_exception_handler();
36 36
 	}
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return TaskResult
42 42
 	 */
43
-	abstract public function run() : TaskResult;
43
+	abstract public function run () : TaskResult;
44 44
 
45 45
 	/**
46 46
 	 * Exception handler.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param \Throwable $ex
49 49
 	 * @protected
50 50
 	 */
51
-	public function handleException( \Throwable $ex ) {
51
+	public function handleException ( \Throwable $ex ) {
52 52
 		$this->getLogger()->error(
53 53
 			get_class( $ex ) . ': ' .
54 54
 			$ex->getMessage() . "\nTrace:\n" .
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	 * @param int $errline
66 66
 	 * @protected
67 67
 	 */
68
-	public function handleError( $errno, $errstr, $errfile, $errline ) {
68
+	public function handleError ( $errno, $errstr, $errfile, $errline ) {
69 69
 		throw new \ErrorException( $errstr, 0, $errno, $errfile, $errline );
70 70
 	}
71 71
 
72 72
 	/**
73 73
 	 * @return TaskDataProvider
74 74
 	 */
75
-	protected function getDataProvider() : TaskDataProvider {
75
+	protected function getDataProvider () : TaskDataProvider {
76 76
 		return $this->dataProvider;
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.
includes/Task/UpdatesAround.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;
4 4
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	/**
13 13
 	 * @inheritDoc
14 14
 	 */
15
-	public function run() : TaskResult {
15
+	public function run () : TaskResult {
16 16
 		$this->getLogger()->info( 'Starting task UpdatesAround' );
17 17
 
18 18
 		$pages = $this->getDataProvider()->getCreatedPages();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string[] $pages
34 34
 	 */
35
-	protected function addToMainPage( array $pages ) {
35
+	protected function addToMainPage ( array $pages ) {
36 36
 		$this->getLogger()->info(
37 37
 			'Adding the following to main: ' . implode( ', ', $pages )
38 38
 		);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param string[] $pages
58 58
 	 */
59
-	protected function addVote( array $pages ) {
59
+	protected function addVote ( array $pages ) {
60 60
 		$this->getLogger()->info(
61 61
 			'Adding the following to votes: ' . implode( ', ', $pages )
62 62
 		);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$time = $this->getTimeWithArticle();
70 70
 		$newLines = '';
71 71
 		foreach ( $pages as $page ) {
72
-			$user = explode( '/', $page )[2];
72
+			$user = explode( '/', $page )[ 2 ];
73 73
 			$newLines .= "*[[Utente:$user|]]. La [[$page|procedura]] termina $time;\n";
74 74
 		}
75 75
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $content, 1 );
80 80
 		} else {
81 81
 			// Start section
82
-			$matches = [];
82
+			$matches = [ ];
83 83
 			if ( preg_match( $introReg, $content, $matches ) === false ) {
84 84
 				throw new TaskException( 'Intro not found in vote page' );
85 85
 			}
86 86
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
87 87
 			// Replace semicolon with full stop
88 88
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
89
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $content, 1 );
89
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $content, 1 );
90 90
 		}
91 91
 
92 92
 		$params = [
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return string
105 105
 	 */
106
-	private function getTimeWithArticle() : string {
106
+	private function getTimeWithArticle () : string {
107 107
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
108 108
 		$endTS = time() + ( 60 * 60 * 24 * 7 );
109 109
 		$endTime = strftime( '%e %B alle %R', $endTS );
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @param int $amount
122 122
 	 */
123
-	protected function addNews( int $amount ) {
123
+	protected function addNews ( int $amount ) {
124 124
 		$this->getLogger()->info( "Increasing the news counter by $amount" );
125 125
 		$newsPage = $this->getConfig()->get( 'ric-news-page' );
126 126
 
127 127
 		$content = $this->getController()->getPageContent( $newsPage );
128 128
 		$reg = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!';
129 129
 
130
-		$matches = [];
130
+		$matches = [ ];
131 131
 		if ( preg_match( $reg, $content, $matches ) === false ) {
132 132
 			throw new TaskException( 'Param not found in news page' );
133 133
 		}
134 134
 
135
-		$newNum = (int)$matches[2] + $amount;
135
+		$newNum = (int)$matches[ 2 ] + $amount;
136 136
 		$newContent = preg_replace( $reg, '${1}' . $newNum, $content );
137 137
 
138 138
 		$params = [
Please login to merge, or discard this patch.