@@ -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 @@ |
||
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; |
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\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; |
4 | 4 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param MessageProvider $mp |
37 | 37 | * @param PageBotList $pbl |
38 | 38 | */ |
39 | - public function __construct( |
|
39 | + public function __construct ( |
|
40 | 40 | LoggerInterface $logger, |
41 | 41 | WikiGroup $wikiGroup, |
42 | 42 | MessageProvider $mp, |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return LoggerInterface |
54 | 54 | */ |
55 | - protected function getLogger() : LoggerInterface { |
|
55 | + protected function getLogger () : LoggerInterface { |
|
56 | 56 | return $this->logger; |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @inheritDoc |
61 | 61 | */ |
62 | - public function setLogger( LoggerInterface $logger ) : void { |
|
62 | + public function setLogger ( LoggerInterface $logger ) : void { |
|
63 | 63 | $this->logger = $logger; |
64 | 64 | } |
65 | 65 | |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | * @param string $optname |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - protected function getOpt( string $optname ) { |
|
72 | + protected function getOpt ( string $optname ) { |
|
73 | 73 | return $this->getConfig()->get( $optname ); |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * @return Config |
78 | 78 | */ |
79 | - protected function getConfig() : Config { |
|
79 | + protected function getConfig () : Config { |
|
80 | 80 | return $this->config; |
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @param Config $cfg |
85 | 85 | */ |
86 | - protected function setConfig( Config $cfg ) : void { |
|
86 | + protected function setConfig ( Config $cfg ) : void { |
|
87 | 87 | $this->config = $cfg; |
88 | 88 | } |
89 | 89 | |
@@ -91,35 +91,35 @@ discard block |
||
91 | 91 | * Shorthand |
92 | 92 | * @return Wiki |
93 | 93 | */ |
94 | - protected function getWiki() : Wiki { |
|
94 | + protected function getWiki () : Wiki { |
|
95 | 95 | return $this->getWikiGroup()->getMainWiki(); |
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @return WikiGroup |
100 | 100 | */ |
101 | - protected function getWikiGroup() : WikiGroup { |
|
101 | + protected function getWikiGroup () : WikiGroup { |
|
102 | 102 | return $this->wikiGroup; |
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | 106 | * @param WikiGroup $wikiGroup |
107 | 107 | */ |
108 | - protected function setWikiGroup( WikiGroup $wikiGroup ) : void { |
|
108 | + protected function setWikiGroup ( WikiGroup $wikiGroup ) : void { |
|
109 | 109 | $this->wikiGroup = $wikiGroup; |
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | 113 | * @return MessageProvider |
114 | 114 | */ |
115 | - protected function getMessageProvider() : MessageProvider { |
|
115 | + protected function getMessageProvider () : MessageProvider { |
|
116 | 116 | return $this->messageProvider; |
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | 120 | * @param MessageProvider $mp |
121 | 121 | */ |
122 | - protected function setMessageProvider( MessageProvider $mp ) : void { |
|
122 | + protected function setMessageProvider ( MessageProvider $mp ) : void { |
|
123 | 123 | $this->messageProvider = $mp; |
124 | 124 | } |
125 | 125 | |
@@ -129,21 +129,21 @@ discard block |
||
129 | 129 | * @param string $key |
130 | 130 | * @return Message |
131 | 131 | */ |
132 | - protected function msg( string $key ) : Message { |
|
132 | + protected function msg ( string $key ) : Message { |
|
133 | 133 | return $this->messageProvider->getMessage( $key ); |
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
137 | 137 | * @return PageBotList |
138 | 138 | */ |
139 | - public function getBotList() : PageBotList { |
|
139 | + public function getBotList () : PageBotList { |
|
140 | 140 | return $this->pageBotList; |
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | 144 | * @return RequestFactory |
145 | 145 | */ |
146 | - public function getRequestFactory() : RequestFactory { |
|
146 | + public function getRequestFactory () : RequestFactory { |
|
147 | 147 | return $this->getWiki()->getRequestFactory(); |
148 | 148 | } |
149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param string $title |
154 | 154 | * @return Page |
155 | 155 | */ |
156 | - protected function getPage( string $title ) : Page { |
|
156 | + protected function getPage ( string $title ) : Page { |
|
157 | 157 | return new Page( $title, $this->getWiki() ); |
158 | 158 | } |
159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param string $name |
164 | 164 | * @return User |
165 | 165 | */ |
166 | - protected function getUser( string $name ) : User { |
|
166 | + protected function getUser ( string $name ) : User { |
|
167 | 167 | $ui = $this->getBotList()->getUserInfo( $name ); |
168 | 168 | return new User( $ui, $this->getWiki() ); |
169 | 169 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\TaskHelper; |
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,7 +29,7 @@ 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 | |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * @return string[] |
38 | 38 | * @suppress PhanUnreferencedPublicMethod |
39 | 39 | */ |
40 | - public function getErrors() : array { |
|
40 | + public function getErrors () : array { |
|
41 | 41 | return $this->errors; |
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @param TaskResult $that |
46 | 46 | */ |
47 | - public function merge( TaskResult $that ) : void { |
|
47 | + public function merge ( TaskResult $that ) : void { |
|
48 | 48 | $this->status |= $that->status; |
49 | 49 | $this->errors = array_merge( $this->errors, $that->errors ); |
50 | 50 | } |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - public function __toString() { |
|
55 | + public function __toString () { |
|
56 | 56 | if ( $this->isOK() ) { |
57 | 57 | $stat = 'OK'; |
58 | 58 | $errs = "\tNo errors."; |
59 | 59 | } else { |
60 | 60 | $stat = 'ERROR'; |
61 | - $formattedErrs = []; |
|
61 | + $formattedErrs = [ ]; |
|
62 | 62 | foreach ( $this->errors as $err ) { |
63 | - $formattedErrs[] = "\t - $err"; |
|
63 | + $formattedErrs[ ] = "\t - $err"; |
|
64 | 64 | } |
65 | 65 | $errs = implode( "\n", $formattedErrs ); |
66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return bool |
74 | 74 | */ |
75 | - public function isOK() : bool { |
|
75 | + public function isOK () : bool { |
|
76 | 76 | return ( $this->status | self::STATUS_GOOD ) === self::STATUS_GOOD; |
77 | 77 | } |
78 | 78 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | /** |
3 | 3 | * Entry point for the bot, called by CLI |
4 | 4 | */ |
@@ -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 |