| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2.0054 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 15 | 4 | public function getUserSubscribersCountById($id): int |
|
| 16 | { |
||
| 17 | 4 | if (!is_int($id)) { |
|
| 18 | throw new \InvalidArgumentException('$id must be an integer'); |
||
| 19 | } |
||
| 20 | |||
| 21 | 4 | $qb = $this->createQueryBuilder('s'); |
|
| 22 | return $qb |
||
| 23 | 4 | ->select('COUNT(s.subscriber)') |
|
| 24 | 4 | ->innerJoin('s.author', 'sa') |
|
| 25 | 4 | ->where('sa.id = :id') |
|
| 26 | 4 | ->setParameter('id', $id) |
|
| 27 | 4 | ->getQuery()->getSingleScalarResult() |
|
| 28 | ; |
||
| 29 | } |
||
| 30 | |||
| 47 | } |