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

ExportAssignmentService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 30
rs 10
c 1
b 0
f 1
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getCountOfAllExportableArticles() 0 4 1
A exportBatchOfAllProducts() 0 6 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