@@ -1,4 +1,4 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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." );  | 
                                                        
@@ -99,11 +99,11 @@ discard block  | 
                                                    ||
| 99 | 99 | /**  | 
                                                        
| 100 | 100 | * @param array &$opts  | 
                                                        
| 101 | 101 | */  | 
                                                        
| 102 | -	private function canonicalize( array &$opts ) { | 
                                                        |
| 102 | +	private function canonicalize ( array &$opts ) { | 
                                                        |
| 103 | 103 |  		if ( array_key_exists( 'use-password-file', $opts ) ) { | 
                                                        
| 104 | 104 | $pw = file_get_contents( self::PASSWORD_FILE );  | 
                                                        
| 105 | - $opts['password'] = $pw;  | 
                                                        |
| 106 | - unset( $opts['use-password-file'] );  | 
                                                        |
| 105 | + $opts[ 'password' ] = $pw;  | 
                                                        |
| 106 | + unset( $opts[ 'use-password-file' ] );  | 
                                                        |
| 107 | 107 | }  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
@@ -111,7 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | * These are the options required by Config.  | 
                                                        
| 112 | 112 | * @return array  | 
                                                        
| 113 | 113 | */  | 
                                                        
| 114 | -	public function getMainOpts() : array { | 
                                                        |
| 114 | +	public function getMainOpts () : array { | 
                                                        |
| 115 | 115 | return array_intersect_key(  | 
                                                        
| 116 | 116 | $this->opts,  | 
                                                        
| 117 | 117 | array_fill_keys( Config::REQUIRED_OPTS, true )  | 
                                                        
@@ -123,14 +123,14 @@ discard block  | 
                                                    ||
| 123 | 123 | * @param mixed $default  | 
                                                        
| 124 | 124 | * @return mixed  | 
                                                        
| 125 | 125 | */  | 
                                                        
| 126 | -	public function getOpt( string $opt, $default = null ) { | 
                                                        |
| 127 | - return $this->opts[$opt] ?? $default;  | 
                                                        |
| 126 | +	public function getOpt ( string $opt, $default = null ) { | 
                                                        |
| 127 | + return $this->opts[ $opt ] ?? $default;  | 
                                                        |
| 128 | 128 | }  | 
                                                        
| 129 | 129 | |
| 130 | 130 | /**  | 
                                                        
| 131 | 131 | * @return array Either [ 'task' => taskname ] or [ 'subtask' => subtaskname ]  | 
                                                        
| 132 | 132 | */  | 
                                                        
| 133 | -	public function getTaskOpt() : array { | 
                                                        |
| 133 | +	public function getTaskOpt () : array { | 
                                                        |
| 134 | 134 | return array_intersect_key(  | 
                                                        
| 135 | 135 | $this->opts,  | 
                                                        
| 136 | 136 | [ 'task' => true, 'subtask' => true ]  | 
                                                        
@@ -140,7 +140,7 @@ discard block  | 
                                                    ||
| 140 | 140 | /**  | 
                                                        
| 141 | 141 | * @return string|null  | 
                                                        
| 142 | 142 | */  | 
                                                        
| 143 | -	public function getURL() : ?string { | 
                                                        |
| 143 | +	public function getURL () : ?string { | 
                                                        |
| 144 | 144 | return $this->getOpt( 'force-url' );  | 
                                                        
| 145 | 145 | }  | 
                                                        
| 146 | 146 | }  | 
                                                        
@@ -1,4 +1,4 @@ discard block  | 
                                                    ||
| 1 | -<?php declare( strict_types=1 );  | 
                                                        |
| 1 | +<?php declare(strict_types=1);  | 
                                                        |
| 2 | 2 | /**  | 
                                                        
| 3 | 3 | * Entry point for the bot, called by CLI  | 
                                                        
| 4 | 4 | */  | 
                                                        
@@ -54,9 +54,9 @@ discard block  | 
                                                    ||
| 54 | 54 | $type = current( array_keys( $taskOpt ) );  | 
                                                        
| 55 | 55 |  try { | 
                                                        
| 56 | 56 |  	if ( $type === 'task' ) { | 
                                                        
| 57 | - $bot->runTask( $taskOpt['task'] );  | 
                                                        |
| 57 | + $bot->runTask( $taskOpt[ 'task' ] );  | 
                                                        |
| 58 | 58 |  	} elseif ( $type === 'subtask' ) { | 
                                                        
| 59 | - $bot->runSubtask( $taskOpt['subtask'] );  | 
                                                        |
| 59 | + $bot->runSubtask( $taskOpt[ 'subtask' ] );  | 
                                                        |
| 60 | 60 |  	} else { | 
                                                        
| 61 | 61 | $bot->runAll();  | 
                                                        
| 62 | 62 | }  |