@@ -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; |
| 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->checkRequiredOpts( $opts ); |
| 70 | 70 | $this->checkConflictingOpts( $opts ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * @param array $opts |
| 77 | 77 | */ |
| 78 | - private function checkRequiredOpts( array $opts ) : void { |
|
| 78 | + private function checkRequiredOpts ( array $opts ) : void { |
|
| 79 | 79 | $missingOpts = array_diff( self::REQUIRED_OPTS, array_keys( $opts ) ); |
| 80 | 80 | if ( $missingOpts ) { |
| 81 | 81 | exit( 'Required options missing: ' . implode( ', ', $missingOpts ) ); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * @param array $opts |
| 93 | 93 | */ |
| 94 | - private function checkConflictingOpts( array $opts ) : void { |
|
| 94 | + private function checkConflictingOpts ( array $opts ) : void { |
|
| 95 | 95 | $hasPw = array_key_exists( 'password', $opts ); |
| 96 | 96 | $hasPwFile = array_key_exists( 'use-password-file', $opts ); |
| 97 | 97 | if ( $hasPw && $hasPwFile ) { |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @param array &$opts |
| 110 | 110 | */ |
| 111 | - private function canonicalize( array &$opts ) : void { |
|
| 111 | + private function canonicalize ( array &$opts ) : void { |
|
| 112 | 112 | if ( array_key_exists( 'use-password-file', $opts ) ) { |
| 113 | 113 | $pw = trim( file_get_contents( self::PASSWORD_FILE ) ); |
| 114 | - $opts['password'] = $pw; |
|
| 115 | - unset( $opts['use-password-file'] ); |
|
| 114 | + $opts[ 'password' ] = $pw; |
|
| 115 | + unset( $opts[ 'use-password-file' ] ); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | * @param mixed|null $default |
| 122 | 122 | * @return mixed |
| 123 | 123 | */ |
| 124 | - public function getOpt( string $opt, $default = null ) { |
|
| 125 | - return $this->opts[$opt] ?? $default; |
|
| 124 | + public function getOpt ( string $opt, $default = null ) { |
|
| 125 | + return $this->opts[ $opt ] ?? $default; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * @return array Either [ 'task' => taskname ] or [ 'subtask' => subtaskname ] |
| 130 | 130 | */ |
| 131 | - public function getTaskOpt() : array { |
|
| 131 | + public function getTaskOpt () : array { |
|
| 132 | 132 | return array_intersect_key( |
| 133 | 133 | $this->opts, |
| 134 | 134 | [ 'task' => true, 'subtask' => true ] |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | /** |
| 139 | 139 | * @return string|null |
| 140 | 140 | */ |
| 141 | - public function getURL() : ?string { |
|
| 141 | + public function getURL () : ?string { |
|
| 142 | 142 | return $this->getOpt( 'force-url' ); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -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 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @param string $delimiter |
| 13 | 13 | * @return string |
| 14 | 14 | */ |
| 15 | - abstract public function getRegex( string $delimiter = '/' ) : string; |
|
| 15 | + abstract public function getRegex ( string $delimiter = '/' ) : string; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Get a regex matching any element in the given array |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * @return string |
| 23 | 23 | * @todo Is this the right place? |
| 24 | 24 | */ |
| 25 | - public static function regexFromArray( array $elements, string $delimiter = '/' ) : string { |
|
| 26 | - $bits = []; |
|
| 25 | + public static function regexFromArray ( array $elements, string $delimiter = '/' ) : string { |
|
| 26 | + $bits = [ ]; |
|
| 27 | 27 | foreach ( $elements as $el ) { |
| 28 | - $bits[] = $el->getRegex( $delimiter ); |
|
| 28 | + $bits[ ] = $el->getRegex( $delimiter ); |
|
| 29 | 29 | } |
| 30 | 30 | return '(?:' . implode( '|', $bits ) . ')'; |
| 31 | 31 | } |
@@ -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,12 +11,12 @@ discard block |
||
| 11 | 11 | /** @var self */ |
| 12 | 12 | private static $instance; |
| 13 | 13 | /** @var array */ |
| 14 | - private $opts = []; |
|
| 14 | + private $opts = [ ]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Use self::init() and self::getInstance() |
| 18 | 18 | */ |
| 19 | - private function __construct() { |
|
| 19 | + private function __construct () { |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param array $confValues |
| 26 | 26 | * @throws ConfigException |
| 27 | 27 | */ |
| 28 | - public static function init( array $confValues ) : void { |
|
| 28 | + public static function init ( array $confValues ) : void { |
|
| 29 | 29 | if ( self::$instance ) { |
| 30 | 30 | throw new ConfigException( 'Config was already initialized' ); |
| 31 | 31 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $key |
| 45 | 45 | * @param mixed $value |
| 46 | 46 | */ |
| 47 | - protected function set( string $key, $value ) : void { |
|
| 47 | + protected function set ( string $key, $value ) : void { |
|
| 48 | 48 | $this->opts[ $key ] = $value; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @return self |
| 55 | 55 | * @throws ConfigException |
| 56 | 56 | */ |
| 57 | - public static function getInstance() : self { |
|
| 57 | + public static function getInstance () : self { |
|
| 58 | 58 | if ( !self::$instance ) { |
| 59 | 59 | throw new ConfigException( 'Config not yet initialized' ); |
| 60 | 60 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return mixed |
| 69 | 69 | * @throws ConfigException |
| 70 | 70 | */ |
| 71 | - public function get( string $opt ) { |
|
| 71 | + public function get ( string $opt ) { |
|
| 72 | 72 | if ( !isset( $this->opts[ $opt ] ) ) { |
| 73 | 73 | throw new ConfigException( "Config option '$opt' not set." ); |
| 74 | 74 | } |
@@ -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 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @inheritDoc |
| 18 | 18 | */ |
| 19 | - public function runInternal() : int { |
|
| 19 | + public function runInternal () : int { |
|
| 20 | 20 | $failed = $this->getFailures(); |
| 21 | 21 | if ( !$failed ) { |
| 22 | 22 | return TaskResult::STATUS_NOTHING; |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return PageRiconferma[] |
| 40 | 40 | */ |
| 41 | - private function getFailures() : array { |
|
| 42 | - $ret = []; |
|
| 41 | + private function getFailures () : array { |
|
| 42 | + $ret = [ ]; |
|
| 43 | 43 | $allPages = $this->getDataProvider()->getPagesToClose(); |
| 44 | 44 | foreach ( $allPages as $page ) { |
| 45 | 45 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
| 46 | - $ret[] = $page; |
|
| 46 | + $ret[ ] = $page; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | return $ret; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @param User[] $users |
| 54 | 54 | */ |
| 55 | - protected function updateBurList( array $users ) : void { |
|
| 55 | + protected function updateBurList ( array $users ) : void { |
|
| 56 | 56 | $this->getLogger()->info( 'Updating bur list. Removing: ' . implode( ', ', $users ) ); |
| 57 | 57 | $remList = Element::regexFromArray( $users, '!' ); |
| 58 | 58 | $burList = $this->getPage( $this->getOpt( 'bur-list-title' ) ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @param PageRiconferma[] $pages |
| 77 | 77 | */ |
| 78 | - protected function requestRemoval( array $pages ) : void { |
|
| 78 | + protected function requestRemoval ( array $pages ) : void { |
|
| 79 | 79 | $this->getLogger()->info( 'Requesting flag removal for: ' . implode( ', ', $pages ) ); |
| 80 | 80 | |
| 81 | 81 | $metaWiki = $this->getWikiGroup()->getCentralWiki(); |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @param PageRiconferma[] $pages |
| 117 | 117 | */ |
| 118 | - protected function updateAnnunci( array $pages ) : void { |
|
| 118 | + protected function updateAnnunci ( array $pages ) : void { |
|
| 119 | 119 | $this->getLogger()->info( 'Updating annunci' ); |
| 120 | 120 | $section = 1; |
| 121 | 121 | |
| 122 | - $names = []; |
|
| 122 | + $names = [ ]; |
|
| 123 | 123 | $text = ''; |
| 124 | 124 | foreach ( $pages as $page ) { |
| 125 | 125 | $user = $page->getUserName(); |
| 126 | - $names[] = $user; |
|
| 126 | + $names[ ] = $user; |
|
| 127 | 127 | $text .= $this->msg( 'annunci-text' )->params( [ '$user' => $user ] )->text(); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @param PageRiconferma[] $pages |
| 157 | 157 | */ |
| 158 | - protected function updateUltimeNotizie( array $pages ) : void { |
|
| 158 | + protected function updateUltimeNotizie ( array $pages ) : void { |
|
| 159 | 159 | $this->getLogger()->info( 'Updating ultime notizie' ); |
| 160 | 160 | $notiziePage = $this->getPage( $this->getOpt( 'ultimenotizie-page-title' ) ); |
| 161 | 161 | |
| 162 | - $names = []; |
|
| 162 | + $names = [ ]; |
|
| 163 | 163 | $text = ''; |
| 164 | 164 | $msg = $this->msg( 'ultimenotizie-text' ); |
| 165 | 165 | foreach ( $pages as $page ) { |
| 166 | 166 | $user = $page->getUserName(); |
| 167 | - $names[] = $user; |
|
| 167 | + $names[ ] = $user; |
|
| 168 | 168 | $text .= $msg->params( [ '$user' => $user, '$title' => $page->getTitle() ] )->text(); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * @param PageRiconferma[] $pages |
| 194 | 194 | * @return User[] |
| 195 | 195 | */ |
| 196 | - private function getFailedBureaucrats( array $pages ) : array { |
|
| 197 | - $ret = []; |
|
| 196 | + private function getFailedBureaucrats ( array $pages ) : array { |
|
| 197 | + $ret = [ ]; |
|
| 198 | 198 | foreach ( $pages as $page ) { |
| 199 | 199 | $user = $this->getUser( $page->getUserName() ); |
| 200 | 200 | if ( $user->inGroup( 'bureaucrat' ) ) { |
| 201 | - $ret[] = $user; |
|
| 201 | + $ret[ ] = $user; |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | return $ret; |
@@ -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\Task\Subtask; |
| 4 | 4 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @inheritDoc |
| 16 | 16 | */ |
| 17 | - public function runInternal() : int { |
|
| 17 | + public function runInternal () : int { |
|
| 18 | 18 | $pages = $this->getDataProvider()->getPagesToClose(); |
| 19 | 19 | |
| 20 | 20 | if ( !$pages ) { |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | * @param PageRiconferma[] $pages |
| 37 | 37 | * @see OpenUpdates::addToVotazioni() |
| 38 | 38 | */ |
| 39 | - protected function updateVotazioni( array $pages ) : void { |
|
| 39 | + protected function updateVotazioni ( array $pages ) : void { |
|
| 40 | 40 | $this->getLogger()->info( |
| 41 | 41 | 'Updating votazioni: ' . implode( ', ', $pages ) |
| 42 | 42 | ); |
| 43 | 43 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
| 44 | 44 | |
| 45 | - $users = []; |
|
| 45 | + $users = [ ]; |
|
| 46 | 46 | foreach ( $pages as $page ) { |
| 47 | - $users[] = $this->getUser( $page->getUserName() ); |
|
| 47 | + $users[ ] = $this->getUser( $page->getUserName() ); |
|
| 48 | 48 | } |
| 49 | 49 | $usersReg = Element::regexFromArray( $users, '!' ); |
| 50 | 50 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param array $pages |
| 66 | 66 | * @see OpenUpdates::addToNews() |
| 67 | 67 | */ |
| 68 | - protected function updateNews( array $pages ) : void { |
|
| 68 | + protected function updateNews ( array $pages ) : void { |
|
| 69 | 69 | $simpleAmount = $voteAmount = 0; |
| 70 | 70 | foreach ( $pages as $page ) { |
| 71 | 71 | if ( $page->isVote() ) { |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $simpleMatches = $newsPage->getMatch( $simpleReg ); |
| 86 | 86 | $voteMatches = $newsPage->getMatch( $voteReg ); |
| 87 | 87 | |
| 88 | - $newSimp = ( (int)$simpleMatches[2] - $simpleAmount ) ?: ''; |
|
| 89 | - $newVote = ( (int)$voteMatches[2] - $voteAmount ) ?: ''; |
|
| 88 | + $newSimp = ( (int)$simpleMatches[ 2 ] - $simpleAmount ) ?: ''; |
|
| 89 | + $newVote = ( (int)$voteMatches[ 2 ] - $voteAmount ) ?: ''; |
|
| 90 | 90 | $newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $newsPage->getContent() ); |
| 91 | 91 | $newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent ); |
| 92 | 92 | |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @param bool[] $outcomes |
| 106 | 106 | */ |
| 107 | - protected function updateAdminList( array $outcomes ) : void { |
|
| 107 | + protected function updateAdminList ( array $outcomes ) : void { |
|
| 108 | 108 | $this->getLogger()->info( 'Updating admin list' ); |
| 109 | 109 | $adminsPage = $this->getPage( $this->getOpt( 'admins-list-title' ) ); |
| 110 | 110 | $newContent = $adminsPage->getContent(); |
| 111 | 111 | |
| 112 | - $riconfNames = $removeNames = []; |
|
| 112 | + $riconfNames = $removeNames = [ ]; |
|
| 113 | 113 | foreach ( $outcomes as $username => $confirmed ) { |
| 114 | 114 | $user = $this->getUser( $username ); |
| 115 | 115 | $userReg = $user->getRegex( '!' ); |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | '${1}{{subst:#timel:Ymd}}|' . $nextDate . '$2', |
| 125 | 125 | $newContent |
| 126 | 126 | ); |
| 127 | - $riconfNames[] = $username; |
|
| 127 | + $riconfNames[ ] = $username; |
|
| 128 | 128 | } else { |
| 129 | 129 | $newContent = preg_replace( $reg, '', $newContent ); |
| 130 | - $removeNames[] = $username; |
|
| 130 | + $removeNames[ ] = $username; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -147,21 +147,21 @@ discard block |
||
| 147 | 147 | /** |
| 148 | 148 | * @param bool[] $outcomes |
| 149 | 149 | */ |
| 150 | - protected function updateCUList( array $outcomes ) : void { |
|
| 150 | + protected function updateCUList ( array $outcomes ) : void { |
|
| 151 | 151 | $this->getLogger()->info( 'Updating CU list.' ); |
| 152 | 152 | $cuList = $this->getPage( $this->getOpt( 'cu-list-title' ) ); |
| 153 | 153 | $newContent = $cuList->getContent(); |
| 154 | 154 | |
| 155 | - $riconfNames = $removeNames = []; |
|
| 155 | + $riconfNames = $removeNames = [ ]; |
|
| 156 | 156 | foreach ( $outcomes as $user => $confirmed ) { |
| 157 | 157 | $userReg = $this->getUser( $user )->getRegex( '!' ); |
| 158 | 158 | $reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!"; |
| 159 | 159 | if ( $confirmed ) { |
| 160 | 160 | $newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent ); |
| 161 | - $riconfNames[] = $user; |
|
| 161 | + $riconfNames[ ] = $user; |
|
| 162 | 162 | } else { |
| 163 | 163 | $newContent = preg_replace( $reg, '', $newContent ); |
| 164 | - $removeNames[] = $user; |
|
| 164 | + $removeNames[ ] = $user; |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | * @param PageRiconferma[] $pages |
| 186 | 186 | * @return bool[] |
| 187 | 187 | */ |
| 188 | - private function getGroupOutcomes( string $group, array $pages ) : array { |
|
| 189 | - $ret = []; |
|
| 188 | + private function getGroupOutcomes ( string $group, array $pages ) : array { |
|
| 189 | + $ret = [ ]; |
|
| 190 | 190 | foreach ( $pages as $page ) { |
| 191 | 191 | $user = $this->getUser( $page->getUserName() ); |
| 192 | 192 | if ( $user->inGroup( $group ) ) { |