Test Failed
Push — main ( c7561b...fa446d )
by Bingo
15:52
created

DbEntityManagerFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 18
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSessionType() 0 3 1
A openSession() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
namespace Jabe\Engine\Impl\Db\EntityManager;
4
5
use Jabe\Engine\Impl\Cfg\IdGeneratorInterface;
6
use Jabe\Engine\Impl\Context\Context;
7
use Jabe\Engine\Impl\Db\PersistenceSessionInterface;
8
use Jabe\Engine\Impl\Interceptor\SessionFactoryInterface;
9
10
class DbEntityManagerFactory implements SessionFactoryInterface
11
{
12
    protected $idGenerator;
13
14
    public function __construct(IdGeneratorInterface $idGenerator)
15
    {
16
        $this->idGenerator = $idGenerator;
17
    }
18
19
    public function getSessionType(): string
20
    {
21
        return DbEntityManager::class;
22
    }
23
24
    public function openSession(): DbEntityManager
25
    {
26
        $persistenceSession = Context::getCommandContext()->getSession(PersistenceSessionInterface::class);
27
        return new DbEntityManager($idGenerator, $persistenceSession);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $idGenerator seems to be never defined.
Loading history...
28
    }
29
}
30