@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Wiki; |
4 | 4 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return string |
13 | 13 | */ |
14 | - abstract public function getRegex() : string; |
|
14 | + abstract public function getRegex () : string; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Get a regex matching any element in the given array |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @return string |
21 | 21 | * @todo Is this the right place? |
22 | 22 | */ |
23 | - public static function regexFromArray( array $elements ) : string { |
|
24 | - $bits = []; |
|
23 | + public static function regexFromArray ( array $elements ) : string { |
|
24 | + $bits = [ ]; |
|
25 | 25 | foreach ( $elements as $el ) { |
26 | - $bits[] = $el->getRegex(); |
|
26 | + $bits[ ] = $el->getRegex(); |
|
27 | 27 | } |
28 | 28 | return '(?:' . implode( '|', $bits ) . ')'; |
29 | 29 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Task; |
4 | 4 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | abstract class TaskBase extends ContextSource { |
13 | 13 | /** @var string[] */ |
14 | - protected $errors = []; |
|
14 | + protected $errors = [ ]; |
|
15 | 15 | /** @var TaskDataProvider */ |
16 | 16 | protected $dataProvider; |
17 | 17 | |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param TaskDataProvider $dataProvider |
22 | 22 | */ |
23 | - final public function __construct( TaskDataProvider $dataProvider ) { |
|
23 | + final public function __construct ( TaskDataProvider $dataProvider ) { |
|
24 | 24 | set_exception_handler( [ $this, 'handleException' ] ); |
25 | 25 | set_error_handler( [ $this, 'handleError' ] ); |
26 | 26 | parent::__construct(); |
27 | 27 | $this->dataProvider = $dataProvider; |
28 | 28 | } |
29 | 29 | |
30 | - public function __destruct() { |
|
30 | + public function __destruct () { |
|
31 | 31 | restore_error_handler(); |
32 | 32 | restore_exception_handler(); |
33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return TaskResult |
39 | 39 | */ |
40 | - final public function run() : TaskResult { |
|
40 | + final public function run () : TaskResult { |
|
41 | 41 | $class = ( new \ReflectionClass( $this ) )->getShortName(); |
42 | 42 | $opName = $this->getOperationName(); |
43 | 43 | $this->getLogger()->info( "Starting $opName $class" ); |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return int One of the STATUS_* constants |
70 | 70 | */ |
71 | - abstract protected function runInternal() : int; |
|
71 | + abstract protected function runInternal () : int; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * How this operation should be called in logs |
75 | 75 | * |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - abstract public function getOperationName() : string; |
|
78 | + abstract public function getOperationName () : string; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Exception handler. |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param \Throwable $ex |
84 | 84 | * @protected |
85 | 85 | */ |
86 | - public function handleException( \Throwable $ex ) { |
|
86 | + public function handleException ( \Throwable $ex ) { |
|
87 | 87 | $this->getLogger()->error( |
88 | 88 | ( new \ReflectionClass( $ex ) )->getShortName() . ': ' . |
89 | 89 | $ex->getMessage() . "\nin " . $ex->getFile() . ' line ' . |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | * @throws \ErrorException |
102 | 102 | * @protected |
103 | 103 | */ |
104 | - public function handleError( $errno, $errstr, $errfile, $errline ) { |
|
104 | + public function handleError ( $errno, $errstr, $errfile, $errline ) { |
|
105 | 105 | throw new \ErrorException( $errstr, 0, $errno, $errfile, $errline ); |
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * @return TaskDataProvider |
110 | 110 | */ |
111 | - protected function getDataProvider() : TaskDataProvider { |
|
111 | + protected function getDataProvider () : TaskDataProvider { |
|
112 | 112 | return $this->dataProvider; |
113 | 113 | } |
114 | 114 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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.' ); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | * @return int |
55 | 55 | * @internal Only used as CB for cURL |
56 | 56 | */ |
57 | - public function headersHandler( $ch, string $header ) : int { |
|
57 | + public function headersHandler ( $ch, string $header ) : int { |
|
58 | 58 | $bits = explode( ':', $header, 2 ); |
59 | - if ( trim( $bits[0] ) === 'Set-Cookie' ) { |
|
60 | - $this->newCookies[] = $bits[1]; |
|
59 | + if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) { |
|
60 | + $this->newCookies[ ] = $bits[ 1 ]; |
|
61 | 61 | } |
62 | 62 | // @phan-suppress-next-line PhanTypeMismatchReturn WTF? Why does phan thinks this is a string? |
63 | 63 | return strlen( $header ); |
@@ -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 | |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | /** @var self */ |
14 | 14 | private static $instance; |
15 | 15 | /** @var array */ |
16 | - private $opts = []; |
|
16 | + private $opts = [ ]; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Use self::init() and self::getInstance() |
20 | 20 | */ |
21 | - private function __construct() { |
|
21 | + private function __construct () { |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | * @param array $defaults |
28 | 28 | * @throws ConfigException |
29 | 29 | */ |
30 | - public static function init( array $defaults ) { |
|
30 | + public static function init ( array $defaults ) { |
|
31 | 31 | if ( self::$instance ) { |
32 | 32 | throw new ConfigException( 'Config was already initialized' ); |
33 | 33 | } |
34 | 34 | |
35 | 35 | $inst = new self; |
36 | - $inst->set( 'list-title', $defaults['list-title'] ); |
|
37 | - $inst->set( 'msg-title', $defaults['msg-title'] ); |
|
38 | - $inst->set( 'username', $defaults['username'] ); |
|
39 | - $inst->set( 'password', $defaults['password'] ); |
|
36 | + $inst->set( 'list-title', $defaults[ 'list-title' ] ); |
|
37 | + $inst->set( 'msg-title', $defaults[ 'msg-title' ] ); |
|
38 | + $inst->set( 'username', $defaults[ 'username' ] ); |
|
39 | + $inst->set( 'password', $defaults[ 'password' ] ); |
|
40 | 40 | self::$instance = $inst; |
41 | 41 | |
42 | 42 | // On-wiki values |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | * @throws ConfigException |
58 | 58 | */ |
59 | - public function getWikiMessage( string $key ) : string { |
|
59 | + public function getWikiMessage ( string $key ) : string { |
|
60 | 60 | static $messages = null; |
61 | 61 | if ( $messages === null ) { |
62 | 62 | try { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ( !isset( $messages[ $key ] ) ) { |
70 | 70 | throw new ConfigException( "Message '$key' does not exist." ); |
71 | 71 | } |
72 | - return $messages[$key]; |
|
72 | + return $messages[ $key ]; |
|
73 | 73 | } |
74 | 74 | /** |
75 | 75 | * Set a config value. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param string $key |
78 | 78 | * @param mixed $value |
79 | 79 | */ |
80 | - protected function set( string $key, $value ) { |
|
80 | + protected function set ( string $key, $value ) { |
|
81 | 81 | $this->opts[ $key ] = $value; |
82 | 82 | } |
83 | 83 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return self |
88 | 88 | * @throws ConfigException |
89 | 89 | */ |
90 | - public static function getInstance() : self { |
|
90 | + public static function getInstance () : self { |
|
91 | 91 | if ( !self::$instance ) { |
92 | 92 | throw new ConfigException( 'Config not yet initialized' ); |
93 | 93 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return mixed |
102 | 102 | * @throws ConfigException |
103 | 103 | */ |
104 | - public function get( string $opt ) { |
|
104 | + public function get ( string $opt ) { |
|
105 | 105 | if ( !isset( $this->opts[ $opt ] ) ) { |
106 | 106 | throw new ConfigException( "Config option '$opt' not set." ); |
107 | 107 | } |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | const VERSION = '1.0'; |
13 | 13 | |
14 | - public function __construct() { |
|
14 | + public function __construct () { |
|
15 | 15 | $this->logger = new Logger; |
16 | 16 | } |
17 | 17 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $mode |
22 | 22 | * @param string|null $name |
23 | 23 | */ |
24 | - private function run( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) { |
|
24 | + private function run ( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) { |
|
25 | 25 | $activity = $mode === TaskManager::MODE_COMPLETE ? TaskManager::MODE_COMPLETE : "$mode $name"; |
26 | 26 | $this->logger->info( "Running $activity" ); |
27 | 27 | $manager = new TaskManager; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Entry point for the whole process |
39 | 39 | */ |
40 | - public function runAll() { |
|
40 | + public function runAll () { |
|
41 | 41 | $this->run(); |
42 | 42 | } |
43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param string $task |
48 | 48 | */ |
49 | - public function runTask( string $task ) { |
|
49 | + public function runTask ( string $task ) { |
|
50 | 50 | $this->run( TaskManager::MODE_TASK, $task ); |
51 | 51 | } |
52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param string $subtask |
57 | 57 | */ |
58 | - public function runSubtask( string $subtask ) { |
|
58 | + public function runSubtask ( string $subtask ) { |
|
59 | 59 | $this->run( TaskManager::MODE_SUBTASK, $subtask ); |
60 | 60 | } |
61 | 61 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Exception; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Wiki\Page; |
4 | 4 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @private Use self::get() |
13 | 13 | */ |
14 | - public function __construct() { |
|
14 | + public function __construct () { |
|
15 | 15 | parent::__construct( Config::getInstance()->get( 'list-title' ) ); |
16 | 16 | } |
17 | 17 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return self |
22 | 22 | */ |
23 | - public static function get() : self { |
|
23 | + public static function get () : self { |
|
24 | 24 | static $instance = null; |
25 | 25 | if ( $instance === null ) { |
26 | 26 | $instance = new self; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param string[] $groups |
33 | 33 | * @return int|null |
34 | 34 | */ |
35 | - public static function getOverrideTimestamp( array $groups ) : ?int { |
|
35 | + public static function getOverrideTimestamp ( array $groups ) : ?int { |
|
36 | 36 | if ( array_intersect_key( $groups, [ 'override-perm' => true, 'override' => true ] ) ) { |
37 | 37 | // A one-time override takes precedence |
38 | 38 | $day = $groups[ 'override' ] ?? $groups[ 'override-perm' ]; |
@@ -48,17 +48,15 @@ discard block |
||
48 | 48 | * @param array $groups |
49 | 49 | * @return int |
50 | 50 | */ |
51 | - public static function getValidFlagTimestamp( array $groups ): int { |
|
52 | - $checkuser = isset( $groups['checkuser'] ) ? |
|
53 | - \DateTime::createFromFormat( 'd/m/Y', $groups['checkuser'] )->getTimestamp() : |
|
54 | - 0; |
|
55 | - $bureaucrat = isset( $groups['bureaucrat'] ) ? |
|
56 | - \DateTime::createFromFormat( 'd/m/Y', $groups['bureaucrat'] )->getTimestamp() : |
|
57 | - 0; |
|
51 | + public static function getValidFlagTimestamp ( array $groups ): int { |
|
52 | + $checkuser = isset( $groups[ 'checkuser' ] ) ? |
|
53 | + \DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0; |
|
54 | + $bureaucrat = isset( $groups[ 'bureaucrat' ] ) ? |
|
55 | + \DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0; |
|
58 | 56 | |
59 | 57 | $timestamp = max( $bureaucrat, $checkuser ); |
60 | 58 | if ( $timestamp === 0 ) { |
61 | - $timestamp = \DateTime::createFromFormat( 'd/m/Y', $groups['sysop'] )->getTimestamp(); |
|
59 | + $timestamp = \DateTime::createFromFormat( 'd/m/Y', $groups[ 'sysop' ] )->getTimestamp(); |
|
62 | 60 | } |
63 | 61 | return $timestamp; |
64 | 62 | } |
@@ -68,7 +66,7 @@ discard block |
||
68 | 66 | * |
69 | 67 | * @return array[] |
70 | 68 | */ |
71 | - public function getAdminsList() : array { |
|
69 | + public function getAdminsList () : array { |
|
72 | 70 | return json_decode( $this->getContent(), true ); |
73 | 71 | } |
74 | 72 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Request; |
4 | 4 | |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | /** @var string */ |
31 | 31 | protected $method = 'GET'; |
32 | 32 | /** @var string[] */ |
33 | - protected $newCookies = []; |
|
33 | + protected $newCookies = [ ]; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Use self::newFromParams, which will provide the right class to use |
37 | 37 | * |
38 | 38 | * @param array $params |
39 | 39 | */ |
40 | - protected function __construct( array $params ) { |
|
40 | + protected function __construct ( array $params ) { |
|
41 | 41 | $this->params = [ 'format' => 'json' ] + $params; |
42 | 42 | $this->url = DEFAULT_URL; |
43 | 43 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param array $params |
49 | 49 | * @return self |
50 | 50 | */ |
51 | - public static function newFromParams( array $params ) : self { |
|
51 | + public static function newFromParams ( array $params ) : self { |
|
52 | 52 | if ( extension_loaded( 'curl' ) ) { |
53 | 53 | $ret = new CurlRequest( $params ); |
54 | 54 | } else { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return self For chaining |
64 | 64 | */ |
65 | - public function setPost() : self { |
|
65 | + public function setPost () : self { |
|
66 | 66 | $this->method = 'POST'; |
67 | 67 | return $this; |
68 | 68 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string $url |
74 | 74 | * @return self for chaining |
75 | 75 | */ |
76 | - public function setUrl( string $url ) : self { |
|
76 | + public function setUrl ( string $url ) : self { |
|
77 | 77 | $this->url = $url; |
78 | 78 | return $this; |
79 | 79 | } |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return \stdClass |
85 | 85 | */ |
86 | - public function execute() : \stdClass { |
|
86 | + public function execute () : \stdClass { |
|
87 | 87 | $curParams = $this->params; |
88 | - $sets = []; |
|
88 | + $sets = [ ]; |
|
89 | 89 | do { |
90 | 90 | $res = $this->makeRequestInternal( $curParams ); |
91 | 91 | |
92 | 92 | $this->handleErrorAndWarnings( $res ); |
93 | - $sets[] = $res; |
|
93 | + $sets[ ] = $res; |
|
94 | 94 | |
95 | 95 | $finished = true; |
96 | 96 | if ( isset( $res->continue ) ) { |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * @param array $params |
109 | 109 | * @return \stdClass |
110 | 110 | */ |
111 | - private function makeRequestInternal( array $params ) : \stdClass { |
|
111 | + private function makeRequestInternal ( array $params ) : \stdClass { |
|
112 | 112 | if ( $this->method === 'POST' ) { |
113 | - $params['maxlag'] = self::MAXLAG; |
|
113 | + $params[ 'maxlag' ] = self::MAXLAG; |
|
114 | 114 | } |
115 | 115 | $params = http_build_query( $params ); |
116 | 116 | |
@@ -126,17 +126,17 @@ discard block |
||
126 | 126 | * @param string $params |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - abstract protected function reallyMakeRequest( string $params ) : string; |
|
129 | + abstract protected function reallyMakeRequest ( string $params ) : string; |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * After a request, set cookies for the next ones |
133 | 133 | * |
134 | 134 | * @param array $cookies |
135 | 135 | */ |
136 | - protected function setCookies( array $cookies ) { |
|
136 | + protected function setCookies ( array $cookies ) { |
|
137 | 137 | foreach ( $cookies as $cookie ) { |
138 | 138 | $bits = explode( ';', $cookie ); |
139 | - list( $name, $value ) = explode( '=', $bits[0] ); |
|
139 | + list( $name, $value ) = explode( '=', $bits[ 0 ] ); |
|
140 | 140 | self::$cookiesToSet[ $name ] = $value; |
141 | 141 | } |
142 | 142 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param \stdClass $res |
148 | 148 | * @return APIRequestException |
149 | 149 | */ |
150 | - private function getException( \stdClass $res ) : APIRequestException { |
|
150 | + private function getException ( \stdClass $res ) : APIRequestException { |
|
151 | 151 | switch ( $res->error->code ) { |
152 | 152 | case 'missingtitle': |
153 | 153 | $ex = new MissingPageException; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param \stdClass $res |
171 | 171 | * @throws APIRequestException |
172 | 172 | */ |
173 | - protected function handleErrorAndWarnings( \stdClass $res ) { |
|
173 | + protected function handleErrorAndWarnings ( \stdClass $res ) { |
|
174 | 174 | if ( isset( $res->error ) ) { |
175 | 175 | throw $this->getException( $res ); |
176 | 176 | } elseif ( isset( $res->warnings ) ) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param \stdClass[] $sets |
187 | 187 | * @return \stdClass |
188 | 188 | */ |
189 | - private function mergeSets( array $sets ) : \stdClass { |
|
189 | + private function mergeSets ( array $sets ) : \stdClass { |
|
190 | 190 | // Use the first set as template |
191 | 191 | $ret = array_shift( $sets ); |
192 | 192 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param array|\stdClass $second |
204 | 204 | * @return array|\stdClass array |
205 | 205 | */ |
206 | - private function recursiveMerge( $first, $second ) { |
|
206 | + private function recursiveMerge ( $first, $second ) { |
|
207 | 207 | $ret = $first; |
208 | 208 | if ( is_array( $second ) ) { |
209 | 209 | $ret = is_array( $first ) ? array_merge_recursive( $first, $second ) : $second; |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return array |
223 | 223 | */ |
224 | - protected function getHeaders() :array { |
|
224 | + protected function getHeaders () :array { |
|
225 | 225 | $ret = self::HEADERS; |
226 | 226 | if ( self::$cookiesToSet ) { |
227 | - $cookies = []; |
|
227 | + $cookies = [ ]; |
|
228 | 228 | foreach ( self::$cookiesToSet as $cname => $cval ) { |
229 | - $cookies[] = trim( "$cname=$cval" ); |
|
229 | + $cookies[ ] = trim( "$cname=$cval" ); |
|
230 | 230 | } |
231 | - $ret[] = 'Cookie: ' . implode( '; ', $cookies ); |
|
231 | + $ret[ ] = 'Cookie: ' . implode( '; ', $cookies ); |
|
232 | 232 | } |
233 | 233 | return $ret; |
234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param array $headers |
240 | 240 | * @return string |
241 | 241 | */ |
242 | - protected function buildHeadersString( array $headers ) : string { |
|
242 | + protected function buildHeadersString ( array $headers ) : string { |
|
243 | 243 | $ret = ''; |
244 | 244 | foreach ( $headers as $header ) { |
245 | 245 | $ret .= "$header\r\n"; |
@@ -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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** @var Controller */ |
20 | 20 | private $controller; |
21 | 21 | |
22 | - public function __construct() { |
|
22 | + public function __construct () { |
|
23 | 23 | $this->setLogger( new Logger ); |
24 | 24 | $this->setConfig( Config::getInstance() ); |
25 | 25 | $this->setController( new Controller ); |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @return LoggerInterface |
30 | 30 | */ |
31 | - protected function getLogger() : LoggerInterface { |
|
31 | + protected function getLogger () : LoggerInterface { |
|
32 | 32 | return $this->logger; |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @inheritDoc |
37 | 37 | */ |
38 | - public function setLogger( LoggerInterface $logger ) { |
|
38 | + public function setLogger ( LoggerInterface $logger ) { |
|
39 | 39 | $this->logger = $logger; |
40 | 40 | } |
41 | 41 | |
@@ -45,35 +45,35 @@ discard block |
||
45 | 45 | * @param string $optname |
46 | 46 | * @return mixed |
47 | 47 | */ |
48 | - protected function getOpt( string $optname ) { |
|
48 | + protected function getOpt ( string $optname ) { |
|
49 | 49 | return $this->getConfig()->get( $optname ); |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @return Config |
54 | 54 | */ |
55 | - protected function getConfig() : Config { |
|
55 | + protected function getConfig () : Config { |
|
56 | 56 | return $this->config; |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @param Config $cfg |
61 | 61 | */ |
62 | - protected function setConfig( Config $cfg ) { |
|
62 | + protected function setConfig ( Config $cfg ) { |
|
63 | 63 | $this->config = $cfg; |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @return Controller |
68 | 68 | */ |
69 | - protected function getController() : Controller { |
|
69 | + protected function getController () : Controller { |
|
70 | 70 | return $this->controller; |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param Controller $controller |
75 | 75 | */ |
76 | - protected function setController( Controller $controller ) { |
|
76 | + protected function setController ( Controller $controller ) { |
|
77 | 77 | $this->controller = $controller; |
78 | 78 | } |
79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $key |
84 | 84 | * @return Message |
85 | 85 | */ |
86 | - protected function msg( string $key ) : Message { |
|
86 | + protected function msg ( string $key ) : Message { |
|
87 | 87 | return new Message( $key ); |
88 | 88 | } |
89 | 89 | } |