| Total Complexity | 5 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class FrontendUserRepository |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | private $table = 'fe_users'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var ConnectionPool |
||
| 19 | */ |
||
| 20 | private $pool; |
||
| 21 | |||
| 22 | public function __construct(ConnectionPool $pool) |
||
| 23 | { |
||
| 24 | $this->pool = $pool; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function find(int $uid) |
||
| 28 | { |
||
| 29 | $qb = $this->pool->getConnectionForTable($this->table)->createQueryBuilder(); |
||
| 30 | $qb->select('*')->from($this->table); |
||
| 31 | $qb->where($qb->expr()->eq('uid', ':uid')); |
||
| 32 | $qb->setParameter('uid', $uid); |
||
| 33 | $data = $qb->execute()->fetch(\PDO::FETCH_ASSOC); |
||
| 34 | |||
| 35 | if (\is_array($data)) { |
||
| 36 | return new FrontendUser($data); |
||
| 37 | } |
||
| 38 | |||
| 39 | return null; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function findByUsername(string $username, int $pid) |
||
| 60 | } |
||
| 61 | } |
||
| 62 |