@@ -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 int $status One of the Task::STATUS_* constants |
| 21 | 21 | * @param string[] $errors |
| 22 | 22 | */ |
| 23 | - public function __construct( int $status, array $errors = [] ) { |
|
| 23 | + public function __construct ( int $status, array $errors = [ ] ) { |
|
| 24 | 24 | $this->status = $status; |
| 25 | 25 | $this->errors = $errors; |
| 26 | 26 | } |
@@ -28,21 +28,21 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @return int |
| 30 | 30 | */ |
| 31 | - public function getStatus() : int { |
|
| 31 | + public function getStatus () : int { |
|
| 32 | 32 | return $this->status; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @return string[] |
| 37 | 37 | */ |
| 38 | - public function getErrors() { |
|
| 38 | + public function getErrors () { |
|
| 39 | 39 | return $this->errors; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @param TaskResult $that |
| 44 | 44 | */ |
| 45 | - public function merge( TaskResult $that ) { |
|
| 45 | + public function merge ( TaskResult $that ) { |
|
| 46 | 46 | $this->status |= $that->status; |
| 47 | 47 | $this->errors = array_merge( $this->errors, $that->errors ); |
| 48 | 48 | } |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | - public function __toString() { |
|
| 53 | + public function __toString () { |
|
| 54 | 54 | if ( $this->isOK() ) { |
| 55 | 55 | $stat = 'OK'; |
| 56 | 56 | $errs = "\tNo errors."; |
| 57 | 57 | } else { |
| 58 | 58 | $stat = 'ERROR'; |
| 59 | - $formattedErrs = []; |
|
| 59 | + $formattedErrs = [ ]; |
|
| 60 | 60 | foreach ( $this->errors as $err ) { |
| 61 | - $formattedErrs[] = "\t - $err"; |
|
| 61 | + $formattedErrs[ ] = "\t - $err"; |
|
| 62 | 62 | } |
| 63 | 63 | $errs = implode( "\n", $formattedErrs ); |
| 64 | 64 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return bool |
| 72 | 72 | */ |
| 73 | - public function isOK() : bool { |
|
| 73 | + public function isOK () : bool { |
|
| 74 | 74 | return $this->status === self::STATUS_OK; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -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 | |
@@ -10,20 +10,20 @@ discard block |
||
| 10 | 10 | private $users; |
| 11 | 11 | |
| 12 | 12 | /** @var string[] */ |
| 13 | - private $createdPages = []; |
|
| 13 | + private $createdPages = [ ]; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Get a list of users to execute tasks on. |
| 17 | 17 | * |
| 18 | 18 | * @return array[] |
| 19 | 19 | */ |
| 20 | - public function getUsersToProcess() : array { |
|
| 20 | + public function getUsersToProcess () : array { |
|
| 21 | 21 | if ( $this->users === null ) { |
| 22 | 22 | $this->getLogger()->debug( 'Retrieving users list' ); |
| 23 | 23 | $content = $this->getController()->getPageContent( $this->getConfig()->get( 'list-title' ) ); |
| 24 | 24 | $listUsers = json_decode( $content, true ); |
| 25 | 25 | |
| 26 | - $this->users = []; |
|
| 26 | + $this->users = [ ]; |
|
| 27 | 27 | foreach ( $listUsers as $user => $groups ) { |
| 28 | 28 | $timestamp = $this->getValidTimestamp( $groups ); |
| 29 | 29 | |
@@ -45,13 +45,11 @@ discard block |
||
| 45 | 45 | * @param array $groups |
| 46 | 46 | * @return int |
| 47 | 47 | */ |
| 48 | - private function getValidTimestamp( array $groups ) : int { |
|
| 48 | + private function getValidTimestamp ( array $groups ) : int { |
|
| 49 | 49 | $checkuser = isset( $groups[ 'checkuser' ] ) ? |
| 50 | - \DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : |
|
| 51 | - 0; |
|
| 50 | + \DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0; |
|
| 52 | 51 | $bureaucrat = isset( $groups[ 'bureaucrat' ] ) ? |
| 53 | - \DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : |
|
| 54 | - 0; |
|
| 52 | + \DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0; |
|
| 55 | 53 | |
| 56 | 54 | $timestamp = max( $bureaucrat, $checkuser ); |
| 57 | 55 | if ( $timestamp === 0 ) { |
@@ -65,21 +63,21 @@ discard block |
||
| 65 | 63 | * |
| 66 | 64 | * @param string $name |
| 67 | 65 | */ |
| 68 | - public function removeUser( string $name ) { |
|
| 66 | + public function removeUser ( string $name ) { |
|
| 69 | 67 | unset( $this->users[ $name ] ); |
| 70 | 68 | } |
| 71 | 69 | |
| 72 | 70 | /** |
| 73 | 71 | * @return string[] |
| 74 | 72 | */ |
| 75 | - public function getCreatedPages() : array { |
|
| 73 | + public function getCreatedPages () : array { |
|
| 76 | 74 | return $this->createdPages; |
| 77 | 75 | } |
| 78 | 76 | |
| 79 | 77 | /** |
| 80 | 78 | * @param string $title |
| 81 | 79 | */ |
| 82 | - public function addCreatedPages( string $title ) { |
|
| 83 | - $this->createdPages[] = $title; |
|
| 80 | + public function addCreatedPages ( string $title ) { |
|
| 81 | + $this->createdPages[ ] = $title; |
|
| 84 | 82 | } |
| 85 | 83 | } |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @inheritDoc |
| 13 | 13 | */ |
| 14 | - protected function reallyMakeRequest( string $params ) : string { |
|
| 14 | + protected function reallyMakeRequest ( string $params ) : string { |
|
| 15 | 15 | $curl = curl_init(); |
| 16 | 16 | if ( $curl === false ) { |
| 17 | 17 | throw new APIRequestException( 'Cannot open cURL handler.' ); |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | * @return int |
| 54 | 54 | * @internal Only used as CB for cURL |
| 55 | 55 | */ |
| 56 | - public function headersHandler( $ch, string $header ) : int { |
|
| 56 | + public function headersHandler ( $ch, string $header ) : int { |
|
| 57 | 57 | $bits = explode( ':', $header, 2 ); |
| 58 | - if ( trim( $bits[0] ) === 'Set-Cookie' ) { |
|
| 59 | - $this->newCookies[] = $bits[1]; |
|
| 58 | + if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) { |
|
| 59 | + $this->newCookies[ ] = $bits[ 1 ]; |
|
| 60 | 60 | } |
| 61 | 61 | // @phan-suppress-next-line PhanTypeMismatchReturn WTF? Why does phan thinks this is a string? |
| 62 | 62 | 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\Request; |
| 4 | 4 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** @var string */ |
| 30 | 30 | protected $method; |
| 31 | 31 | /** @var string[] */ |
| 32 | - protected $newCookies = []; |
|
| 32 | + protected $newCookies = [ ]; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Use self::newFromParams, which will provide the right class to use |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param array $params |
| 38 | 38 | * @param bool $isPOST |
| 39 | 39 | */ |
| 40 | - protected function __construct( array $params, bool $isPOST = false ) { |
|
| 40 | + protected function __construct ( array $params, bool $isPOST = false ) { |
|
| 41 | 41 | $this->params = [ 'format' => 'json' ] + $params; |
| 42 | 42 | $this->method = $isPOST ? 'POST' : 'GET'; |
| 43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param bool $isPOST |
| 50 | 50 | * @return self |
| 51 | 51 | */ |
| 52 | - public static function newFromParams( array $params, bool $isPOST = false ) : self { |
|
| 52 | + public static function newFromParams ( array $params, bool $isPOST = false ) : self { |
|
| 53 | 53 | if ( extension_loaded( 'curl' ) ) { |
| 54 | 54 | $ret = new CurlRequest( $params, $isPOST ); |
| 55 | 55 | } else { |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return \stdClass |
| 65 | 65 | */ |
| 66 | - public function execute() : \stdClass { |
|
| 66 | + public function execute () : \stdClass { |
|
| 67 | 67 | $curParams = $this->params; |
| 68 | - $sets = []; |
|
| 68 | + $sets = [ ]; |
|
| 69 | 69 | do { |
| 70 | 70 | $res = $this->makeRequestInternal( $curParams ); |
| 71 | 71 | |
| 72 | 72 | $this->handleErrorAndWarnings( $res ); |
| 73 | - $sets[] = $res; |
|
| 73 | + $sets[ ] = $res; |
|
| 74 | 74 | |
| 75 | 75 | $finished = true; |
| 76 | 76 | if ( isset( $res->continue ) ) { |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | * @param array $params |
| 89 | 89 | * @return \stdClass |
| 90 | 90 | */ |
| 91 | - private function makeRequestInternal( array $params ) : \stdClass { |
|
| 91 | + private function makeRequestInternal ( array $params ) : \stdClass { |
|
| 92 | 92 | if ( $this->method === 'POST' ) { |
| 93 | - $params['maxlag'] = self::MAXLAG; |
|
| 93 | + $params[ 'maxlag' ] = self::MAXLAG; |
|
| 94 | 94 | } |
| 95 | 95 | $params = http_build_query( $params ); |
| 96 | 96 | |
@@ -106,17 +106,17 @@ discard block |
||
| 106 | 106 | * @param string $params |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | - abstract protected function reallyMakeRequest( string $params ) : string; |
|
| 109 | + abstract protected function reallyMakeRequest ( string $params ) : string; |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * After a request, set cookies for the next ones |
| 113 | 113 | * |
| 114 | 114 | * @param array $cookies |
| 115 | 115 | */ |
| 116 | - protected function setCookies( array $cookies ) { |
|
| 116 | + protected function setCookies ( array $cookies ) { |
|
| 117 | 117 | foreach ( $cookies as $cookie ) { |
| 118 | 118 | $bits = explode( ';', $cookie ); |
| 119 | - list( $name, $value ) = explode( '=', $bits[0] ); |
|
| 119 | + list( $name, $value ) = explode( '=', $bits[ 0 ] ); |
|
| 120 | 120 | self::$cookiesToSet[ $name ] = $value; |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param \stdClass $res |
| 128 | 128 | * @throws APIRequestException |
| 129 | 129 | */ |
| 130 | - protected function handleErrorAndWarnings( $res ) { |
|
| 130 | + protected function handleErrorAndWarnings ( $res ) { |
|
| 131 | 131 | if ( isset( $res->error ) ) { |
| 132 | 132 | switch ( $res->error->code ) { |
| 133 | 133 | case 'missingtitle': |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @param \stdClass[] $sets |
| 154 | 154 | * @return \stdClass |
| 155 | 155 | */ |
| 156 | - private function mergeSets( array $sets ) : \stdClass { |
|
| 156 | + private function mergeSets ( array $sets ) : \stdClass { |
|
| 157 | 157 | // Use the first set as template |
| 158 | 158 | $ret = array_shift( $sets ); |
| 159 | 159 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param array|\stdClass $second |
| 171 | 171 | * @return array|\stdClass array |
| 172 | 172 | */ |
| 173 | - private function recursiveMerge( $first, $second ) { |
|
| 173 | + private function recursiveMerge ( $first, $second ) { |
|
| 174 | 174 | $ret = $first; |
| 175 | 175 | if ( is_array( $second ) ) { |
| 176 | 176 | $ret = is_array( $first ) ? array_merge_recursive( $first, $second ) : $second; |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @return array |
| 195 | 195 | */ |
| 196 | - protected function getHeaders() :array { |
|
| 196 | + protected function getHeaders () :array { |
|
| 197 | 197 | $ret = self::HEADERS; |
| 198 | 198 | if ( self::$cookiesToSet ) { |
| 199 | - $cookies = []; |
|
| 199 | + $cookies = [ ]; |
|
| 200 | 200 | foreach ( self::$cookiesToSet as $cname => $cval ) { |
| 201 | - $cookies[] = trim( "$cname=$cval" ); |
|
| 201 | + $cookies[ ] = trim( "$cname=$cval" ); |
|
| 202 | 202 | } |
| 203 | - $ret[] = 'Cookie: ' . implode( '; ', $cookies ); |
|
| 203 | + $ret[ ] = 'Cookie: ' . implode( '; ', $cookies ); |
|
| 204 | 204 | } |
| 205 | 205 | return $ret; |
| 206 | 206 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param array $headers |
| 212 | 212 | * @return string |
| 213 | 213 | */ |
| 214 | - protected function buildHeadersString( array $headers ) : string { |
|
| 214 | + protected function buildHeadersString ( array $headers ) : string { |
|
| 215 | 215 | $ret = ''; |
| 216 | 216 | foreach ( $headers as $header ) { |
| 217 | 217 | $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\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 = self::$url; |
| 20 | 20 | if ( $this->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 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme; |
| 4 | 4 | |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | /** @var self */ |
| 13 | 13 | private static $instance; |
| 14 | 14 | /** @var array */ |
| 15 | - private $opts = []; |
|
| 15 | + private $opts = [ ]; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Use self::init() and self::getInstance() |
| 19 | 19 | */ |
| 20 | - private function __construct() { |
|
| 20 | + private function __construct () { |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * @param array $defaults |
| 27 | 27 | * @throws ConfigException |
| 28 | 28 | */ |
| 29 | - public static function init( array $defaults ) { |
|
| 29 | + public static function init ( array $defaults ) { |
|
| 30 | 30 | if ( self::$instance ) { |
| 31 | 31 | throw new ConfigException( 'Config was already initialized' ); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $inst = new self; |
| 35 | - $inst->set( 'list-title', $defaults['list-title'] ); |
|
| 36 | - $inst->set( 'username', $defaults['username'] ); |
|
| 37 | - $inst->set( 'password', $defaults['password'] ); |
|
| 35 | + $inst->set( 'list-title', $defaults[ 'list-title' ] ); |
|
| 36 | + $inst->set( 'username', $defaults[ 'username' ] ); |
|
| 37 | + $inst->set( 'password', $defaults[ 'password' ] ); |
|
| 38 | 38 | self::$instance = $inst; |
| 39 | 39 | |
| 40 | 40 | // On-wiki values |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param string $key |
| 56 | 56 | * @param mixed $value |
| 57 | 57 | */ |
| 58 | - protected function set( string $key, $value ) { |
|
| 58 | + protected function set ( string $key, $value ) { |
|
| 59 | 59 | $this->opts[ $key ] = $value; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @return self |
| 66 | 66 | * @throws ConfigException |
| 67 | 67 | */ |
| 68 | - public static function getInstance() : self { |
|
| 68 | + public static function getInstance () : self { |
|
| 69 | 69 | if ( !self::$instance ) { |
| 70 | 70 | throw new ConfigException( 'Config not yet initialized' ); |
| 71 | 71 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return mixed |
| 80 | 80 | * @throws ConfigException |
| 81 | 81 | */ |
| 82 | - public function get( string $opt ) { |
|
| 82 | + public function get ( string $opt ) { |
|
| 83 | 83 | if ( !isset( $this->opts[ $opt ] ) ) { |
| 84 | 84 | throw new ConfigException( "Config option '$opt' not set." ); |
| 85 | 85 | } |
@@ -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 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** @var string[] */ |
| 19 | 19 | private $tokens; |
| 20 | 20 | |
| 21 | - public function __construct() { |
|
| 21 | + public function __construct () { |
|
| 22 | 22 | $this->logger = new Logger; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @return string |
| 30 | 30 | * @throws MissingPageException |
| 31 | 31 | */ |
| 32 | - public function getPageContent( string $title ) : string { |
|
| 32 | + public function getPageContent ( string $title ) : string { |
|
| 33 | 33 | $this->logger->debug( "Retrieving page $title" ); |
| 34 | 34 | $params = [ |
| 35 | 35 | 'action' => 'query', |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | throw new MissingPageException( $title ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - return $page->revisions[0]->slots->main->{ '*' }; |
|
| 50 | + return $page->revisions[ 0 ]->slots->main->{ '*' }; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param array $params |
| 57 | 57 | * @throws APIRequestException |
| 58 | 58 | */ |
| 59 | - public function editPage( array $params ) { |
|
| 59 | + public function editPage ( array $params ) { |
|
| 60 | 60 | $this->login(); |
| 61 | 61 | |
| 62 | 62 | $params = [ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * Login wrapper. Checks if we're already logged in and clears tokens cache |
| 77 | 77 | * @throws LoginException |
| 78 | 78 | */ |
| 79 | - public function login() { |
|
| 79 | + public function login () { |
|
| 80 | 80 | if ( self::$loggedIn ) { |
| 81 | 81 | $this->logger->debug( 'Already logged in' ); |
| 82 | 82 | return; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | self::$loggedIn = true; |
| 106 | 106 | // Clear tokens cache |
| 107 | - $this->tokens = []; |
|
| 107 | + $this->tokens = [ ]; |
|
| 108 | 108 | $this->logger->debug( 'Login succeeded' ); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param string $type |
| 115 | 115 | * @return string |
| 116 | 116 | */ |
| 117 | - public function getToken( string $type ) : string { |
|
| 117 | + public function getToken ( string $type ) : string { |
|
| 118 | 118 | if ( !isset( $this->tokens[ $type ] ) ) { |
| 119 | 119 | $params = [ |
| 120 | 120 | 'action' => 'query', |
@@ -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,14 +11,14 @@ 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 | |
| 18 | 18 | /** |
| 19 | 19 | * Entry point for the whole process |
| 20 | 20 | */ |
| 21 | - public function run() { |
|
| 21 | + public function run () { |
|
| 22 | 22 | $this->logger->info( 'Starting full process.' ); |
| 23 | 23 | $manager = new TaskManager; |
| 24 | 24 | $res = $manager->run( TaskManager::MODE_COMPLETE ); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param string $task |
| 37 | 37 | */ |
| 38 | - public function runSingle( string $task ) { |
|
| 38 | + public function runSingle ( string $task ) { |
|
| 39 | 39 | $this->logger->info( "Starting single task $task." ); |
| 40 | 40 | $manager = new TaskManager; |
| 41 | 41 | $res = $manager->run( TaskManager::MODE_SINGLE, $task ); |
@@ -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,10 +11,10 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @inheritDoc |
| 13 | 13 | */ |
| 14 | - public function run() : TaskResult { |
|
| 14 | + public function run () : TaskResult { |
|
| 15 | 15 | $this->getLogger()->info( 'Starting task UserNotice' ); |
| 16 | 16 | |
| 17 | - $ricNums = []; |
|
| 17 | + $ricNums = [ ]; |
|
| 18 | 18 | foreach ( $this->getDataProvider()->getCreatedPages() as $page ) { |
| 19 | 19 | $bits = explode( '/', $page ); |
| 20 | 20 | $num = intval( array_pop( $bits ) ); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param string $user |
| 36 | 36 | * @param int $ricNum |
| 37 | 37 | */ |
| 38 | - protected function addMsg( string $user, int $ricNum ) { |
|
| 38 | + protected function addMsg ( string $user, int $ricNum ) { |
|
| 39 | 39 | $this->getLogger()->info( "Leaving msg to $user" ); |
| 40 | 40 | $msg = str_replace( '$num', "$ricNum", $this->getConfig()->get( 'user-notice-msg' ) ); |
| 41 | 41 | |