@@ -1,4 +1,4 @@ |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Exception; |
4 | 4 |
@@ -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 | 'open-updates', |
@@ -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 | 'open-updates' => OpenUpdates::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\Request; |
4 | 4 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @inheritDoc |
13 | 13 | * @throws APIRequestException |
14 | 14 | */ |
15 | - protected function reallyMakeRequest( string $params ) : string { |
|
15 | + protected function reallyMakeRequest ( string $params ) : string { |
|
16 | 16 | $curl = curl_init(); |
17 | 17 | if ( $curl === false ) { |
18 | 18 | throw new APIRequestException( 'Cannot open cURL handler.' ); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @internal Only used as CB for cURL (CURLOPT_HEADERFUNCTION) |
56 | 56 | * @suppress PhanUnreferencedPublicMethod,PhanUnusedPublicNoOverrideMethodParameter |
57 | 57 | */ |
58 | - public function headersHandler( $ch, string $header ) : int { |
|
58 | + public function headersHandler ( $ch, string $header ) : int { |
|
59 | 59 | $bits = explode( ':', $header, 2 ); |
60 | - if ( trim( $bits[0] ) === 'Set-Cookie' ) { |
|
61 | - $this->newCookies[] = $bits[1]; |
|
60 | + if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) { |
|
61 | + $this->newCookies[ ] = $bits[ 1 ]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | 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\Logger; |
4 | 4 | |
@@ -8,5 +8,5 @@ discard block |
||
8 | 8 | * Logger aware of flushing. Can be declared empty if the buffer is flushed immediately. |
9 | 9 | */ |
10 | 10 | interface IFlushingAwareLogger extends LoggerInterface { |
11 | - public function flush() : void; |
|
11 | + public function flush () : void; |
|
12 | 12 | } |
@@ -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()->getCreatedPages(); |
18 | 18 | |
19 | 19 | if ( !$pages ) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param PageRiconferma[] $pages |
37 | 37 | */ |
38 | - protected function addToMainPage( array $pages ) : void { |
|
38 | + protected function addToMainPage ( array $pages ) : void { |
|
39 | 39 | $this->getLogger()->info( |
40 | 40 | 'Adding the following to main: ' . implode( ', ', $pages ) |
41 | 41 | ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param PageRiconferma[] $pages |
70 | 70 | */ |
71 | - protected function addToVotazioni( array $pages ) : void { |
|
71 | + protected function addToVotazioni ( array $pages ) : void { |
|
72 | 72 | $this->getLogger()->info( |
73 | 73 | 'Adding the following to votes: ' . implode( ', ', $pages ) |
74 | 74 | ); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param int $amount |
106 | 106 | * @throws TaskException |
107 | 107 | */ |
108 | - protected function addToNews( int $amount ) : void { |
|
108 | + protected function addToNews ( int $amount ) : void { |
|
109 | 109 | $this->getLogger()->info( "Increasing the news counter by $amount" ); |
110 | 110 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $matches = $newsPage->getMatch( $reg ); |
120 | 120 | |
121 | - $newNum = (int)$matches[2] + $amount; |
|
121 | + $newNum = (int)$matches[ 2 ] + $amount; |
|
122 | 122 | $newContent = preg_replace( $reg, '${1}' . $newNum, $content ); |
123 | 123 | |
124 | 124 | $summary = $this->msg( '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 | |
19 | 19 | if ( !$pages ) { |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * @param PageRiconferma[] $pages |
33 | 33 | * @see OpenUpdates::addToMainPage() |
34 | 34 | */ |
35 | - protected function removeFromMainPage( array $pages ) : void { |
|
35 | + protected function removeFromMainPage ( array $pages ) : void { |
|
36 | 36 | $this->getLogger()->info( |
37 | 37 | 'Removing from main: ' . implode( ', ', $pages ) |
38 | 38 | ); |
39 | 39 | |
40 | 40 | $mainPage = $this->getPage( $this->getOpt( 'main-page-title' ) ); |
41 | - $remove = []; |
|
41 | + $remove = [ ]; |
|
42 | 42 | foreach ( $pages as $page ) { |
43 | 43 | // Order matters here. It's not guaranteed that there'll be a newline, but avoid |
44 | 44 | // regexps for that single character. |
45 | - $remove[] = '{{' . $page->getTitle() . "}}\n"; |
|
46 | - $remove[] = '{{' . $page->getTitle() . '}}'; |
|
45 | + $remove[ ] = '{{' . $page->getTitle() . "}}\n"; |
|
46 | + $remove[ ] = '{{' . $page->getTitle() . '}}'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $newContent = str_replace( $remove, '', $mainPage->getContent() ); |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param PageRiconferma[] $pages |
74 | 74 | */ |
75 | - protected function addToArchive( array $pages ) : void { |
|
75 | + protected function addToArchive ( array $pages ) : void { |
|
76 | 76 | $this->getLogger()->info( |
77 | 77 | 'Adding to archive: ' . implode( ', ', $pages ) |
78 | 78 | ); |
79 | 79 | |
80 | - $simple = $votes = []; |
|
80 | + $simple = $votes = [ ]; |
|
81 | 81 | foreach ( $pages as $page ) { |
82 | 82 | if ( $page->isVote() ) { |
83 | - $votes[] = $page; |
|
83 | + $votes[ ] = $page; |
|
84 | 84 | } else { |
85 | - $simple[] = $page; |
|
85 | + $simple[ ] = $page; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | * @param string $archiveTitle |
104 | 104 | * @param PageRiconferma[] $pages |
105 | 105 | */ |
106 | - private function reallyAddToArchive( string $archiveTitle, array $pages ) : void { |
|
106 | + private function reallyAddToArchive ( string $archiveTitle, array $pages ) : void { |
|
107 | 107 | $archivePage = $this->getPage( "$archiveTitle/" . date( 'Y' ) ); |
108 | 108 | $existed = $archivePage->exists(); |
109 | 109 | |
110 | 110 | $append = "\n"; |
111 | - $archivedList = []; |
|
111 | + $archivedList = [ ]; |
|
112 | 112 | foreach ( $pages as $page ) { |
113 | 113 | $append .= '{{' . $page->getTitle() . "}}\n"; |
114 | - $archivedList[] = $page->getUserNum(); |
|
114 | + $archivedList[ ] = $page->getUserNum(); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $summary = $this->msg( 'close-archive-summary' ) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @param string $archiveTitle |
134 | 134 | */ |
135 | - private function addArchiveYear( string $archiveTitle ) : void { |
|
135 | + private function addArchiveYear ( string $archiveTitle ) : void { |
|
136 | 136 | $page = $this->getPage( $archiveTitle ); |
137 | 137 | $year = date( 'Y' ); |
138 | 138 |
@@ -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 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @param string $minlevel |
19 | 19 | */ |
20 | - public function __construct( $minlevel = LogLevel::INFO ) { |
|
20 | + public function __construct ( $minlevel = LogLevel::INFO ) { |
|
21 | 21 | $this->minLevel = $this->levelToInt( $minlevel ); |
22 | 22 | } |
23 | 23 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @inheritDoc |
26 | 26 | * @suppress PhanUnusedPublicMethodParameter |
27 | 27 | */ |
28 | - public function log( $level, $message, array $context = [] ) : void { |
|
28 | + public function log ( $level, $message, array $context = [ ] ) : void { |
|
29 | 29 | if ( $this->levelToInt( $level ) >= $this->minLevel ) { |
30 | 30 | echo $this->getFormattedMessage( $level, $message ) . "\n"; |
31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @inheritDoc |
36 | 36 | */ |
37 | - public function flush() : void { |
|
37 | + public function flush () : void { |
|
38 | 38 | // Everything else is printed immediately |
39 | 39 | echo "\n" . str_repeat( '-', 80 ) . "\n\n"; |
40 | 40 | } |
@@ -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 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @param IFlushingAwareLogger ...$loggers |
16 | 16 | */ |
17 | - public function __construct( IFlushingAwareLogger ...$loggers ) { |
|
17 | + public function __construct ( IFlushingAwareLogger ...$loggers ) { |
|
18 | 18 | $this->loggers = $loggers; |
19 | 19 | } |
20 | 20 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @inheritDoc |
23 | 23 | * @suppress PhanUnusedPublicMethodParameter |
24 | 24 | */ |
25 | - public function log( $level, $message, array $context = [] ) :void { |
|
25 | + public function log ( $level, $message, array $context = [ ] ) :void { |
|
26 | 26 | foreach ( $this->loggers as $logger ) { |
27 | 27 | $logger->log( $level, $message ); |
28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @inheritDoc |
33 | 33 | */ |
34 | - public function flush() : void { |
|
34 | + public function flush () : void { |
|
35 | 35 | foreach ( $this->loggers as $logger ) { |
36 | 36 | $logger->flush(); |
37 | 37 | } |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param string $level |
12 | 12 | * @return int |
13 | 13 | */ |
14 | - protected function levelToInt( string $level ) : int { |
|
14 | + protected function levelToInt ( string $level ) : int { |
|
15 | 15 | // Order matters |
16 | 16 | $mapping = [ |
17 | 17 | LogLevel::DEBUG, |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param string $message |
32 | 32 | * @return string |
33 | 33 | */ |
34 | - protected function getFormattedMessage( string $level, string $message ) : string { |
|
34 | + protected function getFormattedMessage ( string $level, string $message ) : string { |
|
35 | 35 | return sprintf( '%s [%s] - %s', date( 'd M H:i:s' ), $level, $message ); |
36 | 36 | } |
37 | 37 | } |