Passed
Push — master ( 3461b4...390609 )
by Daimona
01:42
created
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
 
@@ -13,16 +13,16 @@  discard block
 block discarded – undo
13 13
 	/** @var array[] */
14 14
 	private $processUsers;
15 15
 	/** @var PageRiconferma[] */
16
-	private $createdPages = [];
16
+	private $createdPages = [ ];
17 17
 
18 18
 	/**
19 19
 	 * Get a list of users to execute tasks on.
20 20
 	 *
21 21
 	 * @return array[]
22 22
 	 */
23
-	public function getUsersToProcess() : array {
23
+	public function getUsersToProcess () : array {
24 24
 		if ( $this->processUsers === null ) {
25
-			$this->processUsers = [];
25
+			$this->processUsers = [ ];
26 26
 			foreach ( PageBotList::get( $this->getController() )->getAdminsList() as $user => $groups ) {
27 27
 				if ( $this->shouldAddUser( $groups ) ) {
28 28
 					$this->processUsers[ $user ] = $groups;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param string[] $groups
40 40
 	 * @return bool
41 41
 	 */
42
-	private function shouldAddUser( array $groups ) : bool {
42
+	private function shouldAddUser ( array $groups ) : bool {
43 43
 		$override = true;
44 44
 		$timestamp = PageBotList::getOverrideTimestamp( $groups );
45 45
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return PageRiconferma[]
60 60
 	 */
61
-	public function getOpenPages() : array {
61
+	public function getOpenPages () : array {
62 62
 		static $list = null;
63 63
 		if ( $list === null ) {
64
-			$list = [];
64
+			$list = [ ];
65 65
 			$mainTitle = $this->getOpt( 'main-page-title' );
66 66
 			$params = [
67 67
 				'action' => 'query',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			$pages = RequestBase::newFromParams( $params )->execute()->query->pages;
76 76
 			foreach ( reset( $pages )->templates as $page ) {
77 77
 				if ( preg_match( "!$titleReg\/[^\/]+\/\d!", $page->title ) ) {
78
-					$list[] = new PageRiconferma( $page->title, $this->getController() );
78
+					$list[ ] = new PageRiconferma( $page->title, $this->getController() );
79 79
 				}
80 80
 			}
81 81
 		}
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return PageRiconferma[]
90 90
 	 */
91
-	public function getPagesToClose() : array {
91
+	public function getPagesToClose () : array {
92 92
 		static $list = null;
93 93
 		if ( $list === null ) {
94
-			$list = [];
94
+			$list = [ ];
95 95
 			foreach ( $this->getOpenPages() as $page ) {
96 96
 				if ( time() > $page->getEndTimestamp() ) {
97
-					$list[] = $page;
97
+					$list[ ] = $page;
98 98
 				}
99 99
 			}
100 100
 		}
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @param string $name
108 108
 	 */
109
-	public function removeUser( string $name ) {
109
+	public function removeUser ( string $name ) {
110 110
 		unset( $this->processUsers[ $name ] );
111 111
 	}
112 112
 
113 113
 	/**
114 114
 	 * @return PageRiconferma[]
115 115
 	 */
116
-	public function getCreatedPages() : array {
116
+	public function getCreatedPages () : array {
117 117
 		return $this->createdPages;
118 118
 	}
119 119
 
120 120
 	/**
121 121
 	 * @param PageRiconferma $page
122 122
 	 */
123
-	public function addCreatedPages( PageRiconferma $page ) {
124
-		$this->createdPages[] = $page;
123
+	public function addCreatedPages ( PageRiconferma $page ) {
124
+		$this->createdPages[ ] = $page;
125 125
 	}
126 126
 }
Please login to merge, or discard this patch.
includes/TaskManager.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;
4 4
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param Logger $logger
55 55
 	 * @param Controller $controller
56 56
 	 */
57
-	public function __construct( Logger $logger, Controller $controller ) {
57
+	public function __construct ( Logger $logger, Controller $controller ) {
58 58
 		$this->logger = $logger;
59 59
 		$this->controller = $controller;
60 60
 		$this->provider = new TaskDataProvider( $this->logger, $this->controller );
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param string|null $name Only used in MODE_TASK and MODE_SUBTASK
68 68
 	 * @return TaskResult
69 69
 	 */
70
-	public function run( string $mode, string $name = null ) : TaskResult {
70
+	public function run ( string $mode, string $name = null ) : TaskResult {
71 71
 		if ( $mode === self::MODE_COMPLETE ) {
72 72
 			return $this->runAllTasks();
73 73
 		} elseif ( $name === null ) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @return TaskResult
84 84
 	 */
85
-	protected function runAllTasks() : TaskResult {
85
+	protected function runAllTasks () : TaskResult {
86 86
 		$orderedList = [
87 87
 			'update-list',
88 88
 			'start-new',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param string $name
105 105
 	 * @return TaskResult
106 106
 	 */
107
-	protected function runTask( string $name ) : TaskResult {
107
+	protected function runTask ( string $name ) : TaskResult {
108 108
 		if ( !isset( self::TASKS_MAP[ $name ] ) ) {
109 109
 			throw new \InvalidArgumentException( "'$name' is not a valid task." );
110 110
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string $name
120 120
 	 * @return TaskResult
121 121
 	 */
122
-	protected function runSubtask( string $name ) : TaskResult {
122
+	protected function runSubtask ( string $name ) : TaskResult {
123 123
 		if ( !isset( self::SUBTASKS_MAP[ $name ] ) ) {
124 124
 			throw new \InvalidArgumentException( "'$name' is not a valid subtask." );
125 125
 		}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param string $class
135 135
 	 * @return Task
136 136
 	 */
137
-	private function getTaskInstance( string $class ) : Task {
137
+	private function getTaskInstance ( string $class ) : Task {
138 138
 		return new $class( $this->logger, $this->controller, $this->provider );
139 139
 	}
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $class
145 145
 	 * @return Subtask
146 146
 	 */
147
-	private function getSubtaskInstance( string $class ) : Subtask {
147
+	private function getSubtaskInstance ( string $class ) : Subtask {
148 148
 		return new $class( $this->logger, $this->controller, $this->provider );
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
includes/Bot.php 1 patch
Spacing   +7 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;
4 4
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param Logger $logger
20 20
 	 * @param Controller $controller
21 21
 	 */
22
-	public function __construct( Logger $logger, Controller $controller ) {
22
+	public function __construct ( Logger $logger, Controller $controller ) {
23 23
 		$this->logger = $logger;
24 24
 		$this->controller = $controller;
25 25
 	}
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param string $mode
31 31
 	 * @param string|null $name
32 32
 	 */
33
-	private function run( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) {
33
+	private function run ( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) {
34 34
 		$activity = $mode === TaskManager::MODE_COMPLETE ? TaskManager::MODE_COMPLETE : "$mode $name";
35 35
 		$this->logger->info( "Running $activity" );
36 36
 		$manager = new TaskManager( $this->logger, $this->controller );
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
 		$base = "Execution of $activity";
40 40
 		if ( $res->isOK() ) {
41 41
 			$msg = $res->getStatus() === TaskResult::STATUS_NOTHING ?
42
-				': nothing to do' :
43
-				' completed successfully';
42
+				': nothing to do' : ' completed successfully';
44 43
 			$this->logger->info( $base . $msg . ".\n$line\n\n" );
45 44
 		} else {
46 45
 			$this->logger->error( "$base failed.\n$res\n$line\n\n" );
@@ -50,7 +49,7 @@  discard block
 block discarded – undo
50 49
 	/**
51 50
 	 * Entry point for the whole process
52 51
 	 */
53
-	public function runAll() {
52
+	public function runAll () {
54 53
 		$this->run();
55 54
 	}
56 55
 
@@ -59,7 +58,7 @@  discard block
 block discarded – undo
59 58
 	 *
60 59
 	 * @param string $task
61 60
 	 */
62
-	public function runTask( string $task ) {
61
+	public function runTask ( string $task ) {
63 62
 		$this->run( TaskManager::MODE_TASK, $task );
64 63
 	}
65 64
 
@@ -68,7 +67,7 @@  discard block
 block discarded – undo
68 67
 	 *
69 68
 	 * @param string $subtask
70 69
 	 */
71
-	public function runSubtask( string $subtask ) {
70
+	public function runSubtask ( string $subtask ) {
72 71
 		$this->run( TaskManager::MODE_SUBTASK, $subtask );
73 72
 	}
74 73
 }
Please login to merge, or discard this patch.
includes/Config.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;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	/** @var self */
14 14
 	private static $instance;
15 15
 	/** @var array */
16
-	private $opts = [];
16
+	private $opts = [ ];
17 17
 	/** @var Controller */
18 18
 	private $controller;
19 19
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param Controller $controller
24 24
 	 */
25
-	private function __construct( Controller $controller ) {
25
+	private function __construct ( Controller $controller ) {
26 26
 		$this->controller = $controller;
27 27
 	}
28 28
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 * @param Controller $controller
34 34
 	 * @throws ConfigException
35 35
 	 */
36
-	public static function init( array $defaults, Controller $controller ) {
36
+	public static function init ( array $defaults, Controller $controller ) {
37 37
 		if ( self::$instance ) {
38 38
 			throw new ConfigException( 'Config was already initialized' );
39 39
 		}
40 40
 
41 41
 		$inst = new self( $controller );
42
-		$inst->set( 'list-title', $defaults['list-title'] );
43
-		$inst->set( 'msg-title', $defaults['msg-title'] );
44
-		$inst->set( 'username', $defaults['username'] );
45
-		$inst->set( 'password', $defaults['password'] );
42
+		$inst->set( 'list-title', $defaults[ 'list-title' ] );
43
+		$inst->set( 'msg-title', $defaults[ 'msg-title' ] );
44
+		$inst->set( 'username', $defaults[ 'username' ] );
45
+		$inst->set( 'password', $defaults[ 'password' ] );
46 46
 		self::$instance = $inst;
47 47
 
48 48
 		// On-wiki values
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return string
63 63
 	 * @throws ConfigException
64 64
 	 */
65
-	public function getWikiMessage( string $key ) : string {
65
+	public function getWikiMessage ( string $key ) : string {
66 66
 		static $messages = null;
67 67
 		if ( $messages === null ) {
68 68
 			try {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		if ( !isset( $messages[ $key ] ) ) {
76 76
 			throw new ConfigException( "Message '$key' does not exist." );
77 77
 		}
78
-		return $messages[$key];
78
+		return $messages[ $key ];
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param string $key
85 85
 	 * @param mixed $value
86 86
 	 */
87
-	protected function set( string $key, $value ) {
87
+	protected function set ( string $key, $value ) {
88 88
 		$this->opts[ $key ] = $value;
89 89
 	}
90 90
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return self
95 95
 	 * @throws ConfigException
96 96
 	 */
97
-	public static function getInstance() : self {
97
+	public static function getInstance () : self {
98 98
 		if ( !self::$instance ) {
99 99
 			throw new ConfigException( 'Config not yet initialized' );
100 100
 		}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return mixed
109 109
 	 * @throws ConfigException
110 110
 	 */
111
-	public function get( string $opt ) {
111
+	public function get ( string $opt ) {
112 112
 		if ( !isset( $this->opts[ $opt ] ) ) {
113 113
 			throw new ConfigException( "Config option '$opt' not set." );
114 114
 		}
Please login to merge, or discard this patch.
includes/Task/TaskBase.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\Task;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 abstract class TaskBase extends ContextSource {
15 15
 	/** @var string[] */
16
-	protected $errors = [];
16
+	protected $errors = [ ];
17 17
 	/** @var TaskDataProvider */
18 18
 	protected $dataProvider;
19 19
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param Controller $controller
25 25
 	 * @param TaskDataProvider $dataProvider
26 26
 	 */
27
-	final public function __construct(
27
+	final public function __construct (
28 28
 		Logger $logger,
29 29
 		Controller $controller,
30 30
 		TaskDataProvider $dataProvider
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		$this->dataProvider = $dataProvider;
36 36
 	}
37 37
 
38
-	public function __destruct() {
38
+	public function __destruct () {
39 39
 		restore_error_handler();
40 40
 		restore_exception_handler();
41 41
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return TaskResult
47 47
 	 */
48
-	final public function run() : TaskResult {
48
+	final public function run () : TaskResult {
49 49
 		$class = ( new \ReflectionClass( $this ) )->getShortName();
50 50
 		$opName = $this->getOperationName();
51 51
 		$this->getLogger()->info( "Starting $opName $class" );
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return int One of the STATUS_* constants
78 78
 	 */
79
-	abstract protected function runInternal() : int;
79
+	abstract protected function runInternal () : int;
80 80
 
81 81
 	/**
82 82
 	 * How this operation should be called in logs
83 83
 	 *
84 84
 	 * @return string
85 85
 	 */
86
-	abstract public function getOperationName() : string;
86
+	abstract public function getOperationName () : string;
87 87
 
88 88
 	/**
89 89
 	 * Exception handler.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param \Throwable $ex
92 92
 	 * @protected
93 93
 	 */
94
-	public function handleException( \Throwable $ex ) {
94
+	public function handleException ( \Throwable $ex ) {
95 95
 		$this->getLogger()->error(
96 96
 			( new \ReflectionClass( $ex ) )->getShortName() . ': ' .
97 97
 			$ex->getMessage() . "\nin " . $ex->getFile() . ' line ' .
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 	 * @throws \ErrorException
110 110
 	 * @protected
111 111
 	 */
112
-	public function handleError( $errno, $errstr, $errfile, $errline ) {
112
+	public function handleError ( $errno, $errstr, $errfile, $errline ) {
113 113
 		throw new \ErrorException( $errstr, 0, $errno, $errfile, $errline );
114 114
 	}
115 115
 
116 116
 	/**
117 117
 	 * @return TaskDataProvider
118 118
 	 */
119
-	protected function getDataProvider() : TaskDataProvider {
119
+	protected function getDataProvider () : TaskDataProvider {
120 120
 		return $this->dataProvider;
121 121
 	}
122 122
 }
Please login to merge, or discard this patch.
includes/ContextSource.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
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param Logger $logger
25 25
 	 * @param Controller $controller
26 26
 	 */
27
-	public function __construct( Logger $logger, Controller $controller ) {
27
+	public function __construct ( Logger $logger, Controller $controller ) {
28 28
 		$this->setLogger( $logger );
29 29
 		$this->setConfig( Config::getInstance() );
30 30
 		$this->setController( $controller );
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * @return LoggerInterface
35 35
 	 */
36
-	protected function getLogger() : LoggerInterface {
36
+	protected function getLogger () : LoggerInterface {
37 37
 		return $this->logger;
38 38
 	}
39 39
 
40 40
 	/**
41 41
 	 * @inheritDoc
42 42
 	 */
43
-	public function setLogger( LoggerInterface $logger ) {
43
+	public function setLogger ( LoggerInterface $logger ) {
44 44
 		$this->logger = $logger;
45 45
 	}
46 46
 
@@ -50,35 +50,35 @@  discard block
 block discarded – undo
50 50
 	 * @param string $optname
51 51
 	 * @return mixed
52 52
 	 */
53
-	protected function getOpt( string $optname ) {
53
+	protected function getOpt ( string $optname ) {
54 54
 		return $this->getConfig()->get( $optname );
55 55
 	}
56 56
 
57 57
 	/**
58 58
 	 * @return Config
59 59
 	 */
60
-	protected function getConfig() : Config {
60
+	protected function getConfig () : Config {
61 61
 		return $this->config;
62 62
 	}
63 63
 
64 64
 	/**
65 65
 	 * @param Config $cfg
66 66
 	 */
67
-	protected function setConfig( Config $cfg ) {
67
+	protected function setConfig ( Config $cfg ) {
68 68
 		$this->config = $cfg;
69 69
 	}
70 70
 
71 71
 	/**
72 72
 	 * @return Controller
73 73
 	 */
74
-	protected function getController() : Controller {
74
+	protected function getController () : Controller {
75 75
 		return $this->controller;
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @param Controller $controller
80 80
 	 */
81
-	protected function setController( Controller $controller ) {
81
+	protected function setController ( Controller $controller ) {
82 82
 		$this->controller = $controller;
83 83
 	}
84 84
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @param string $key
89 89
 	 * @return Message
90 90
 	 */
91
-	protected function msg( string $key ) : Message {
91
+	protected function msg ( string $key ) : Message {
92 92
 		return new Message( $key );
93 93
 	}
94 94
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param string $title
99 99
 	 * @return Page
100 100
 	 */
101
-	protected function getPage( string $title ) : Page {
101
+	protected function getPage ( string $title ) : Page {
102 102
 		return new Page( $title, $this->getController() );
103 103
 	}
104 104
 }
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,
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @inheritDoc
45 45
 	 * @suppress PhanUnusedPublicMethodParameter
46 46
 	 */
47
-	public function log( $level, $message, array $context = [] ) {
47
+	public function log ( $level, $message, array $context = [ ] ) {
48 48
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
49 49
 			printf( "%s [%s] - %s\n", date( 'd M H:i:s' ), $level, $message );
50 50
 		}
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
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @param string $key
28 28
 	 */
29
-	public function __construct( string $key ) {
29
+	public function __construct ( string $key ) {
30 30
 		$this->value = Config::getInstance()->getWikiMessage( $key );
31 31
 	}
32 32
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param array $args
35 35
 	 * @return self
36 36
 	 */
37
-	public function params( array $args ) : self {
37
+	public function params ( array $args ) : self {
38 38
 		$this->value = strtr( $this->value, $args );
39 39
 		return $this;
40 40
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 * @return string
44 44
 	 */
45
-	public function text() : string {
45
+	public function text () : string {
46 46
 		$this->parsePlurals();
47 47
 		return $this->value;
48 48
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * Replace {{$plur|<amount>|sing|plur}}
52 52
 	 */
53
-	protected function parsePlurals() {
53
+	protected function parsePlurals () {
54 54
 		$reg = '!\{\{\$plur\|(?P<amount>\d+)\|(?P<sing>[^}|]+)\|(?P<plur>[^|}]+)}}!';
55 55
 
56 56
 		if ( preg_match( $reg, $this->value ) === 0 ) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$this->value = preg_replace_callback(
60 60
 			$reg,
61 61
 			function ( $matches ) {
62
-				return intval( $matches['amount'] ) > 1 ? trim( $matches['plur'] ) : trim( $matches['sing'] );
62
+				return intval( $matches[ 'amount' ] ) > 1 ? trim( $matches[ 'plur' ] ) : trim( $matches[ 'sing' ] );
63 63
 			},
64 64
 			$this->value
65 65
 		);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @suppress PhanUnreferencedPublicMethod
74 74
 	 * @fixme Is this necessary?
75 75
 	 */
76
-	public static function getTimeWithArticle( int $timestamp ) : string {
76
+	public static function getTimeWithArticle ( int $timestamp ) : string {
77 77
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
78 78
 		$timeString = strftime( '%e %B alle %R', $timestamp );
79 79
 		// Remove the left space if day has a single digit
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param string $timeString Full format, e.g. "15 aprile 2019 18:27"
91 91
 	 * @return int
92 92
 	 */
93
-	public static function getTimestampFromLocalTime( string $timeString ) : int {
93
+	public static function getTimestampFromLocalTime ( string $timeString ) : int {
94 94
 		$englishTime = str_ireplace(
95 95
 			array_values( self::MONTHS ),
96 96
 			array_keys( self::MONTHS ),
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 	 * @param string $emptyText
109 109
 	 * @return string
110 110
 	 */
111
-	public static function commaList( array $data, string $emptyText = 'nessuno' ) : string {
111
+	public static function commaList ( array $data, string $emptyText = 'nessuno' ) : string {
112 112
 		if ( count( $data ) > 1 ) {
113 113
 			$last = array_pop( $data );
114 114
 			$ret = implode( ', ', $data ) . " e $last";
115 115
 		} elseif ( $data ) {
116
-			$ret = (string)$data[0];
116
+			$ret = (string)$data[ 0 ];
117 117
 		} else {
118 118
 			$ret = $emptyText;
119 119
 		}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		return $ret;
122 122
 	}
123 123
 
124
-	public function __toString() {
124
+	public function __toString () {
125 125
 		return $this->text();
126 126
 	}
127 127
 }
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
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	 * @inheritDoc
13 13
 	 * @throws APIRequestException
14 14
 	 */
15
-	protected function reallyMakeRequest( string $params ) : string {
15
+	protected function reallyMakeRequest ( string $params ) : string {
16 16
 		$curl = curl_init();
17 17
 		if ( $curl === false ) {
18 18
 			throw new APIRequestException( 'Cannot open cURL handler.' );
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @internal Only used as CB for cURL (CURLOPT_HEADERFUNCTION)
56 56
 	 * @suppress PhanUnreferencedPublicMethod,PhanUnusedPublicNoOverrideMethodParameter
57 57
 	 */
58
-	public function headersHandler( $ch, string $header ) : int {
58
+	public function headersHandler ( $ch, string $header ) : int {
59 59
 		$bits = explode( ':', $header, 2 );
60
-		if ( trim( $bits[0] ) === 'Set-Cookie' ) {
61
-			$this->newCookies[] = $bits[1];
60
+		if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) {
61
+			$this->newCookies[ ] = $bits[ 1 ];
62 62
 		}
63 63
 
64 64
 		return strlen( $header );
Please login to merge, or discard this patch.