Passed
Push — master ( ff3dfd...1bc13d )
by Daimona
01:30
created
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
 
@@ -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,16 +26,16 @@  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( 'msg-title', $defaults['msg-title'] );
37
-		$inst->set( 'username', $defaults['username'] );
38
-		$inst->set( 'password', $defaults['password'] );
35
+		$inst->set( 'list-title', $defaults[ 'list-title' ] );
36
+		$inst->set( 'msg-title', $defaults[ 'msg-title' ] );
37
+		$inst->set( 'username', $defaults[ 'username' ] );
38
+		$inst->set( 'password', $defaults[ 'password' ] );
39 39
 		self::$instance = $inst;
40 40
 
41 41
 		// On-wiki values
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $key
55 55
 	 * @return string
56 56
 	 */
57
-	public function getWikiMessage( string $key ) : string {
57
+	public function getWikiMessage ( string $key ) : string {
58 58
 		static $messages = null;
59 59
 		if ( $messages === null ) {
60 60
 			try {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		if ( !isset( $messages[ $key ] ) ) {
68 68
 			throw new ConfigException( "Message '$key' does not exist." );
69 69
 		}
70
-		return $messages[$key];
70
+		return $messages[ $key ];
71 71
 	}
72 72
 	/**
73 73
 	 * Set a config value.
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param string $key
76 76
 	 * @param mixed $value
77 77
 	 */
78
-	protected function set( string $key, $value ) {
78
+	protected function set ( string $key, $value ) {
79 79
 		$this->opts[ $key ] = $value;
80 80
 	}
81 81
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return self
86 86
 	 * @throws ConfigException
87 87
 	 */
88
-	public static function getInstance() : self {
88
+	public static function getInstance () : self {
89 89
 		if ( !self::$instance ) {
90 90
 			throw new ConfigException( 'Config not yet initialized' );
91 91
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return mixed
100 100
 	 * @throws ConfigException
101 101
 	 */
102
-	public function get( string $opt ) {
102
+	public function get ( string $opt ) {
103 103
 		if ( !isset( $this->opts[ $opt ] ) ) {
104 104
 			throw new ConfigException( "Config option '$opt' not set." );
105 105
 		}
Please login to merge, or discard this patch.