| Total Complexity | 6 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare( strict_types=1 ); |
||
| 8 | class UserNotice extends Subtask { |
||
| 9 | /** |
||
| 10 | * @inheritDoc |
||
| 11 | */ |
||
| 12 | public function runInternal() : int { |
||
| 13 | $pages = $this->getDataProvider()->getCreatedPages(); |
||
| 14 | $users = $this->getDataProvider()->getUsersToProcess(); |
||
| 15 | |||
| 16 | if ( !$pages || !$users ) { |
||
|
1 ignored issue
–
show
|
|||
| 17 | return self::STATUS_NOTHING; |
||
| 18 | } |
||
| 19 | |||
| 20 | $ricNums = []; |
||
| 21 | foreach ( $pages as $page ) { |
||
| 22 | $ricNums[ $page->getUser() ] = $page->getNum(); |
||
| 23 | } |
||
| 24 | |||
| 25 | foreach ( $users as $user => $_ ) { |
||
| 26 | $this->addMsg( $user, $ricNums[ $user ] ); |
||
| 27 | } |
||
| 28 | |||
| 29 | return self::STATUS_GOOD; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Leaves a message to the talk page |
||
| 34 | * |
||
| 35 | * @param string $user |
||
| 36 | * @param int $ricNum |
||
| 37 | */ |
||
| 38 | protected function addMsg( string $user, int $ricNum ) { |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.