IdentityProviderRepository::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DMK\MKSamlAuth\Repository;
6
7
use TYPO3\CMS\Core\Database\ConnectionPool;
8
9
final class IdentityProviderRepository
10
{
11
    /**
12
     * @var ConnectionPool
13
     */
14
    private $pool;
15
16
    public function __construct(ConnectionPool $pool)
17
    {
18
        $this->pool = $pool;
19
    }
20
21
    public function findByHostname(string $host)
22
    {
23
        $qb = $this->pool->getConnectionForTable('tx_mksamlauth_domain_model_identityprovider')
24
            ->createQueryBuilder();
25
26
        $qb->select('i.*');
27
        $qb->from('tx_mksamlauth_domain_model_identityprovider', 'i');
28
        $qb->innerJoin('i', 'sys_domain', 'd', 'd.uid = i.domain');
29
        $qb->where($qb->expr()->eq(
30
            'd.domainName',
31
            $qb->createNamedParameter($host)
32
        ));
33
34
        return $qb->execute()->fetch();
35
    }
36
}
37