Passed
Pull Request — master (#1975)
by Janko
19:23 queued 09:07
created

EntityManagerFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Stu\Orm\Transaction;
4
5
use Doctrine\DBAL\Connection;
6
use Doctrine\ORM\Configuration;
7
use Doctrine\ORM\EntityManager;
8
use Doctrine\ORM\EntityManagerInterface;
9
10
class EntityManagerFactory implements EntityManagerFactoryInterface
11
{
12 2
    public function __construct(
13
        private ConnectionFactoryInterface $connectionFactory,
14
        private Configuration $configuration
15 2
    ) {}
16
17 2
    public function createEntityManager(Connection $connection = null): EntityManagerInterface
18
    {
19 2
        return new EntityManager(
20 2
            $connection ?? $this->connectionFactory->createConnection(),
21 2
            $this->configuration
22 2
        );
23
    }
24
}
25