Passed
Push — master ( c340dc...3f8940 )
by Daimona
05:13 queued 03:33
created
includes/CLI.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @return bool
59 59
 	 */
60
-	public static function isCLI() : bool {
60
+	public static function isCLI () : bool {
61 61
 		return PHP_SAPI === 'cli';
62 62
 	}
63 63
 
64 64
 	/**
65 65
 	 * Populate options and check for required ones
66 66
 	 */
67
-	public function __construct() {
67
+	public function __construct () {
68 68
 		$opts = getopt( self::SHORT_OPTS, self::LONG_OPTS );
69 69
 		$this->checkRequired( $opts );
70 70
 		$this->canonicalize( $opts );
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	/**
75 75
 	 * @param array $opts
76 76
 	 */
77
-	private function checkRequired( array $opts ) {
77
+	private function checkRequired ( array $opts ) {
78 78
 		foreach ( self::REQUIRED_OPTS as $opt ) {
79 79
 			if ( !array_key_exists( $opt, $opts ) ) {
80 80
 				exit( "Required option $opt missing." );
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param array &$opts
107 107
 	 */
108
-	private function canonicalize( array &$opts ) {
108
+	private function canonicalize ( array &$opts ) {
109 109
 		if ( array_key_exists( 'use-password-file', $opts ) ) {
110 110
 			$pw = file_get_contents( self::PASSWORD_FILE );
111
-			$opts['password'] = $pw;
112
-			unset( $opts['use-password-file'] );
111
+			$opts[ 'password' ] = $pw;
112
+			unset( $opts[ 'use-password-file' ] );
113 113
 		}
114 114
 	}
115 115
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * These are the options required by Config.
118 118
 	 * @return array
119 119
 	 */
120
-	public function getMainOpts() : array {
120
+	public function getMainOpts () : array {
121 121
 		return array_intersect_key(
122 122
 			$this->opts,
123 123
 			array_fill_keys( Config::REQUIRED_OPTS, true )
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	 * @param mixed|null $default
130 130
 	 * @return mixed
131 131
 	 */
132
-	public function getOpt( string $opt, $default = null ) {
133
-		return $this->opts[$opt] ?? $default;
132
+	public function getOpt ( string $opt, $default = null ) {
133
+		return $this->opts[ $opt ] ?? $default;
134 134
 	}
135 135
 
136 136
 	/**
137 137
 	 * @return array Either [ 'task' => taskname ] or [ 'subtask' => subtaskname ]
138 138
 	 */
139
-	public function getTaskOpt() : array {
139
+	public function getTaskOpt () : array {
140 140
 		return array_intersect_key(
141 141
 			$this->opts,
142 142
 			[ 'task' => true, 'subtask' => true ]
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	/**
147 147
 	 * @return string|null
148 148
 	 */
149
-	public function getURL() : ?string {
149
+	public function getURL () : ?string {
150 150
 		return $this->getOpt( 'force-url' );
151 151
 	}
152 152
 }
Please login to merge, or discard this patch.