@@ -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 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @param string $key |
| 16 | 16 | */ |
| 17 | - public function __construct( string $key ) { |
|
| 17 | + public function __construct ( string $key ) { |
|
| 18 | 18 | $this->key = $key; |
| 19 | 19 | $this->value = Config::getInstance()->getWikiMessage( $key ); |
| 20 | 20 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param array $args |
| 24 | 24 | * @return self |
| 25 | 25 | */ |
| 26 | - public function params( array $args ) : self { |
|
| 26 | + public function params ( array $args ) : self { |
|
| 27 | 27 | $this->value = strtr( $this->value, $args ); |
| 28 | 28 | return $this; |
| 29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function text() : string { |
|
| 34 | + public function text () : string { |
|
| 35 | 35 | $this->parsePlurals(); |
| 36 | 36 | return $this->value; |
| 37 | 37 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Replace {{$plur|<amount>|sing|plur}} |
| 41 | 41 | */ |
| 42 | - protected function parsePlurals() { |
|
| 42 | + protected function parsePlurals () { |
|
| 43 | 43 | $reg = '!\{\{\$plur\|(?P<amount>\d+)\|(?P<sing>[^}|]+)\|(?P<plur>[^|}]+)}}!'; |
| 44 | 44 | |
| 45 | 45 | if ( preg_match( $reg, $this->value ) === 0 ) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $this->value = preg_replace_callback( |
| 49 | 49 | $reg, |
| 50 | 50 | function ( $matches ) { |
| 51 | - return intval( $matches['amount'] ) > 1 ? trim( $matches['plur'] ) : trim( $matches['sing'] ); |
|
| 51 | + return intval( $matches[ 'amount' ] ) > 1 ? trim( $matches[ 'plur' ] ) : trim( $matches[ 'sing' ] ); |
|
| 52 | 52 | }, |
| 53 | 53 | $this->value |
| 54 | 54 | ); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param int $timestamp |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public static function getTimeWithArticle( int $timestamp ) : string { |
|
| 63 | + public static function getTimeWithArticle ( int $timestamp ) : string { |
|
| 64 | 64 | $oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' ); |
| 65 | 65 | $timeString = strftime( '%e %B alle %R', $timestamp ); |
| 66 | 66 | // Remove the left space if day has a single digit |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param string $timeString |
| 78 | 78 | * @return int |
| 79 | 79 | */ |
| 80 | - public static function getTimestampFromLocalTime( string $timeString ) : int { |
|
| 80 | + public static function getTimestampFromLocalTime ( string $timeString ) : int { |
|
| 81 | 81 | $months = [ |
| 82 | 82 | 'gennaio' => 'January', |
| 83 | 83 | 'febbraio' => 'February', |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | * @param string $emptyText |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - public static function commaList( array $data, string $emptyText = 'nessuno' ) : string { |
|
| 110 | + public static function commaList ( array $data, string $emptyText = 'nessuno' ) : string { |
|
| 111 | 111 | if ( count( $data ) > 1 ) { |
| 112 | 112 | $last = array_pop( $data ); |
| 113 | 113 | $ret = implode( ', ', $data ) . " e $last"; |
| 114 | 114 | } elseif ( $data ) { |
| 115 | - $ret = $data[0]; |
|
| 115 | + $ret = $data[ 0 ]; |
|
| 116 | 116 | } else { |
| 117 | 117 | $ret = $emptyText; |
| 118 | 118 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | return $ret; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function __toString() { |
|
| 123 | + public function __toString () { |
|
| 124 | 124 | return $this->text(); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -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 | |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @inheritDoc |
| 17 | 17 | */ |
| 18 | - protected function getSubtasksMap(): array { |
|
| 18 | + protected function getSubtasksMap (): array { |
|
| 19 | 19 | // Everything is done here. |
| 20 | - return []; |
|
| 20 | + return [ ]; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @inheritDoc |
| 25 | 25 | */ |
| 26 | - public function runInternal() : int { |
|
| 26 | + public function runInternal () : int { |
|
| 27 | 27 | $pages = $this->getDataProvider()->getOpenPages(); |
| 28 | 28 | |
| 29 | 29 | if ( !$pages ) { |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * @param PageRiconferma[] $pages |
| 38 | 38 | * @return int a STATUS_* constant |
| 39 | 39 | */ |
| 40 | - protected function processPages( array $pages ) : int { |
|
| 41 | - $actualPages = []; |
|
| 40 | + protected function processPages ( array $pages ) : int { |
|
| 41 | + $actualPages = [ ]; |
|
| 42 | 42 | foreach ( $pages as $page ) { |
| 43 | 43 | if ( $page->hasOpposition() && !$page->isVote() ) { |
| 44 | 44 | $this->openVote( $page ); |
| 45 | - $actualPages[] = $page; |
|
| 45 | + $actualPages[ ] = $page; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param PageRiconferma $page |
| 62 | 62 | */ |
| 63 | - protected function openVote( PageRiconferma $page ) { |
|
| 63 | + protected function openVote ( PageRiconferma $page ) { |
|
| 64 | 64 | $this->getLogger()->info( "Starting vote on $page" ); |
| 65 | 65 | |
| 66 | 66 | $content = $page->getContent(); |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * @see SimpleUpdates::updateVotazioni() |
| 100 | 100 | * @see UpdatesAround::addToVotazioni() |
| 101 | 101 | */ |
| 102 | - protected function updateVotePage( array $pages ) { |
|
| 102 | + protected function updateVotePage ( array $pages ) { |
|
| 103 | 103 | $votePage = new Page( $this->getConfig()->get( 'vote-page-title' ) ); |
| 104 | 104 | $content = $votePage->getContent(); |
| 105 | 105 | |
| 106 | - $titles = []; |
|
| 106 | + $titles = [ ]; |
|
| 107 | 107 | foreach ( $pages as $page ) { |
| 108 | - $titles[] = preg_quote( $page->getTitle() ); |
|
| 108 | + $titles[ ] = preg_quote( $page->getTitle() ); |
|
| 109 | 109 | } |
| 110 | 110 | $titleReg = implode( '|', $titles ); |
| 111 | 111 | $search = "!^\*.+ La \[\[($titleReg)\|procedura]] termina.+\n!m"; |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | $newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 ); |
| 131 | 131 | } else { |
| 132 | 132 | // Start section |
| 133 | - $matches = []; |
|
| 133 | + $matches = [ ]; |
|
| 134 | 134 | if ( preg_match( $introReg, $newContent, $matches ) === 0 ) { |
| 135 | 135 | throw new TaskException( 'Intro not found in vote page' ); |
| 136 | 136 | } |
| 137 | 137 | $beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m'; |
| 138 | 138 | // Replace semicolon with full stop |
| 139 | 139 | $newLines = substr( $newLines, 0, -2 ) . ".\n"; |
| 140 | - $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 ); |
|
| 140 | + $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 ); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $summary = $this->msg( 'vote-start-vote-page-summary' ) |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @see UpdatesAround::addToNews() |
| 160 | 160 | * @see SimpleUpdates::updateNews() |
| 161 | 161 | */ |
| 162 | - protected function updateNews( int $amount ) { |
|
| 162 | + protected function updateNews ( int $amount ) { |
|
| 163 | 163 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
| 164 | 164 | $newsPage = new Page( $this->getConfig()->get( 'news-page-title' ) ); |
| 165 | 165 | |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | throw new TaskException( 'Param "voto" not found in news page' ); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $newTac = intval( $newsPage->getMatch( $regTac )[2] ) - $amount ?: ''; |
|
| 178 | - $newVot = intval( $newsPage->getMatch( $regVot )[2] ) + $amount ?: ''; |
|
| 177 | + $newTac = intval( $newsPage->getMatch( $regTac )[ 2 ] ) - $amount ?: ''; |
|
| 178 | + $newVot = intval( $newsPage->getMatch( $regVot )[ 2 ] ) + $amount ?: ''; |
|
| 179 | 179 | |
| 180 | 180 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
| 181 | 181 | $newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent ); |
@@ -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 ) { |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | * @param PageRiconferma[] $pages |
| 34 | 34 | * @see UpdatesAround::addToMainPage() |
| 35 | 35 | */ |
| 36 | - protected function removeFromMainPage( array $pages ) { |
|
| 36 | + protected function removeFromMainPage ( array $pages ) { |
|
| 37 | 37 | $this->getLogger()->info( |
| 38 | 38 | 'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | $mainPage = new Page( $this->getConfig()->get( 'main-page-title' ) ); |
| 42 | - $remove = []; |
|
| 42 | + $remove = [ ]; |
|
| 43 | 43 | foreach ( $pages as $page ) { |
| 44 | - $remove[] = '{{' . $page->getTitle() . '}}'; |
|
| 44 | + $remove[ ] = '{{' . $page->getTitle() . '}}'; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $summary = $this->msg( 'close-main-summary' ) |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @param PageRiconferma[] $pages |
| 61 | 61 | */ |
| 62 | - protected function addToArchive( array $pages ) { |
|
| 62 | + protected function addToArchive ( array $pages ) { |
|
| 63 | 63 | $this->getLogger()->info( |
| 64 | 64 | 'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - $simple = $votes = []; |
|
| 67 | + $simple = $votes = [ ]; |
|
| 68 | 68 | foreach ( $pages as $page ) { |
| 69 | 69 | if ( $page->isVote() ) { |
| 70 | - $votes[] = $page; |
|
| 70 | + $votes[ ] = $page; |
|
| 71 | 71 | } else { |
| 72 | - $simple[] = $page; |
|
| 72 | + $simple[ ] = $page; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | * @param string $archiveTitle |
| 87 | 87 | * @param array $pages |
| 88 | 88 | */ |
| 89 | - private function reallyAddToArchive( string $archiveTitle, array $pages ) { |
|
| 89 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ) { |
|
| 90 | 90 | $archivePage = new Page( "$archiveTitle/" . date( 'Y' ) ); |
| 91 | 91 | |
| 92 | 92 | $append = "\n"; |
| 93 | - $archivedList = []; |
|
| 93 | + $archivedList = [ ]; |
|
| 94 | 94 | foreach ( $pages as $page ) { |
| 95 | 95 | $append .= '{{' . $page->getTitle() . "}}\n"; |
| 96 | - $archivedList[] = $page->getUserNum(); |
|
| 96 | + $archivedList[ ] = $page->getUserNum(); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $summary = $this->msg( 'close-archive-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\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 ' . |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | * @param int $errline |
| 101 | 101 | * @protected |
| 102 | 102 | */ |
| 103 | - public function handleError( $errno, $errstr, $errfile, $errline ) { |
|
| 103 | + public function handleError ( $errno, $errstr, $errfile, $errline ) { |
|
| 104 | 104 | throw new \ErrorException( $errstr, 0, $errno, $errfile, $errline ); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * @return TaskDataProvider |
| 109 | 109 | */ |
| 110 | - protected function getDataProvider() : TaskDataProvider { |
|
| 110 | + protected function getDataProvider () : TaskDataProvider { |
|
| 111 | 111 | return $this->dataProvider; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -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 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @param string $title |
| 29 | 29 | */ |
| 30 | - public function __construct( string $title ) { |
|
| 30 | + public function __construct ( string $title ) { |
|
| 31 | 31 | parent::__construct( $title ); |
| 32 | 32 | $this->supportSection = $this->isVote() ? 3 : 0; |
| 33 | 33 | $this->opposeSection = $this->isVote() ? 4 : 3; |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return User |
| 40 | 40 | */ |
| 41 | - public function getUser() : User { |
|
| 42 | - $name = explode( '/', $this->title )[2]; |
|
| 41 | + public function getUser () : User { |
|
| 42 | + $name = explode( '/', $this->title )[ 2 ]; |
|
| 43 | 43 | return new User( $name ); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return int |
| 50 | 50 | */ |
| 51 | - public function getNum() : int { |
|
| 51 | + public function getNum () : int { |
|
| 52 | 52 | $bits = explode( '/', $this->getTitle() ); |
| 53 | 53 | return intval( end( $bits ) ); |
| 54 | 54 | } |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function getUserNum() : string { |
|
| 62 | - return explode( '/', $this->getTitle(), 3 )[2]; |
|
| 61 | + public function getUserNum () : string { |
|
| 62 | + return explode( '/', $this->getTitle(), 3 )[ 2 ]; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return string |
| 69 | 69 | */ |
| 70 | - public function getBaseTitle() : string { |
|
| 70 | + public function getBaseTitle () : string { |
|
| 71 | 71 | // @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug |
| 72 | 72 | return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) ); |
| 73 | 73 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return int |
| 79 | 79 | */ |
| 80 | - public function getOpposingCount() : int { |
|
| 80 | + public function getOpposingCount () : int { |
|
| 81 | 81 | return $this->getCountForSection( $this->opposeSection ); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return int |
| 88 | 88 | * @throws \BadMethodCallException |
| 89 | 89 | */ |
| 90 | - public function getSupportCount() : int { |
|
| 90 | + public function getSupportCount () : int { |
|
| 91 | 91 | if ( !$this->isVote() ) { |
| 92 | 92 | throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' ); |
| 93 | 93 | } |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | * @param int $secNum |
| 101 | 101 | * @return int |
| 102 | 102 | */ |
| 103 | - protected function getCountForSection( int $secNum ) : int { |
|
| 103 | + protected function getCountForSection ( int $secNum ) : int { |
|
| 104 | 104 | $content = $this->controller->getPageContent( $this->title, $secNum ); |
| 105 | 105 | // Let's hope that this is good enough... |
| 106 | - return preg_match_all("/^\# *(?![# *]|\.\.\.$)/m", $content ); |
|
| 106 | + return preg_match_all( "/^\# *(?![# *]|\.\.\.$)/m", $content ); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return int |
| 113 | 113 | */ |
| 114 | - protected function getQuorum() : int { |
|
| 114 | + protected function getQuorum () : int { |
|
| 115 | 115 | $reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!"; |
| 116 | - return intval( $this->getMatch( $reg )[1] ); |
|
| 116 | + return intval( $this->getMatch( $reg )[ 1 ] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return bool |
| 123 | 123 | */ |
| 124 | - public function hasOpposition() : bool { |
|
| 124 | + public function hasOpposition () : bool { |
|
| 125 | 125 | return $this->getOpposingCount() >= self::REQUIRED_OPPOSE; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @return int One of the OUTCOME_* constants |
| 132 | 132 | * @throws \BadMethodCallException |
| 133 | 133 | */ |
| 134 | - public function getOutcome() : int { |
|
| 134 | + public function getOutcome () : int { |
|
| 135 | 135 | if ( !$this->isVote() ) { |
| 136 | 136 | throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' ); |
| 137 | 137 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @throws \BadMethodCallException |
| 152 | 152 | * @throws \LogicException |
| 153 | 153 | */ |
| 154 | - public function getOutcomeText() : string { |
|
| 154 | + public function getOutcomeText () : string { |
|
| 155 | 155 | if ( !$this->isVote() ) { |
| 156 | 156 | throw new \BadMethodCallException( 'No need for an outcome text.' ); |
| 157 | 157 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @return bool |
| 187 | 187 | */ |
| 188 | - public function isVote() : bool { |
|
| 188 | + public function isVote () : bool { |
|
| 189 | 189 | $sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/'; |
| 190 | 190 | return !$this->matches( $sectionReg ); |
| 191 | 191 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @return int |
| 197 | 197 | */ |
| 198 | - public function getCreationTimestamp() : int { |
|
| 198 | + public function getCreationTimestamp () : int { |
|
| 199 | 199 | return $this->controller->getPageCreationTS( $this->title ); |
| 200 | 200 | } |
| 201 | 201 | /** |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return int |
| 205 | 205 | */ |
| 206 | - public function getEndTimestamp() : int { |
|
| 206 | + public function getEndTimestamp () : int { |
|
| 207 | 207 | if ( $this->isVote() ) { |
| 208 | 208 | $reg = "!La votazione ha inizio il.+ alle ore ([\d:]+) e ha termine il (.+) alla stessa ora!"; |
| 209 | 209 | list( , $hours, $day ) = $this->getMatch( $reg ); |