@@ -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,16 +14,16 @@ discard block |
||
| 14 | 14 | /** @var User[]|null */ |
| 15 | 15 | private $processUsers; |
| 16 | 16 | /** @var PageRiconferma[] */ |
| 17 | - private $createdPages = []; |
|
| 17 | + private $createdPages = [ ]; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Get a list of users to execute tasks on. |
| 21 | 21 | * |
| 22 | 22 | * @return User[] |
| 23 | 23 | */ |
| 24 | - public function getUsersToProcess() : array { |
|
| 24 | + public function getUsersToProcess () : array { |
|
| 25 | 25 | if ( $this->processUsers === null ) { |
| 26 | - $this->processUsers = []; |
|
| 26 | + $this->processUsers = [ ]; |
|
| 27 | 27 | foreach ( PageBotList::get( $this->getWiki() )->getAdminsList() as $name => $user ) { |
| 28 | 28 | if ( $this->shouldAddUser( $user ) ) { |
| 29 | 29 | $this->processUsers[ $name ] = $user; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param User $user |
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
| 43 | - private function shouldAddUser( User $user ) : bool { |
|
| 43 | + private function shouldAddUser ( User $user ) : bool { |
|
| 44 | 44 | $override = true; |
| 45 | 45 | $timestamp = PageBotList::getOverrideTimestamp( $user->getUserInfo() ); |
| 46 | 46 | |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return PageRiconferma[] |
| 61 | 61 | */ |
| 62 | - public function getOpenPages() : array { |
|
| 62 | + public function getOpenPages () : array { |
|
| 63 | 63 | static $list = null; |
| 64 | 64 | if ( $list === null ) { |
| 65 | - $list = []; |
|
| 65 | + $list = [ ]; |
|
| 66 | 66 | $mainTitle = $this->getOpt( 'main-page-title' ); |
| 67 | 67 | $params = [ |
| 68 | 68 | 'action' => 'query', |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $pages = RequestBase::newFromParams( $params )->execute()->query->pages; |
| 77 | 77 | foreach ( reset( $pages )->templates as $page ) { |
| 78 | 78 | if ( preg_match( "!$titleReg\/[^\/]+\/\d!", $page->title ) ) { |
| 79 | - $list[] = new PageRiconferma( $page->title, $this->getWiki() ); |
|
| 79 | + $list[ ] = new PageRiconferma( $page->title, $this->getWiki() ); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return PageRiconferma[] |
| 91 | 91 | */ |
| 92 | - public function getPagesToClose() : array { |
|
| 92 | + public function getPagesToClose () : array { |
|
| 93 | 93 | static $list = null; |
| 94 | 94 | if ( $list === null ) { |
| 95 | - $list = []; |
|
| 95 | + $list = [ ]; |
|
| 96 | 96 | foreach ( $this->getOpenPages() as $page ) { |
| 97 | 97 | if ( time() > $page->getEndTimestamp() ) { |
| 98 | - $list[] = $page; |
|
| 98 | + $list[ ] = $page; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @param string $name |
| 109 | 109 | */ |
| 110 | - public function removeUser( string $name ) { |
|
| 110 | + public function removeUser ( string $name ) { |
|
| 111 | 111 | unset( $this->processUsers[ $name ] ); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @return PageRiconferma[] |
| 116 | 116 | */ |
| 117 | - public function getCreatedPages() : array { |
|
| 117 | + public function getCreatedPages () : array { |
|
| 118 | 118 | return $this->createdPages; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * @param PageRiconferma $page |
| 123 | 123 | */ |
| 124 | - public function addCreatedPages( PageRiconferma $page ) { |
|
| 125 | - $this->createdPages[] = $page; |
|
| 124 | + public function addCreatedPages ( PageRiconferma $page ) { |
|
| 125 | + $this->createdPages[ ] = $page; |
|
| 126 | 126 | } |
| 127 | 127 | } |