| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 21 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | View Code Duplication | public function findActiveFollowing($userId) |
|
|
|
|||
| 18 | { |
||
| 19 | $dql = sprintf( |
||
| 20 | 'SELECT u FROM %s u |
||
| 21 | JOIN %s ur WITH ur.nodeId = u.id |
||
| 22 | WHERE ur.userId = :userId |
||
| 23 | AND ur.type = :type |
||
| 24 | AND u.lastAction IS NOT NULL |
||
| 25 | ORDER BY u.login ASC', |
||
| 26 | User::class, |
||
| 27 | UserRelation::class |
||
| 28 | ); |
||
| 29 | |||
| 30 | $query = $this->_em->createQuery($dql) |
||
| 31 | ->setParameters([ |
||
| 32 | 'userId' => $userId, |
||
| 33 | 'type' => UserRelation::TYPE_FRIEND, |
||
| 34 | ]); |
||
| 35 | |||
| 36 | return $query->getResult(); |
||
| 37 | } |
||
| 38 | |||
| 95 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.