@@ -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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @param string $minlevel |
| 17 | 17 | */ |
| 18 | - public function __construct( $minlevel = LogLevel::INFO ) { |
|
| 18 | + public function __construct ( $minlevel = LogLevel::INFO ) { |
|
| 19 | 19 | $this->minLevel = $this->levelToInt( $minlevel ); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param string $level |
| 26 | 26 | * @return int |
| 27 | 27 | */ |
| 28 | - private function levelToInt( string $level ) : int { |
|
| 28 | + private function levelToInt ( string $level ) : int { |
|
| 29 | 29 | // Order matters |
| 30 | 30 | $mapping = [ |
| 31 | 31 | LogLevel::DEBUG, |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @inheritDoc |
| 45 | 45 | * @suppress PhanUnusedPublicMethodParameter |
| 46 | 46 | */ |
| 47 | - public function log( $level, $message, array $context = [] ) { |
|
| 47 | + public function log ( $level, $message, array $context = [ ] ) { |
|
| 48 | 48 | if ( $this->levelToInt( $level ) >= $this->minLevel ) { |
| 49 | 49 | printf( "%s [%s] - %s\n", date( 'd M H:i:s' ), $level, $message ); |
| 50 | 50 | } |
@@ -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 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * @param string $key |
| 28 | 28 | */ |
| 29 | - public function __construct( string $key ) { |
|
| 29 | + public function __construct ( string $key ) { |
|
| 30 | 30 | $this->value = Config::getInstance()->getWikiMessage( $key ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param array $args |
| 35 | 35 | * @return self |
| 36 | 36 | */ |
| 37 | - public function params( array $args ) : self { |
|
| 37 | + public function params ( array $args ) : self { |
|
| 38 | 38 | $this->value = strtr( $this->value, $args ); |
| 39 | 39 | return $this; |
| 40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - public function text() : string { |
|
| 45 | + public function text () : string { |
|
| 46 | 46 | $this->parsePlurals(); |
| 47 | 47 | return $this->value; |
| 48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * Replace {{$plur|<amount>|sing|plur}} |
| 52 | 52 | */ |
| 53 | - protected function parsePlurals() { |
|
| 53 | + protected function parsePlurals () { |
|
| 54 | 54 | $reg = '!\{\{\$plur\|(?P<amount>\d+)\|(?P<sing>[^}|]+)\|(?P<plur>[^|}]+)}}!'; |
| 55 | 55 | |
| 56 | 56 | if ( preg_match( $reg, $this->value ) === 0 ) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->value = preg_replace_callback( |
| 60 | 60 | $reg, |
| 61 | 61 | function ( $matches ) { |
| 62 | - return intval( $matches['amount'] ) > 1 ? trim( $matches['plur'] ) : trim( $matches['sing'] ); |
|
| 62 | + return intval( $matches[ 'amount' ] ) > 1 ? trim( $matches[ 'plur' ] ) : trim( $matches[ 'sing' ] ); |
|
| 63 | 63 | }, |
| 64 | 64 | $this->value |
| 65 | 65 | ); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @suppress PhanUnreferencedPublicMethod |
| 74 | 74 | * @fixme Is this necessary? |
| 75 | 75 | */ |
| 76 | - public static function getTimeWithArticle( int $timestamp ) : string { |
|
| 76 | + public static function getTimeWithArticle ( int $timestamp ) : string { |
|
| 77 | 77 | $oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' ); |
| 78 | 78 | $timeString = strftime( '%e %B alle %R', $timestamp ); |
| 79 | 79 | // Remove the left space if day has a single digit |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string $timeString Full format, e.g. "15 aprile 2019 18:27" |
| 91 | 91 | * @return int |
| 92 | 92 | */ |
| 93 | - public static function getTimestampFromLocalTime( string $timeString ) : int { |
|
| 93 | + public static function getTimestampFromLocalTime ( string $timeString ) : int { |
|
| 94 | 94 | $englishTime = str_ireplace( |
| 95 | 95 | array_values( self::MONTHS ), |
| 96 | 96 | array_keys( self::MONTHS ), |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | * @param string $emptyText |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public static function commaList( array $data, string $emptyText = 'nessuno' ) : string { |
|
| 111 | + public static function commaList ( array $data, string $emptyText = 'nessuno' ) : string { |
|
| 112 | 112 | if ( count( $data ) > 1 ) { |
| 113 | 113 | $last = array_pop( $data ); |
| 114 | 114 | $ret = implode( ', ', $data ) . " e $last"; |
| 115 | 115 | } elseif ( $data ) { |
| 116 | - $ret = (string)$data[0]; |
|
| 116 | + $ret = (string)$data[ 0 ]; |
|
| 117 | 117 | } else { |
| 118 | 118 | $ret = $emptyText; |
| 119 | 119 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return $ret; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function __toString() { |
|
| 124 | + public function __toString () { |
|
| 125 | 125 | return $this->text(); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -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.' ); |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | * @internal Only used as CB for cURL (CURLOPT_HEADERFUNCTION) |
| 56 | 56 | * @suppress PhanUnreferencedPublicMethod,PhanUnusedPublicNoOverrideMethodParameter |
| 57 | 57 | */ |
| 58 | - public function headersHandler( $ch, string $header ) : int { |
|
| 58 | + public function headersHandler ( $ch, string $header ) : int { |
|
| 59 | 59 | $bits = explode( ':', $header, 2 ); |
| 60 | - if ( trim( $bits[0] ) === 'Set-Cookie' ) { |
|
| 61 | - $this->newCookies[] = $bits[1]; |
|
| 60 | + if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) { |
|
| 61 | + $this->newCookies[ ] = $bits[ 1 ]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | 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 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param int $status One of the Task::STATUS_* constants |
| 22 | 22 | * @param string[] $errors |
| 23 | 23 | */ |
| 24 | - public function __construct( int $status, array $errors = [] ) { |
|
| 24 | + public function __construct ( int $status, array $errors = [ ] ) { |
|
| 25 | 25 | $this->status = $status; |
| 26 | 26 | $this->errors = $errors; |
| 27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @return int |
| 31 | 31 | */ |
| 32 | - public function getStatus() : int { |
|
| 32 | + public function getStatus () : int { |
|
| 33 | 33 | return $this->status; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | * @return string[] |
| 38 | 38 | * @suppress PhanUnreferencedPublicMethod |
| 39 | 39 | */ |
| 40 | - public function getErrors() { |
|
| 40 | + public function getErrors () { |
|
| 41 | 41 | return $this->errors; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @param TaskResult $that |
| 46 | 46 | */ |
| 47 | - public function merge( TaskResult $that ) { |
|
| 47 | + public function merge ( TaskResult $that ) { |
|
| 48 | 48 | $this->status |= $that->status; |
| 49 | 49 | $this->errors = array_merge( $this->errors, $that->errors ); |
| 50 | 50 | } |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - public function __toString() { |
|
| 55 | + public function __toString () { |
|
| 56 | 56 | if ( $this->isOK() ) { |
| 57 | 57 | $stat = 'OK'; |
| 58 | 58 | $errs = "\tNo errors."; |
| 59 | 59 | } else { |
| 60 | 60 | $stat = 'ERROR'; |
| 61 | - $formattedErrs = []; |
|
| 61 | + $formattedErrs = [ ]; |
|
| 62 | 62 | foreach ( $this->errors as $err ) { |
| 63 | - $formattedErrs[] = "\t - $err"; |
|
| 63 | + $formattedErrs[ ] = "\t - $err"; |
|
| 64 | 64 | } |
| 65 | 65 | $errs = implode( "\n", $formattedErrs ); |
| 66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return bool |
| 74 | 74 | */ |
| 75 | - public function isOK() : bool { |
|
| 75 | + public function isOK () : bool { |
|
| 76 | 76 | return ( $this->status | self::STATUS_GOOD ) === self::STATUS_GOOD; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -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 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @inheritDoc |
| 15 | 15 | */ |
| 16 | - public function runInternal() : int { |
|
| 16 | + public function runInternal () : int { |
|
| 17 | 17 | $pages = $this->getDataProvider()->getCreatedPages(); |
| 18 | 18 | |
| 19 | 19 | if ( !$pages ) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param PageRiconferma[] $pages |
| 37 | 37 | */ |
| 38 | - protected function addToMainPage( array $pages ) { |
|
| 38 | + protected function addToMainPage ( array $pages ) { |
|
| 39 | 39 | $this->getLogger()->info( |
| 40 | 40 | 'Adding the following to main: ' . implode( ', ', $pages ) |
| 41 | 41 | ); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param PageRiconferma[] $pages |
| 70 | 70 | */ |
| 71 | - protected function addToVotazioni( array $pages ) { |
|
| 71 | + protected function addToVotazioni ( array $pages ) { |
|
| 72 | 72 | $this->getLogger()->info( |
| 73 | 73 | 'Adding the following to votes: ' . implode( ', ', $pages ) |
| 74 | 74 | ); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param int $amount |
| 106 | 106 | * @throws TaskException |
| 107 | 107 | */ |
| 108 | - protected function addToNews( int $amount ) { |
|
| 108 | + protected function addToNews ( int $amount ) { |
|
| 109 | 109 | $this->getLogger()->info( "Increasing the news counter by $amount" ); |
| 110 | 110 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
| 111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $matches = $newsPage->getMatch( $reg ); |
| 120 | 120 | |
| 121 | - $newNum = (int)$matches[2] + $amount; |
|
| 121 | + $newNum = (int)$matches[ 2 ] + $amount; |
|
| 122 | 122 | $newContent = preg_replace( $reg, '${1}' . $newNum, $content ); |
| 123 | 123 | |
| 124 | 124 | $summary = $this->msg( 'news-page-summary' ) |
@@ -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 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param Logger $logger |
| 55 | 55 | * @param Wiki $wiki |
| 56 | 56 | */ |
| 57 | - public function __construct( Logger $logger, Wiki $wiki ) { |
|
| 57 | + public function __construct ( Logger $logger, Wiki $wiki ) { |
|
| 58 | 58 | $this->logger = $logger; |
| 59 | 59 | $this->wiki = $wiki; |
| 60 | 60 | $this->provider = new TaskDataProvider( $this->logger, $this->wiki ); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param string|null $name Only used in MODE_TASK and MODE_SUBTASK |
| 68 | 68 | * @return TaskResult |
| 69 | 69 | */ |
| 70 | - public function run( string $mode, string $name = null ) : TaskResult { |
|
| 70 | + public function run ( string $mode, string $name = null ) : TaskResult { |
|
| 71 | 71 | if ( $mode === self::MODE_COMPLETE ) { |
| 72 | 72 | return $this->runAllTasks(); |
| 73 | 73 | } elseif ( $name === null ) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return TaskResult |
| 84 | 84 | */ |
| 85 | - protected function runAllTasks() : TaskResult { |
|
| 85 | + protected function runAllTasks () : TaskResult { |
|
| 86 | 86 | $orderedList = [ |
| 87 | 87 | 'update-list', |
| 88 | 88 | 'start-new', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param string $name |
| 105 | 105 | * @return TaskResult |
| 106 | 106 | */ |
| 107 | - protected function runTask( string $name ) : TaskResult { |
|
| 107 | + protected function runTask ( string $name ) : TaskResult { |
|
| 108 | 108 | if ( !isset( self::TASKS_MAP[ $name ] ) ) { |
| 109 | 109 | throw new \InvalidArgumentException( "'$name' is not a valid task." ); |
| 110 | 110 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @param string $name |
| 120 | 120 | * @return TaskResult |
| 121 | 121 | */ |
| 122 | - protected function runSubtask( string $name ) : TaskResult { |
|
| 122 | + protected function runSubtask ( string $name ) : TaskResult { |
|
| 123 | 123 | if ( !isset( self::SUBTASKS_MAP[ $name ] ) ) { |
| 124 | 124 | throw new \InvalidArgumentException( "'$name' is not a valid subtask." ); |
| 125 | 125 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param string $class |
| 135 | 135 | * @return Task |
| 136 | 136 | */ |
| 137 | - private function getTaskInstance( string $class ) : Task { |
|
| 137 | + private function getTaskInstance ( string $class ) : Task { |
|
| 138 | 138 | return new $class( $this->logger, $this->wiki, $this->provider ); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param string $class |
| 145 | 145 | * @return Subtask |
| 146 | 146 | */ |
| 147 | - private function getSubtaskInstance( string $class ) : Subtask { |
|
| 147 | + private function getSubtaskInstance ( string $class ) : Subtask { |
|
| 148 | 148 | return new $class( $this->logger, $this->wiki, $this->provider ); |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -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,7 +13,7 @@ discard block |
||
| 13 | 13 | /** @var self */ |
| 14 | 14 | private static $instance; |
| 15 | 15 | /** @var array */ |
| 16 | - private $opts = []; |
|
| 16 | + private $opts = [ ]; |
|
| 17 | 17 | /** @var Wiki */ |
| 18 | 18 | private $wiki; |
| 19 | 19 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @param Wiki $wiki |
| 24 | 24 | */ |
| 25 | - private function __construct( Wiki $wiki ) { |
|
| 25 | + private function __construct ( Wiki $wiki ) { |
|
| 26 | 26 | $this->wiki = $wiki; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | * @param Wiki $wiki |
| 34 | 34 | * @throws ConfigException |
| 35 | 35 | */ |
| 36 | - public static function init( array $defaults, Wiki $wiki ) { |
|
| 36 | + public static function init ( array $defaults, Wiki $wiki ) { |
|
| 37 | 37 | if ( self::$instance ) { |
| 38 | 38 | throw new ConfigException( 'Config was already initialized' ); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $inst = new self( $wiki ); |
| 42 | - $inst->set( 'list-title', $defaults['list-title'] ); |
|
| 43 | - $inst->set( 'msg-title', $defaults['msg-title'] ); |
|
| 44 | - $inst->set( 'username', $defaults['username'] ); |
|
| 45 | - $inst->set( 'password', $defaults['password'] ); |
|
| 42 | + $inst->set( 'list-title', $defaults[ 'list-title' ] ); |
|
| 43 | + $inst->set( 'msg-title', $defaults[ 'msg-title' ] ); |
|
| 44 | + $inst->set( 'username', $defaults[ 'username' ] ); |
|
| 45 | + $inst->set( 'password', $defaults[ 'password' ] ); |
|
| 46 | 46 | self::$instance = $inst; |
| 47 | 47 | |
| 48 | 48 | // On-wiki values |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return string |
| 63 | 63 | * @throws ConfigException |
| 64 | 64 | */ |
| 65 | - public function getWikiMessage( string $key ) : string { |
|
| 65 | + public function getWikiMessage ( string $key ) : string { |
|
| 66 | 66 | static $messages = null; |
| 67 | 67 | if ( $messages === null ) { |
| 68 | 68 | try { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if ( !isset( $messages[ $key ] ) ) { |
| 76 | 76 | throw new ConfigException( "Message '$key' does not exist." ); |
| 77 | 77 | } |
| 78 | - return $messages[$key]; |
|
| 78 | + return $messages[ $key ]; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param string $key |
| 85 | 85 | * @param mixed $value |
| 86 | 86 | */ |
| 87 | - protected function set( string $key, $value ) { |
|
| 87 | + protected function set ( string $key, $value ) { |
|
| 88 | 88 | $this->opts[ $key ] = $value; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @return self |
| 95 | 95 | * @throws ConfigException |
| 96 | 96 | */ |
| 97 | - public static function getInstance() : self { |
|
| 97 | + public static function getInstance () : self { |
|
| 98 | 98 | if ( !self::$instance ) { |
| 99 | 99 | throw new ConfigException( 'Config not yet initialized' ); |
| 100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @return mixed |
| 109 | 109 | * @throws ConfigException |
| 110 | 110 | */ |
| 111 | - public function get( string $opt ) { |
|
| 111 | + public function get ( string $opt ) { |
|
| 112 | 112 | if ( !isset( $this->opts[ $opt ] ) ) { |
| 113 | 113 | throw new ConfigException( "Config option '$opt' not set." ); |
| 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; |
| 4 | 4 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @param Logger $logger |
| 20 | 20 | * @param Wiki $wiki |
| 21 | 21 | */ |
| 22 | - public function __construct( Logger $logger, Wiki $wiki ) { |
|
| 22 | + public function __construct ( Logger $logger, Wiki $wiki ) { |
|
| 23 | 23 | $this->logger = $logger; |
| 24 | 24 | $this->wiki = $wiki; |
| 25 | 25 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $mode |
| 31 | 31 | * @param string|null $name |
| 32 | 32 | */ |
| 33 | - private function run( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) { |
|
| 33 | + private function run ( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) { |
|
| 34 | 34 | $activity = $mode === TaskManager::MODE_COMPLETE ? TaskManager::MODE_COMPLETE : "$mode $name"; |
| 35 | 35 | $this->logger->info( "Running $activity" ); |
| 36 | 36 | $manager = new TaskManager( $this->logger, $this->wiki ); |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | $base = "Execution of $activity"; |
| 40 | 40 | if ( $res->isOK() ) { |
| 41 | 41 | $msg = $res->getStatus() === TaskResult::STATUS_NOTHING ? |
| 42 | - ': nothing to do' : |
|
| 43 | - ' completed successfully'; |
|
| 42 | + ': nothing to do' : ' completed successfully'; |
|
| 44 | 43 | $this->logger->info( $base . $msg . ".\n$line\n\n" ); |
| 45 | 44 | } else { |
| 46 | 45 | $this->logger->error( "$base failed.\n$res\n$line\n\n" ); |
@@ -50,7 +49,7 @@ discard block |
||
| 50 | 49 | /** |
| 51 | 50 | * Entry point for the whole process |
| 52 | 51 | */ |
| 53 | - public function runAll() { |
|
| 52 | + public function runAll () { |
|
| 54 | 53 | $this->run(); |
| 55 | 54 | } |
| 56 | 55 | |
@@ -59,7 +58,7 @@ discard block |
||
| 59 | 58 | * |
| 60 | 59 | * @param string $task |
| 61 | 60 | */ |
| 62 | - public function runTask( string $task ) { |
|
| 61 | + public function runTask ( string $task ) { |
|
| 63 | 62 | $this->run( TaskManager::MODE_TASK, $task ); |
| 64 | 63 | } |
| 65 | 64 | |
@@ -68,7 +67,7 @@ discard block |
||
| 68 | 67 | * |
| 69 | 68 | * @param string $subtask |
| 70 | 69 | */ |
| 71 | - public function runSubtask( string $subtask ) { |
|
| 70 | + public function runSubtask ( string $subtask ) { |
|
| 72 | 71 | $this->run( TaskManager::MODE_SUBTASK, $subtask ); |
| 73 | 72 | } |
| 74 | 73 | } |
@@ -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 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param Logger $logger |
| 25 | 25 | * @param Wiki $wiki |
| 26 | 26 | */ |
| 27 | - public function __construct( Logger $logger, Wiki $wiki ) { |
|
| 27 | + public function __construct ( Logger $logger, Wiki $wiki ) { |
|
| 28 | 28 | $this->setLogger( $logger ); |
| 29 | 29 | $this->setConfig( Config::getInstance() ); |
| 30 | 30 | $this->setWiki( $wiki ); |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @return LoggerInterface |
| 35 | 35 | */ |
| 36 | - protected function getLogger() : LoggerInterface { |
|
| 36 | + protected function getLogger () : LoggerInterface { |
|
| 37 | 37 | return $this->logger; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @inheritDoc |
| 42 | 42 | */ |
| 43 | - public function setLogger( LoggerInterface $logger ) { |
|
| 43 | + public function setLogger ( LoggerInterface $logger ) { |
|
| 44 | 44 | $this->logger = $logger; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -50,35 +50,35 @@ discard block |
||
| 50 | 50 | * @param string $optname |
| 51 | 51 | * @return mixed |
| 52 | 52 | */ |
| 53 | - protected function getOpt( string $optname ) { |
|
| 53 | + protected function getOpt ( string $optname ) { |
|
| 54 | 54 | return $this->getConfig()->get( $optname ); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @return Config |
| 59 | 59 | */ |
| 60 | - protected function getConfig() : Config { |
|
| 60 | + protected function getConfig () : Config { |
|
| 61 | 61 | return $this->config; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * @param Config $cfg |
| 66 | 66 | */ |
| 67 | - protected function setConfig( Config $cfg ) { |
|
| 67 | + protected function setConfig ( Config $cfg ) { |
|
| 68 | 68 | $this->config = $cfg; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * @return Wiki |
| 73 | 73 | */ |
| 74 | - protected function getWiki() : Wiki { |
|
| 74 | + protected function getWiki () : Wiki { |
|
| 75 | 75 | return $this->wiki; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @param Wiki $wiki |
| 80 | 80 | */ |
| 81 | - protected function setWiki( Wiki $wiki ) { |
|
| 81 | + protected function setWiki ( Wiki $wiki ) { |
|
| 82 | 82 | $this->wiki = $wiki; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param string $key |
| 89 | 89 | * @return Message |
| 90 | 90 | */ |
| 91 | - protected function msg( string $key ) : Message { |
|
| 91 | + protected function msg ( string $key ) : Message { |
|
| 92 | 92 | return new Message( $key ); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param string $title |
| 99 | 99 | * @return Page |
| 100 | 100 | */ |
| 101 | - protected function getPage( string $title ) : Page { |
|
| 101 | + protected function getPage ( string $title ) : Page { |
|
| 102 | 102 | return new Page( $title, $this->getWiki() ); |
| 103 | 103 | } |
| 104 | 104 | } |