@@ -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 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param LoggerInterface $logger |
37 | 37 | * @param RequestFactory $requestFactory |
38 | 38 | */ |
39 | - public function __construct( |
|
39 | + public function __construct ( |
|
40 | 40 | LoginInfo $li, |
41 | 41 | LoggerInterface $logger, |
42 | 42 | RequestFactory $requestFactory |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @return LoginInfo |
51 | 51 | */ |
52 | - public function getLoginInfo() : LoginInfo { |
|
52 | + public function getLoginInfo () : LoginInfo { |
|
53 | 53 | return $this->loginInfo; |
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @param bool $bot |
58 | 58 | */ |
59 | - public function setEditsAsBot( bool $bot ) : void { |
|
59 | + public function setEditsAsBot ( bool $bot ) : void { |
|
60 | 60 | // FIXME same as setLoginInfo |
61 | 61 | $this->botEdits = $bot; |
62 | 62 | } |
@@ -64,28 +64,28 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - public function getEditsAsBot() : bool { |
|
67 | + public function getEditsAsBot () : bool { |
|
68 | 68 | return $this->botEdits; |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return RequestFactory |
73 | 73 | */ |
74 | - public function getRequestFactory() : RequestFactory { |
|
74 | + public function getRequestFactory () : RequestFactory { |
|
75 | 75 | return $this->requestFactory; |
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @param string $ident |
80 | 80 | */ |
81 | - public function setLocalUserIdentifier( string $ident ) : void { |
|
81 | + public function setLocalUserIdentifier ( string $ident ) : void { |
|
82 | 82 | $this->localUserIdentifier = $ident; |
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @return string |
87 | 87 | */ |
88 | - public function getLocalUserIdentifier() : string { |
|
88 | + public function getLocalUserIdentifier () : string { |
|
89 | 89 | return $this->localUserIdentifier; |
90 | 90 | } |
91 | 91 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @throws MissingPageException |
99 | 99 | * @throws MissingSectionException |
100 | 100 | */ |
101 | - public function getPageContent( string $title, int $section = null ) : string { |
|
101 | + public function getPageContent ( string $title, int $section = null ) : string { |
|
102 | 102 | $msg = "Retrieving content of $title" . ( $section !== null ? ", section $section" : '' ); |
103 | 103 | $this->logger->debug( $msg ); |
104 | 104 | $params = [ |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]; |
111 | 111 | |
112 | 112 | if ( $section !== null ) { |
113 | - $params['rvsection'] = $section; |
|
113 | + $params[ 'rvsection' ] = $section; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $req = $this->buildRequest( $params ); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | throw new MissingPageException( $title ); |
121 | 121 | } |
122 | 122 | |
123 | - $mainSlot = $page->revisions[0]->slots->main; |
|
123 | + $mainSlot = $page->revisions[ 0 ]->slots->main; |
|
124 | 124 | |
125 | 125 | if ( $section !== null && isset( $mainSlot->nosuchsection ) ) { |
126 | 126 | throw new MissingSectionException( $title, $section ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param array $params |
135 | 135 | * @throws EditException |
136 | 136 | */ |
137 | - public function editPage( array $params ) : void { |
|
137 | + public function editPage ( array $params ) : void { |
|
138 | 138 | $this->login(); |
139 | 139 | |
140 | 140 | $params = [ |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ] + $params; |
144 | 144 | |
145 | 145 | if ( $this->getEditsAsBot() ) { |
146 | - $params['bot'] = 1; |
|
146 | + $params[ 'bot' ] = 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $res = $this->buildRequest( $params )->setPost()->execute(); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * Login wrapper. Checks if we're already logged in and clears tokens cache |
162 | 162 | * @throws LoginException |
163 | 163 | */ |
164 | - public function login() : void { |
|
164 | + public function login () : void { |
|
165 | 165 | if ( $this->loginInfo === null ) { |
166 | 166 | throw new CannotLoginException( 'Missing login data' ); |
167 | 167 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | self::$loggedIn = true; |
193 | 193 | // Clear tokens cache |
194 | - $this->tokens = []; |
|
194 | + $this->tokens = [ ]; |
|
195 | 195 | $this->logger->info( 'Login succeeded' ); |
196 | 196 | } |
197 | 197 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param string $type |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function getToken( string $type ) : string { |
|
204 | + public function getToken ( string $type ) : string { |
|
205 | 205 | if ( !isset( $this->tokens[ $type ] ) ) { |
206 | 206 | $params = [ |
207 | 207 | 'action' => 'query', |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @param string $title |
225 | 225 | * @return int |
226 | 226 | */ |
227 | - public function getPageCreationTS( string $title ) : int { |
|
227 | + public function getPageCreationTS ( string $title ) : int { |
|
228 | 228 | $params = [ |
229 | 229 | 'action' => 'query', |
230 | 230 | 'prop' => 'revisions', |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | $res = $this->buildRequest( $params )->execute(); |
239 | 239 | $data = $res->query->pages; |
240 | - return strtotime( reset( $data )->revisions[0]->timestamp ); |
|
240 | + return strtotime( reset( $data )->revisions[ 0 ]->timestamp ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @param string $title |
247 | 247 | * @param string $reason |
248 | 248 | */ |
249 | - public function protectPage( string $title, string $reason ) : void { |
|
249 | + public function protectPage ( string $title, string $reason ) : void { |
|
250 | 250 | $this->logger->info( "Protecting page $title" ); |
251 | 251 | $this->login(); |
252 | 252 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param array $params |
268 | 268 | * @return RequestBase |
269 | 269 | */ |
270 | - private function buildRequest( array $params ) : RequestBase { |
|
270 | + private function buildRequest ( array $params ) : RequestBase { |
|
271 | 271 | return $this->requestFactory->newFromParams( $params ); |
272 | 272 | } |
273 | 273 | } |
@@ -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,15 +14,15 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @inheritDoc |
16 | 16 | */ |
17 | - protected function getSubtasksMap(): array { |
|
17 | + protected function getSubtasksMap (): array { |
|
18 | 18 | // Everything is done here. |
19 | - return []; |
|
19 | + return [ ]; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @inheritDoc |
24 | 24 | */ |
25 | - public function runInternal() : int { |
|
25 | + public function runInternal () : int { |
|
26 | 26 | $pages = $this->getDataProvider()->getOpenPages(); |
27 | 27 | |
28 | 28 | if ( !$pages ) { |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @param PageRiconferma[] $pages |
37 | 37 | * @return int a STATUS_* constant |
38 | 38 | */ |
39 | - protected function processPages( array $pages ) : int { |
|
40 | - $donePages = []; |
|
39 | + protected function processPages ( array $pages ) : int { |
|
40 | + $donePages = [ ]; |
|
41 | 41 | foreach ( $pages as $page ) { |
42 | 42 | if ( $page->hasOpposition() && !$page->isVote() ) { |
43 | 43 | $this->openVote( $page ); |
44 | - $donePages[] = $page; |
|
44 | + $donePages[ ] = $page; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @param PageRiconferma $page |
61 | 61 | */ |
62 | - protected function openVote( PageRiconferma $page ) : void { |
|
62 | + protected function openVote ( PageRiconferma $page ) : void { |
|
63 | 63 | $this->getLogger()->info( "Starting vote on $page" ); |
64 | 64 | |
65 | 65 | $content = $page->getContent(); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * @see SimpleUpdates::updateVotazioni() |
99 | 99 | * @see OpenUpdates::addToVotazioni() |
100 | 100 | */ |
101 | - protected function updateVotazioni( array $pages ) : void { |
|
101 | + protected function updateVotazioni ( array $pages ) : void { |
|
102 | 102 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
103 | 103 | |
104 | - $users = []; |
|
104 | + $users = [ ]; |
|
105 | 105 | foreach ( $pages as $page ) { |
106 | - $users[] = $this->getUser( $page->getUserName() ); |
|
106 | + $users[ ] = $this->getUser( $page->getUserName() ); |
|
107 | 107 | } |
108 | 108 | $usersReg = RegexUtils::regexFromArray( '!', $users ); |
109 | 109 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @see SimpleUpdates::updateNews() |
142 | 142 | * @see OpenUpdates::addToNews() |
143 | 143 | */ |
144 | - protected function updateNews( int $amount ) : void { |
|
144 | + protected function updateNews ( int $amount ) : void { |
|
145 | 145 | $this->getLogger()->info( "Turning $amount pages into votes" ); |
146 | 146 | $newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) ); |
147 | 147 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | throw new TaskException( 'Param "voto" not found in news page' ); |
157 | 157 | } |
158 | 158 | |
159 | - $newTac = ( (int)$newsPage->getMatch( $regTac )[2] - $amount ) ?: ''; |
|
160 | - $newVot = ( (int)$newsPage->getMatch( $regVot )[2] + $amount ) ?: ''; |
|
159 | + $newTac = ( (int)$newsPage->getMatch( $regTac )[ 2 ] - $amount ) ?: ''; |
|
160 | + $newVot = ( (int)$newsPage->getMatch( $regVot )[ 2 ] + $amount ) ?: ''; |
|
161 | 161 | |
162 | 162 | $newContent = preg_replace( $regTac, '${1}' . $newTac, $content ); |
163 | 163 | $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 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @inheritDoc |
18 | 18 | */ |
19 | - public function runInternal() : int { |
|
19 | + public function runInternal () : int { |
|
20 | 20 | $failed = $this->getFailures(); |
21 | 21 | if ( !$failed ) { |
22 | 22 | return TaskResult::STATUS_NOTHING; |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return PageRiconferma[] |
40 | 40 | */ |
41 | - private function getFailures() : array { |
|
42 | - $ret = []; |
|
41 | + private function getFailures () : array { |
|
42 | + $ret = [ ]; |
|
43 | 43 | $allPages = $this->getDataProvider()->getPagesToClose(); |
44 | 44 | foreach ( $allPages as $page ) { |
45 | 45 | if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) { |
46 | - $ret[] = $page; |
|
46 | + $ret[ ] = $page; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | return $ret; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @param User[] $users |
54 | 54 | */ |
55 | - protected function updateBurList( array $users ) : void { |
|
55 | + protected function updateBurList ( array $users ) : void { |
|
56 | 56 | $this->getLogger()->info( 'Updating bur list. Removing: ' . implode( ', ', $users ) ); |
57 | 57 | $remList = RegexUtils::regexFromArray( '!', $users ); |
58 | 58 | $burList = $this->getPage( $this->getOpt( 'bur-list-title' ) ); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @param PageRiconferma[] $pages |
77 | 77 | */ |
78 | - protected function requestRemoval( array $pages ) : void { |
|
78 | + protected function requestRemoval ( array $pages ) : void { |
|
79 | 79 | $this->getLogger()->info( 'Requesting flag removal for: ' . implode( ', ', $pages ) ); |
80 | 80 | |
81 | 81 | $metaWiki = $this->getWikiGroup()->getCentralWiki(); |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @param PageRiconferma[] $pages |
117 | 117 | */ |
118 | - protected function updateAnnunci( array $pages ) : void { |
|
118 | + protected function updateAnnunci ( array $pages ) : void { |
|
119 | 119 | $this->getLogger()->info( 'Updating annunci' ); |
120 | 120 | $section = 1; |
121 | 121 | |
122 | - $names = []; |
|
122 | + $names = [ ]; |
|
123 | 123 | $text = ''; |
124 | 124 | foreach ( $pages as $page ) { |
125 | 125 | $user = $page->getUserName(); |
126 | - $names[] = $user; |
|
126 | + $names[ ] = $user; |
|
127 | 127 | $text .= $this->msg( 'annunci-text' )->params( [ '$user' => $user ] )->text(); |
128 | 128 | } |
129 | 129 | |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @param PageRiconferma[] $pages |
157 | 157 | */ |
158 | - protected function updateUltimeNotizie( array $pages ) : void { |
|
158 | + protected function updateUltimeNotizie ( array $pages ) : void { |
|
159 | 159 | $this->getLogger()->info( 'Updating ultime notizie' ); |
160 | 160 | $notiziePage = $this->getPage( $this->getOpt( 'ultimenotizie-page-title' ) ); |
161 | 161 | |
162 | - $names = []; |
|
162 | + $names = [ ]; |
|
163 | 163 | $text = ''; |
164 | 164 | $msg = $this->msg( 'ultimenotizie-text' ); |
165 | 165 | foreach ( $pages as $page ) { |
166 | 166 | $user = $page->getUserName(); |
167 | - $names[] = $user; |
|
167 | + $names[ ] = $user; |
|
168 | 168 | $text .= $msg->params( [ '$user' => $user, '$title' => $page->getTitle() ] )->text(); |
169 | 169 | } |
170 | 170 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @param PageRiconferma[] $pages |
194 | 194 | * @return User[] |
195 | 195 | */ |
196 | - private function getFailedBureaucrats( array $pages ) : array { |
|
197 | - $ret = []; |
|
196 | + private function getFailedBureaucrats ( array $pages ) : array { |
|
197 | + $ret = [ ]; |
|
198 | 198 | foreach ( $pages as $page ) { |
199 | 199 | $user = $this->getUser( $page->getUserName() ); |
200 | 200 | if ( $user->inGroup( 'bureaucrat' ) ) { |
201 | - $ret[] = $user; |
|
201 | + $ret[ ] = $user; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | return $ret; |
@@ -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 ) { |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | * @param PageRiconferma[] $pages |
37 | 37 | * @see OpenUpdates::addToVotazioni() |
38 | 38 | */ |
39 | - protected function updateVotazioni( array $pages ) : void { |
|
39 | + protected function updateVotazioni ( array $pages ) : void { |
|
40 | 40 | $this->getLogger()->info( |
41 | 41 | 'Updating votazioni: ' . implode( ', ', $pages ) |
42 | 42 | ); |
43 | 43 | $votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) ); |
44 | 44 | |
45 | - $users = []; |
|
45 | + $users = [ ]; |
|
46 | 46 | foreach ( $pages as $page ) { |
47 | - $users[] = $this->getUser( $page->getUserName() ); |
|
47 | + $users[ ] = $this->getUser( $page->getUserName() ); |
|
48 | 48 | } |
49 | 49 | $usersReg = RegexUtils::regexFromArray( '!', $users ); |
50 | 50 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param array $pages |
66 | 66 | * @see OpenUpdates::addToNews() |
67 | 67 | */ |
68 | - protected function updateNews( array $pages ) : void { |
|
68 | + protected function updateNews ( array $pages ) : void { |
|
69 | 69 | $simpleAmount = $voteAmount = 0; |
70 | 70 | foreach ( $pages as $page ) { |
71 | 71 | if ( $page->isVote() ) { |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | $simpleMatches = $newsPage->getMatch( $simpleReg ); |
86 | 86 | $voteMatches = $newsPage->getMatch( $voteReg ); |
87 | 87 | |
88 | - $newSimp = ( (int)$simpleMatches[2] - $simpleAmount ) ?: ''; |
|
89 | - $newVote = ( (int)$voteMatches[2] - $voteAmount ) ?: ''; |
|
88 | + $newSimp = ( (int)$simpleMatches[ 2 ] - $simpleAmount ) ?: ''; |
|
89 | + $newVote = ( (int)$voteMatches[ 2 ] - $voteAmount ) ?: ''; |
|
90 | 90 | $newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $newsPage->getContent() ); |
91 | 91 | $newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent ); |
92 | 92 | |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param bool[] $outcomes |
106 | 106 | */ |
107 | - protected function updateAdminList( array $outcomes ) : void { |
|
107 | + protected function updateAdminList ( array $outcomes ) : void { |
|
108 | 108 | $this->getLogger()->info( 'Updating admin list' ); |
109 | 109 | $adminsPage = $this->getPage( $this->getOpt( 'admins-list-title' ) ); |
110 | 110 | $newContent = $adminsPage->getContent(); |
111 | 111 | |
112 | - $riconfNames = $removeNames = []; |
|
112 | + $riconfNames = $removeNames = [ ]; |
|
113 | 113 | foreach ( $outcomes as $username => $confirmed ) { |
114 | 114 | $user = $this->getUser( $username ); |
115 | 115 | $userReg = $user->getRegex( '!' ); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | '${1}{{subst:#timel:Ymd}}|' . $nextDate . '$2', |
125 | 125 | $newContent |
126 | 126 | ); |
127 | - $riconfNames[] = $username; |
|
127 | + $riconfNames[ ] = $username; |
|
128 | 128 | } else { |
129 | 129 | $newContent = preg_replace( $reg, '', $newContent ); |
130 | - $removeNames[] = $username; |
|
130 | + $removeNames[ ] = $username; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -147,21 +147,21 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * @param bool[] $outcomes |
149 | 149 | */ |
150 | - protected function updateCUList( array $outcomes ) : void { |
|
150 | + protected function updateCUList ( array $outcomes ) : void { |
|
151 | 151 | $this->getLogger()->info( 'Updating CU list.' ); |
152 | 152 | $cuList = $this->getPage( $this->getOpt( 'cu-list-title' ) ); |
153 | 153 | $newContent = $cuList->getContent(); |
154 | 154 | |
155 | - $riconfNames = $removeNames = []; |
|
155 | + $riconfNames = $removeNames = [ ]; |
|
156 | 156 | foreach ( $outcomes as $user => $confirmed ) { |
157 | 157 | $userReg = $this->getUser( $user )->getRegex( '!' ); |
158 | 158 | $reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!"; |
159 | 159 | if ( $confirmed ) { |
160 | 160 | $newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent ); |
161 | - $riconfNames[] = $user; |
|
161 | + $riconfNames[ ] = $user; |
|
162 | 162 | } else { |
163 | 163 | $newContent = preg_replace( $reg, '', $newContent ); |
164 | - $removeNames[] = $user; |
|
164 | + $removeNames[ ] = $user; |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | * @param PageRiconferma[] $pages |
186 | 186 | * @return bool[] |
187 | 187 | */ |
188 | - private function getGroupOutcomes( string $group, array $pages ) : array { |
|
189 | - $ret = []; |
|
188 | + private function getGroupOutcomes ( string $group, array $pages ) : array { |
|
189 | + $ret = [ ]; |
|
190 | 190 | foreach ( $pages as $page ) { |
191 | 191 | $user = $this->getUser( $page->getUserName() ); |
192 | 192 | if ( $user->inGroup( $group ) ) { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Utils; |
4 | 4 | |
@@ -9,5 +9,5 @@ discard block |
||
9 | 9 | * @param string $delimiter |
10 | 10 | * @return string |
11 | 11 | */ |
12 | - public function getRegex( string $delimiter ) : string; |
|
12 | + public function getRegex ( string $delimiter ) : string; |
|
13 | 13 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare( strict_types=1 ); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace BotRiconferme\Utils; |
4 | 4 | |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | * @param IRegexAble ...$elements |
11 | 11 | * @return string |
12 | 12 | */ |
13 | - public static function regexFromArray( |
|
13 | + public static function regexFromArray ( |
|
14 | 14 | string $delimiter = '/', |
15 | 15 | IRegexAble ...$elements |
16 | 16 | ) : string { |
17 | - $bits = []; |
|
17 | + $bits = [ ]; |
|
18 | 18 | foreach ( $elements as $el ) { |
19 | - $bits[] = $el->getRegex( $delimiter ); |
|
19 | + $bits[ ] = $el->getRegex( $delimiter ); |
|
20 | 20 | } |
21 | 21 | return '(?:' . implode( '|', $bits ) . ')'; |
22 | 22 | } |