@@ -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()->getCreatedPages(); |
| 19 | 19 | |
| 20 | 20 | if ( !$pages ) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param PageRiconferma[] $pages |
| 38 | 38 | */ |
| 39 | - protected function addToMainPage( array $pages ) { |
|
| 39 | + protected function addToMainPage ( array $pages ) { |
|
| 40 | 40 | $this->getLogger()->info( |
| 41 | 41 | 'Adding the following to main: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 42 | 42 | ); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @param PageRiconferma[] $pages |
| 65 | 65 | */ |
| 66 | - protected function addVote( array $pages ) { |
|
| 66 | + protected function addVote ( array $pages ) { |
|
| 67 | 67 | $this->getLogger()->info( |
| 68 | 68 | 'Adding the following to votes: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 69 | 69 | ); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m'; |
| 93 | 93 | // Replace semicolon with full stop |
| 94 | 94 | $newLines = substr( $newLines, 0, -2 ) . ".\n"; |
| 95 | - $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $content, 1 ); |
|
| 95 | + $newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $content, 1 ); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $summary = $this->msg( 'ric-vote-page-summary' ) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @param int $amount |
| 113 | 113 | */ |
| 114 | - protected function addNews( int $amount ) { |
|
| 114 | + protected function addNews ( int $amount ) { |
|
| 115 | 115 | $this->getLogger()->info( "Increasing the news counter by $amount" ); |
| 116 | 116 | $newsPage = new Page( $this->getConfig()->get( 'ric-news-page' ) ); |
| 117 | 117 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | throw new TaskException( 'Param not found in news page' ); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $newNum = (int)$matches[2] + $amount; |
|
| 127 | + $newNum = (int)$matches[ 2 ] + $amount; |
|
| 128 | 128 | $newContent = preg_replace( $reg, '${1}' . $newNum, $content ); |
| 129 | 129 | |
| 130 | 130 | $summary = $this->msg( 'ric-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\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()->getPagesToClose(); |
| 18 | 18 | $this->removeFromMainPage( $pages ); |
| 19 | 19 | $this->addToArchive( $pages ); |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @param PageRiconferma[] $pages |
| 28 | 28 | * @see UpdatesAround::addToMainPage() |
| 29 | 29 | */ |
| 30 | - protected function removeFromMainPage( array $pages ) { |
|
| 30 | + protected function removeFromMainPage ( array $pages ) { |
|
| 31 | 31 | $this->getLogger()->info( |
| 32 | 32 | 'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | $mainPage = new Page( $this->getConfig()->get( 'ric-main-page' ) ); |
| 36 | - $remove = []; |
|
| 36 | + $remove = [ ]; |
|
| 37 | 37 | foreach ( $pages as $page ) { |
| 38 | - $remove[] = '{{' . $page->getTitle() . '}}'; |
|
| 38 | + $remove[ ] = '{{' . $page->getTitle() . '}}'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $mainPage->edit( [ |
@@ -49,17 +49,17 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param PageRiconferma[] $pages |
| 51 | 51 | */ |
| 52 | - protected function addToArchive( array $pages ) { |
|
| 52 | + protected function addToArchive ( array $pages ) { |
|
| 53 | 53 | $this->getLogger()->info( |
| 54 | 54 | 'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) ) |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - $simple = $votes = []; |
|
| 57 | + $simple = $votes = [ ]; |
|
| 58 | 58 | foreach ( $pages as $page ) { |
| 59 | 59 | if ( $page->isVote() ) { |
| 60 | - $votes[] = $page; |
|
| 60 | + $votes[ ] = $page; |
|
| 61 | 61 | } else { |
| 62 | - $simple[] = $page; |
|
| 62 | + $simple[ ] = $page; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | * @param string $archiveTitle |
| 77 | 77 | * @param array $pages |
| 78 | 78 | */ |
| 79 | - private function reallyAddToArchive( string $archiveTitle, array $pages ) { |
|
| 79 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ) { |
|
| 80 | 80 | $archivePage = new Page( "$archiveTitle/" . date( 'Y' ) ); |
| 81 | 81 | |
| 82 | 82 | $append = ''; |
| 83 | - $archivedList = []; |
|
| 83 | + $archivedList = [ ]; |
|
| 84 | 84 | foreach ( $pages as $page ) { |
| 85 | 85 | $append .= '{{' . $page->getTitle() . "}}\n"; |
| 86 | - $archivedList[] = $page->getUserNum(); |
|
| 86 | + $archivedList[ ] = $page->getUserNum(); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @inheritDoc |
| 17 | 17 | */ |
| 18 | - public function runInternal() : int { |
|
| 18 | + public function runInternal () : int { |
|
| 19 | 19 | $orderedList = [ |
| 20 | 20 | 'close-pages', |
| 21 | 21 | 'archive-pages', |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - protected function getSubtasksMap(): array { |
|
| 37 | + protected function getSubtasksMap (): array { |
|
| 38 | 38 | return [ |
| 39 | 39 | 'archive-pages' => ArchivePages::class, |
| 40 | 40 | 'close-pages' => ClosePages::class, |
@@ -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 | |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @inheritDoc |
| 20 | 20 | */ |
| 21 | - protected function getSubtasksMap(): array { |
|
| 21 | + protected function getSubtasksMap (): array { |
|
| 22 | 22 | // Everything is done here. |
| 23 | - return []; |
|
| 23 | + return [ ]; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @inheritDoc |
| 28 | 28 | */ |
| 29 | - public function runInternal() : int { |
|
| 29 | + public function runInternal () : int { |
|
| 30 | 30 | $this->actualList = $this->getActualAdmins(); |
| 31 | 31 | $this->botList = $this->getDataProvider()->getUsersList(); |
| 32 | 32 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @return array |
| 57 | 57 | */ |
| 58 | - protected function getActualAdmins() : array { |
|
| 58 | + protected function getActualAdmins () : array { |
|
| 59 | 59 | $this->getLogger()->debug( 'Retrieving admins - API' ); |
| 60 | 60 | $params = [ |
| 61 | 61 | 'action' => 'query', |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * @param \stdClass $data |
| 74 | 74 | * @return array |
| 75 | 75 | */ |
| 76 | - protected function extractAdmins( \stdClass $data ) : array { |
|
| 77 | - $ret = []; |
|
| 76 | + protected function extractAdmins ( \stdClass $data ) : array { |
|
| 77 | + $ret = [ ]; |
|
| 78 | 78 | $blacklist = $this->getConfig()->get( 'exclude-admins' ); |
| 79 | 79 | foreach ( $data->query->allusers as $u ) { |
| 80 | 80 | if ( in_array( $u->name, $blacklist ) ) { |
@@ -91,22 +91,22 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return array[] |
| 93 | 93 | */ |
| 94 | - protected function getMissingGroups() : array { |
|
| 95 | - $missing = []; |
|
| 94 | + protected function getMissingGroups () : array { |
|
| 95 | + $missing = [ ]; |
|
| 96 | 96 | foreach ( $this->actualList as $adm => $groups ) { |
| 97 | - $groupsList = []; |
|
| 97 | + $groupsList = [ ]; |
|
| 98 | 98 | if ( !isset( $this->botList[ $adm ] ) ) { |
| 99 | 99 | $groupsList = $groups; |
| 100 | - } elseif ( count( $groups ) > count( $this->botList[$adm] ) ) { |
|
| 100 | + } elseif ( count( $groups ) > count( $this->botList[ $adm ] ) ) { |
|
| 101 | 101 | // Only some groups are missing |
| 102 | - $groupsList = array_diff_key( $groups, $this->botList[$adm] ); |
|
| 102 | + $groupsList = array_diff_key( $groups, $this->botList[ $adm ] ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | foreach ( $groupsList as $group ) { |
| 106 | 106 | try { |
| 107 | 107 | $missing[ $adm ][ $group ] = $this->getFlagDate( $adm, $group ); |
| 108 | 108 | } catch ( TaskException $e ) { |
| 109 | - $this->errors[] = $e->getMessage(); |
|
| 109 | + $this->errors[ ] = $e->getMessage(); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @return string |
| 122 | 122 | * @throws TaskException |
| 123 | 123 | */ |
| 124 | - protected function getFlagDate( string $admin, string $group ) : string { |
|
| 124 | + protected function getFlagDate ( string $admin, string $group ) : string { |
|
| 125 | 125 | $this->getLogger()->info( "Retrieving $group flag date for $admin" ); |
| 126 | 126 | |
| 127 | 127 | $url = DEFAULT_URL; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param string $group |
| 157 | 157 | * @return string|null |
| 158 | 158 | */ |
| 159 | - private function extractTimestamp( \stdClass $data, string $group ) : ?string { |
|
| 159 | + private function extractTimestamp ( \stdClass $data, string $group ) : ?string { |
|
| 160 | 160 | $ts = null; |
| 161 | 161 | foreach ( $data->query->logevents as $entry ) { |
| 162 | 162 | if ( !isset( $entry->params ) ) { |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return array[] |
| 180 | 180 | */ |
| 181 | - protected function getExtraGroups() : array { |
|
| 182 | - $extra = []; |
|
| 181 | + protected function getExtraGroups () : array { |
|
| 182 | + $extra = [ ]; |
|
| 183 | 183 | foreach ( $this->botList as $name => $groups ) { |
| 184 | 184 | if ( !isset( $this->actualList[ $name ] ) ) { |
| 185 | 185 | $extra[ $name ] = $groups; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param array[] $extra |
| 198 | 198 | * @return array[] |
| 199 | 199 | */ |
| 200 | - protected function getNewContent( array $missing, array $extra ) : array { |
|
| 200 | + protected function getNewContent ( array $missing, array $extra ) : array { |
|
| 201 | 201 | $newContent = $this->botList; |
| 202 | 202 | foreach ( $newContent as $user => $groups ) { |
| 203 | 203 | if ( isset( $missing[ $user ] ) ) { |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @inheritDoc |
| 13 | 13 | */ |
| 14 | - public function runInternal() : int { |
|
| 14 | + public function runInternal () : int { |
|
| 15 | 15 | $pages = $this->getDataProvider()->getCreatedPages(); |
| 16 | 16 | $users = $this->getDataProvider()->getUsersToProcess(); |
| 17 | 17 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | return TaskResult::STATUS_NOTHING; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - $ricNums = []; |
|
| 22 | + $ricNums = [ ]; |
|
| 23 | 23 | foreach ( $pages as $page ) { |
| 24 | 24 | $ricNums[ $page->getUser() ] = $page->getNum(); |
| 25 | 25 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param string $user |
| 38 | 38 | * @param int $ricNum |
| 39 | 39 | */ |
| 40 | - protected function addMsg( string $user, int $ricNum ) { |
|
| 40 | + protected function addMsg ( string $user, int $ricNum ) { |
|
| 41 | 41 | $this->getLogger()->info( "Leaving msg to $user" ); |
| 42 | 42 | $msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text(); |
| 43 | 43 | |
@@ -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,21 +29,21 @@ 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 | |
| 36 | 36 | /** |
| 37 | 37 | * @return string[] |
| 38 | 38 | */ |
| 39 | - public function getErrors() { |
|
| 39 | + public function getErrors () { |
|
| 40 | 40 | return $this->errors; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param TaskResult $that |
| 45 | 45 | */ |
| 46 | - public function merge( TaskResult $that ) { |
|
| 46 | + public function merge ( TaskResult $that ) { |
|
| 47 | 47 | $this->status |= $that->status; |
| 48 | 48 | $this->errors = array_merge( $this->errors, $that->errors ); |
| 49 | 49 | } |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @return string |
| 53 | 53 | */ |
| 54 | - public function __toString() { |
|
| 54 | + public function __toString () { |
|
| 55 | 55 | if ( $this->isOK() ) { |
| 56 | 56 | $stat = 'OK'; |
| 57 | 57 | $errs = "\tNo errors."; |
| 58 | 58 | } else { |
| 59 | 59 | $stat = 'ERROR'; |
| 60 | - $formattedErrs = []; |
|
| 60 | + $formattedErrs = [ ]; |
|
| 61 | 61 | foreach ( $this->errors as $err ) { |
| 62 | - $formattedErrs[] = "\t - $err"; |
|
| 62 | + $formattedErrs[ ] = "\t - $err"; |
|
| 63 | 63 | } |
| 64 | 64 | $errs = implode( "\n", $formattedErrs ); |
| 65 | 65 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @return bool |
| 73 | 73 | */ |
| 74 | - public function isOK() : bool { |
|
| 74 | + public function isOK () : bool { |
|
| 75 | 75 | return ( $this->status | self::STATUS_GOOD ) === self::STATUS_GOOD; |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -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 | |
@@ -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 | $orderedList = [ |
| 19 | 19 | 'create-pages', |
| 20 | 20 | 'updates-around', |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @inheritDoc |
| 34 | 34 | */ |
| 35 | - protected function getSubtasksMap() : array { |
|
| 35 | + protected function getSubtasksMap () : array { |
|
| 36 | 36 | return [ |
| 37 | 37 | 'create-pages' => CreatePages::class, |
| 38 | 38 | 'updates-around' => UpdatesAround::class, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Page; |
| 4 | 4 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @param string $title |
| 23 | 23 | */ |
| 24 | - public function __construct( string $title ) { |
|
| 24 | + public function __construct ( string $title ) { |
|
| 25 | 25 | parent::__construct( $title ); |
| 26 | 26 | $this->supportSection = $this->isVote() ? 3 : 0; |
| 27 | 27 | $this->opposeSection = $this->isVote() ? 4 : 3; |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function getUser() : string { |
|
| 36 | - return explode( '/', $this->title )[2]; |
|
| 35 | + public function getUser () : string { |
|
| 36 | + return explode( '/', $this->title )[ 2 ]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return int |
| 43 | 43 | */ |
| 44 | - public function getNum() : int { |
|
| 44 | + public function getNum () : int { |
|
| 45 | 45 | $bits = explode( '/', $this->getTitle() ); |
| 46 | 46 | return intval( end( $bits ) ); |
| 47 | 47 | } |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return string |
| 53 | 53 | */ |
| 54 | - public function getUserNum() : string { |
|
| 55 | - return explode( '/', $this->getTitle(), 3 )[2]; |
|
| 54 | + public function getUserNum () : string { |
|
| 55 | + return explode( '/', $this->getTitle(), 3 )[ 2 ]; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function getBaseTitle() : string { |
|
| 63 | + public function getBaseTitle () : string { |
|
| 64 | 64 | // @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug |
| 65 | 65 | return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) ); |
| 66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return int |
| 72 | 72 | */ |
| 73 | - public function getOpposingCount() : int { |
|
| 73 | + public function getOpposingCount () : int { |
|
| 74 | 74 | return $this->getCountForSection( $this->opposeSection ); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @return int |
| 81 | 81 | * @throws \BadMethodCallException |
| 82 | 82 | */ |
| 83 | - public function getSupportCount() : int { |
|
| 83 | + public function getSupportCount () : int { |
|
| 84 | 84 | if ( !$this->isVote() ) { |
| 85 | 85 | throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' ); |
| 86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param int $secNum |
| 94 | 94 | * @return int |
| 95 | 95 | */ |
| 96 | - protected function getCountForSection( int $secNum ) : int { |
|
| 96 | + protected function getCountForSection ( int $secNum ) : int { |
|
| 97 | 97 | $content = $this->controller->getPageContent( $this->title, $secNum ); |
| 98 | 98 | // Let's hope that this is good enough... |
| 99 | 99 | return substr_count( $content, "\n\# *(?![#*])" ); |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return int |
| 106 | 106 | */ |
| 107 | - protected function getQuorum() : int { |
|
| 107 | + protected function getQuorum () : int { |
|
| 108 | 108 | $reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!"; |
| 109 | - return intval( $this->getMatch( $reg )[1] ); |
|
| 109 | + return intval( $this->getMatch( $reg )[ 1 ] ); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return bool |
| 116 | 116 | */ |
| 117 | - public function hasOpposition() : bool { |
|
| 117 | + public function hasOpposition () : bool { |
|
| 118 | 118 | return $this->getOpposingCount() >= 15; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @return int One of the OUTCOME_* constants |
| 125 | 125 | * @throws \BadMethodCallException |
| 126 | 126 | */ |
| 127 | - public function getOutcome() : int { |
|
| 127 | + public function getOutcome () : int { |
|
| 128 | 128 | if ( !$this->isVote() ) { |
| 129 | 129 | throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' ); |
| 130 | 130 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @throws \BadMethodCallException |
| 145 | 145 | * @throws \LogicException |
| 146 | 146 | */ |
| 147 | - public function getOutcomeText() : string { |
|
| 147 | + public function getOutcomeText () : string { |
|
| 148 | 148 | if ( !$this->isVote() ) { |
| 149 | 149 | throw new \BadMethodCallException( 'No need for an outcome text.' ); |
| 150 | 150 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return bool |
| 180 | 180 | */ |
| 181 | - public function isVote() : bool { |
|
| 181 | + public function isVote () : bool { |
|
| 182 | 182 | $sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/'; |
| 183 | 183 | return !$this->matches( $sectionReg ); |
| 184 | 184 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @return int |
| 190 | 190 | */ |
| 191 | - public function getEndTimestamp() : int { |
|
| 191 | + public function getEndTimestamp () : int { |
|
| 192 | 192 | if ( $this->isVote() ) { |
| 193 | 193 | $reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!"; |
| 194 | 194 | list( , $day, $hours ) = $this->getMatch( $reg ); |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @param string $title |
| 11 | 11 | * @param int|string $section Number or title |
| 12 | 12 | */ |
| 13 | - public function __construct( string $title = '[unavailable]', $section = '[unavailable]' ) { |
|
| 13 | + public function __construct ( string $title = '[unavailable]', $section = '[unavailable]' ) { |
|
| 14 | 14 | parent::__construct( "The section $section in the page $title doesn't exist." ); |
| 15 | 15 | } |
| 16 | 16 | } |