| Total Complexity | 8 | 
| Total Lines | 47 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 9 | class ReopeningEntityManager extends EntityManagerDecorator  | 
            ||
| 10 | { | 
            ||
| 11 | /** @var callable */  | 
            ||
| 12 | private $emFactory;  | 
            ||
| 13 | |||
| 14 | 11 | public function __construct(EntityManagerInterface $wrapped, callable $emFactory)  | 
            |
| 15 |     { | 
            ||
| 16 | 11 | parent::__construct($wrapped);  | 
            |
| 17 | 11 | $this->emFactory = $emFactory;  | 
            |
| 18 | }  | 
            ||
| 19 | |||
| 20 | 10 | protected function getWrappedEntityManager(): EntityManagerInterface  | 
            |
| 21 |     { | 
            ||
| 22 | 10 |         if (! $this->wrapped->isOpen()) { | 
            |
| 23 | 5 | $this->wrapped = ($this->emFactory)(  | 
            |
| 24 | 5 | $this->wrapped->getConnection(),  | 
            |
| 25 | 5 | $this->wrapped->getConfiguration(),  | 
            |
| 26 | 5 | $this->wrapped->getEventManager()  | 
            |
| 27 | );  | 
            ||
| 28 | }  | 
            ||
| 29 | |||
| 30 | 10 | return $this->wrapped;  | 
            |
| 31 | }  | 
            ||
| 32 | |||
| 33 | 2 | public function flush($entity = null): void  | 
            |
| 34 |     { | 
            ||
| 35 | 2 | $this->getWrappedEntityManager()->flush($entity);  | 
            |
| 36 | }  | 
            ||
| 37 | |||
| 38 | 2 | public function persist($object): void  | 
            |
| 39 |     { | 
            ||
| 40 | 2 | $this->getWrappedEntityManager()->persist($object);  | 
            |
| 41 | }  | 
            ||
| 42 | |||
| 43 | 2 | public function remove($object): void  | 
            |
| 46 | }  | 
            ||
| 47 | |||
| 48 | 2 | public function refresh($object): void  | 
            |
| 49 |     { | 
            ||
| 50 | 2 | $this->getWrappedEntityManager()->refresh($object);  | 
            |
| 51 | }  | 
            ||
| 52 | |||
| 53 | 2 | public function merge($object)  | 
            |
| 56 | }  | 
            ||
| 57 | }  | 
            ||
| 58 |