Passed
Pull Request — master (#10)
by Gocha
11:52
created

FlushingResultIterator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 20
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A handleCycleEnd() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Paysera\Pagination\Service\ODM;
5
6
use Doctrine\Persistence\ObjectManager;
7
use Psr\Log\LoggerInterface;
8
9
class FlushingResultIterator extends ResultIterator
10
{
11
    private $objectManager;
12
13
    public function __construct(
14
        ResultProvider $resultProvider,
15
        LoggerInterface $logger,
16
        int $defaultPageSize,
17
        ObjectManager $objectManager
18
    ) {
19
        parent::__construct($resultProvider, $logger, $defaultPageSize);
20
        $this->objectManager = $objectManager;
21
    }
22
23
    protected function handleCycleEnd()
24
    {
25
        $this->objectManager->flush();
26
        $this->objectManager->clear();
27
    }
28
}
29