Completed
Pull Request — master (#399)
by Christian
03:10
created

getCountOfAllExportableArticles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 1
1
<?php
2
/**
3
 * (c) shopware AG <[email protected]>
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace ShopwarePlugins\Connect\Services;
9
10
use Shopware\CustomModels\Connect\AttributeRepository;
11
use ShopwarePlugins\Connect\Components\ConnectExport;
12
13
class ExportAssignmentService
14
{
15
    /**
16
     * @var AttributeRepository
17
     */
18
    private $attributeRepo;
19
20
    /**
21
     * @var ConnectExport
22
     */
23
    private $export;
24
25
    public function __construct(AttributeRepository $attributeRepository, ConnectExport $connectExport)
26
    {
27
        $this->attributeRepo = $attributeRepository;
28
        $this->export = $connectExport;
29
    }
30
31
    public function getCountOfAllExportableArticles()
32
    {
33
        return $this->attributeRepo->getLocalArticleCount();
34
    }
35
36
    public function exportBatchOfAllProducts($offset, $batchSize)
37
    {
38
        $sourceIds = $this->attributeRepo->findAllSourceIds($offset, $batchSize);
39
40
        return $this->export->export($sourceIds);
41
    }
42
}
43