IdentityProviderRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 26
ccs 0
cts 16
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A findByHostname() 0 14 1
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