Passed
Push — master ( cc9b5c...1b315c )
by Daimona
01:50
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
 
@@ -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 array|null Lazy-loaded to avoid unnecessary requests */
18 18
 	private $messages;
19 19
 	/** @var Wiki */
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param Wiki $wiki
26 26
 	 */
27
-	private function __construct( Wiki $wiki ) {
27
+	private function __construct ( Wiki $wiki ) {
28 28
 		$this->wiki = $wiki;
29 29
 	}
30 30
 
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	 * @param Wiki $wiki
36 36
 	 * @throws ConfigException
37 37
 	 */
38
-	public static function init( array $defaults, Wiki $wiki ) {
38
+	public static function init ( array $defaults, Wiki $wiki ) {
39 39
 		if ( self::$instance ) {
40 40
 			throw new ConfigException( 'Config was already initialized' );
41 41
 		}
42 42
 
43 43
 		$inst = new self( $wiki );
44
-		$inst->set( 'list-title', $defaults['list-title'] );
45
-		$inst->set( 'msg-title', $defaults['msg-title'] );
46
-		$inst->set( 'username', $defaults['username'] );
47
-		$inst->set( 'password', $defaults['password'] );
44
+		$inst->set( 'list-title', $defaults[ 'list-title' ] );
45
+		$inst->set( 'msg-title', $defaults[ 'msg-title' ] );
46
+		$inst->set( 'username', $defaults[ 'username' ] );
47
+		$inst->set( 'password', $defaults[ 'password' ] );
48 48
 
49 49
 		// On-wiki values
50 50
 		try {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return string
65 65
 	 * @throws ConfigException
66 66
 	 */
67
-	public function getWikiMessage( string $key ) : string {
67
+	public function getWikiMessage ( string $key ) : string {
68 68
 		if ( $this->messages === null ) {
69 69
 			try {
70 70
 				$cont = $this->wiki->getPageContent( $this->opts[ 'msg-title' ] );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		if ( !isset( $this->messages[ $key ] ) ) {
77 77
 			throw new ConfigException( "Message '$key' does not exist." );
78 78
 		}
79
-		return $this->messages[$key];
79
+		return $this->messages[ $key ];
80 80
 	}
81 81
 
82 82
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @param string $key
86 86
 	 * @param mixed $value
87 87
 	 */
88
-	protected function set( string $key, $value ) {
88
+	protected function set ( string $key, $value ) {
89 89
 		$this->opts[ $key ] = $value;
90 90
 	}
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return self
96 96
 	 * @throws ConfigException
97 97
 	 */
98
-	public static function getInstance() : self {
98
+	public static function getInstance () : self {
99 99
 		if ( !self::$instance ) {
100 100
 			throw new ConfigException( 'Config not yet initialized' );
101 101
 		}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return mixed
110 110
 	 * @throws ConfigException
111 111
 	 */
112
-	public function get( string $opt ) {
112
+	public function get ( string $opt ) {
113 113
 		if ( !isset( $this->opts[ $opt ] ) ) {
114 114
 			throw new ConfigException( "Config option '$opt' not set." );
115 115
 		}
Please login to merge, or discard this patch.