@@ -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 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @inheritDoc |
| 11 | 11 | */ |
| 12 | - protected function reallyMakeRequest( string $params ) : string { |
|
| 12 | + protected function reallyMakeRequest ( string $params ) : string { |
|
| 13 | 13 | $context = [ |
| 14 | 14 | 'http' => [ |
| 15 | 15 | 'method' => $this->method, |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | ]; |
| 19 | 19 | $url = $this->url; |
| 20 | 20 | if ( $this->method === self::METHOD_POST ) { |
| 21 | - $context['http']['content'] = $params; |
|
| 21 | + $context[ 'http' ][ 'content' ] = $params; |
|
| 22 | 22 | } else { |
| 23 | 23 | $url = "$url?$params"; |
| 24 | 24 | } |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | foreach ( $http_response_header as $header ) { |
| 29 | 29 | $bits = explode( ':', $header, 2 ); |
| 30 | - if ( trim( $bits[0] ) === 'Set-Cookie' ) { |
|
| 31 | - $this->newCookies[] = $bits[1]; |
|
| 30 | + if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) { |
|
| 31 | + $this->newCookies[ ] = $bits[ 1 ]; |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -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 @@ |
||
| 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 @@ |
||
| 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; |
| 4 | 4 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param Wiki $wiki |
| 21 | 21 | * @param string $msgTitle |
| 22 | 22 | */ |
| 23 | - public function __construct( Wiki $wiki, string $msgTitle ) { |
|
| 23 | + public function __construct ( Wiki $wiki, string $msgTitle ) { |
|
| 24 | 24 | $this->wiki = $wiki; |
| 25 | 25 | $this->msgTitle = $msgTitle; |
| 26 | 26 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @throws MessagesPageDoesNotExistException |
| 30 | 30 | */ |
| 31 | - private function grabWikiMessages() : void { |
|
| 31 | + private function grabWikiMessages () : void { |
|
| 32 | 32 | if ( self::$messages !== null ) { |
| 33 | 33 | return; |
| 34 | 34 | } |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | * @return Message |
| 46 | 46 | * @throws MessageNotFoundException |
| 47 | 47 | */ |
| 48 | - public function getMessage( string $key ) : Message { |
|
| 48 | + public function getMessage ( string $key ) : Message { |
|
| 49 | 49 | $this->grabWikiMessages(); |
| 50 | 50 | if ( !isset( self::$messages[ $key ] ) ) { |
| 51 | 51 | throw new MessageNotFoundException( "Message '$key' does not exist." ); |
| 52 | 52 | } |
| 53 | 53 | // @phan-suppress-next-line PhanTypeArraySuspiciousNullable |
| 54 | - return new Message( self::$messages[$key] ); |
|
| 54 | + return new Message( self::$messages[ $key ] ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
@@ -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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @param string $username |
| 16 | 16 | * @param string $password |
| 17 | 17 | */ |
| 18 | - public function __construct( string $username, string $password ) { |
|
| 18 | + public function __construct ( string $username, string $password ) { |
|
| 19 | 19 | $this->username = $username; |
| 20 | 20 | $this->password = $password; |
| 21 | 21 | } |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | - public function getUsername() : string { |
|
| 26 | + public function getUsername () : string { |
|
| 27 | 27 | return $this->username; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public function getPassword() : string { |
|
| 33 | + public function getPassword () : string { |
|
| 34 | 34 | return $this->password; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Logger; |
| 4 | 4 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string $summary |
| 30 | 30 | * @param string $minlevel |
| 31 | 31 | */ |
| 32 | - public function __construct( Page $logPage, string $summary, $minlevel = LogLevel::INFO ) { |
|
| 32 | + public function __construct ( Page $logPage, string $summary, $minlevel = LogLevel::INFO ) { |
|
| 33 | 33 | $this->minLevel = $this->levelToInt( $minlevel ); |
| 34 | 34 | $this->logPage = $logPage; |
| 35 | 35 | $this->summary = $summary; |
@@ -39,16 +39,16 @@ discard block |
||
| 39 | 39 | * @inheritDoc |
| 40 | 40 | * @suppress PhanUnusedPublicMethodParameter |
| 41 | 41 | */ |
| 42 | - public function log( $level, $message, array $context = [] ) :void { |
|
| 42 | + public function log ( $level, $message, array $context = [ ] ) :void { |
|
| 43 | 43 | if ( $this->levelToInt( $level ) >= $this->minLevel ) { |
| 44 | - $this->buffer[] = $this->getFormattedMessage( $level, $message ); |
|
| 44 | + $this->buffer[ ] = $this->getFormattedMessage( $level, $message ); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - protected function getOutput() : string { |
|
| 51 | + protected function getOutput () : string { |
|
| 52 | 52 | $line = str_repeat( '-', 80 ); |
| 53 | 53 | return "\n\n" . implode( "\n", $this->buffer ) . "\n$line\n\n"; |
| 54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * @inheritDoc |
| 58 | 58 | */ |
| 59 | - public function flush() : void { |
|
| 59 | + public function flush () : void { |
|
| 60 | 60 | if ( $this->buffer ) { |
| 61 | 61 | $this->logPage->edit( [ |
| 62 | 62 | 'appendtext' => $this->getOutput(), |
@@ -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\Subtask; |
| 4 | 4 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * @inheritDoc |
| 14 | 14 | */ |
| 15 | - public function runInternal() : int { |
|
| 15 | + public function runInternal () : int { |
|
| 16 | 16 | $pages = $this->getDataProvider()->getCreatedPages(); |
| 17 | 17 | $users = $this->getDataProvider()->getUsersToProcess(); |
| 18 | 18 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | return TaskResult::STATUS_NOTHING; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $ricNums = []; |
|
| 23 | + $ricNums = [ ]; |
|
| 24 | 24 | foreach ( $pages as $page ) { |
| 25 | 25 | $ricNums[ $page->getUserName() ] = $page->getNum(); |
| 26 | 26 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param User $user |
| 39 | 39 | * @param int $ricNum |
| 40 | 40 | */ |
| 41 | - protected function addMsg( User $user, int $ricNum ) : void { |
|
| 41 | + protected function addMsg ( User $user, int $ricNum ) : void { |
|
| 42 | 42 | $this->getLogger()->info( "Leaving msg to $user" ); |
| 43 | 43 | $msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text(); |
| 44 | 44 | |
@@ -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 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param MessageProvider $mp |
| 63 | 63 | * @param PageBotList $pbl |
| 64 | 64 | */ |
| 65 | - public function __construct( |
|
| 65 | + public function __construct ( |
|
| 66 | 66 | LoggerInterface $logger, |
| 67 | 67 | WikiGroup $wikiGroup, |
| 68 | 68 | MessageProvider $mp, |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param string|null $name Only used in MODE_TASK and MODE_SUBTASK |
| 88 | 88 | * @return TaskResult |
| 89 | 89 | */ |
| 90 | - public function run( string $mode, string $name = null ) : TaskResult { |
|
| 90 | + public function run ( string $mode, string $name = null ) : TaskResult { |
|
| 91 | 91 | if ( $mode === self::MODE_COMPLETE ) { |
| 92 | 92 | return $this->runAllTasks(); |
| 93 | 93 | } elseif ( $name === null ) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @return TaskResult |
| 104 | 104 | */ |
| 105 | - protected function runAllTasks() : TaskResult { |
|
| 105 | + protected function runAllTasks () : TaskResult { |
|
| 106 | 106 | $orderedList = [ |
| 107 | 107 | 'update-list', |
| 108 | 108 | 'start-new', |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param string $name |
| 125 | 125 | * @return TaskResult |
| 126 | 126 | */ |
| 127 | - protected function runTask( string $name ) : TaskResult { |
|
| 127 | + protected function runTask ( string $name ) : TaskResult { |
|
| 128 | 128 | if ( !isset( self::TASKS_MAP[ $name ] ) ) { |
| 129 | 129 | throw new \InvalidArgumentException( "'$name' is not a valid task." ); |
| 130 | 130 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $name |
| 139 | 139 | * @return TaskResult |
| 140 | 140 | */ |
| 141 | - protected function runSubtask( string $name ) : TaskResult { |
|
| 141 | + protected function runSubtask ( string $name ) : TaskResult { |
|
| 142 | 142 | if ( !isset( self::SUBTASKS_MAP[ $name ] ) ) { |
| 143 | 143 | throw new \InvalidArgumentException( "'$name' is not a valid subtask." ); |
| 144 | 144 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @param string $name |
| 154 | 154 | * @return Task |
| 155 | 155 | */ |
| 156 | - private function getTaskInstance( string $name ) : Task { |
|
| 156 | + private function getTaskInstance ( string $name ) : Task { |
|
| 157 | 157 | $class = self::TASKS_MAP[ $name ]; |
| 158 | 158 | /** @var Task $ret */ |
| 159 | 159 | $ret = new $class( |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param string $class |
| 173 | 173 | * @return Subtask |
| 174 | 174 | */ |
| 175 | - private function getSubtaskInstance( string $class ) : Subtask { |
|
| 175 | + private function getSubtaskInstance ( string $class ) : Subtask { |
|
| 176 | 176 | /** @var Subtask $ret */ |
| 177 | 177 | $ret = new $class( |
| 178 | 178 | $this->logger, |