Test Failed
Push — main ( 30c6a0...16fa93 )
by Bingo
05:54
created

DbTenantQueryImpl::executeCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Jabe\Engine\Impl\Identity\Db;
4
5
use Jabe\Engine\Identity\TenantInterface;
6
use Jabe\Engine\Impl\{
7
    Page,
8
    TenantQueryImpl
9
};
10
use Jabe\Engine\Impl\Interceptor\{
11
    CommandContext,
12
    CommandExecutorInterface
13
};
14
15
class DbTenantQueryImpl extends TenantQueryImpl
16
{
17
    public function __construct(CommandExecutorInterface $commandExecutor = null)
18
    {
19
        parent::__construct($commandExecutor);
20
    }
21
22
    public function executeCount(CommandContext $commandContext): int
23
    {
24
        $this->checkQueryOk();
25
        $identityProvider = $this->getIdentityProvider($commandContext);
26
        return $identityProvider->findTenantCountByQueryCriteria($this);
27
    }
28
29
    public function executeList(CommandContext $commandContext, Page $page): array
30
    {
31
        $this->checkQueryOk();
32
        $identityProvider = $this->getIdentityProvider($commandContext);
33
        return $identityProvider->findTenantByQueryCriteria($this);
34
    }
35
36
    private function getIdentityProvider(CommandContext $commandContext): DbReadOnlyIdentityServiceProvider
37
    {
38
        return $commandContext->getReadOnlyIdentityProvider();
39
    }
40
}
41