Passed
Pull Request — master (#35)
by Ihor
14:48
created

ProductLabelGuiCommunicationFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 21
dl 0
loc 57
c 1
b 0
f 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createAssignedProductTable() 0 7 1
A createAvailableProductTable() 0 7 1
A createRelatedProductTableQueryBuilder() 0 7 1
A createRelatedProductOverviewTable() 0 7 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace Pyz\Zed\ProductLabelGui\Communication;
9
10
use Pyz\Zed\ProductLabelGui\Communication\Table\AssignedProductTable;
11
use Pyz\Zed\ProductLabelGui\Communication\Table\AvailableProductTable;
12
use Pyz\Zed\ProductLabelGui\Communication\Table\RelatedProductOverviewTable;
13
use Pyz\Zed\ProductLabelGui\Communication\Table\RelatedProductTableQueryBuilder;
14
use Spryker\Zed\ProductLabelGui\Communication\ProductLabelGuiCommunicationFactory as SprykerProductLabelGuiCommunicationFactory;
15
16
/**
17
 * @method \Spryker\Zed\ProductLabelGui\ProductLabelGuiConfig getConfig()
18
 * @method \Spryker\Zed\ProductLabelGui\Persistence\ProductLabelGuiQueryContainerInterface getQueryContainer()
19
 */
20
class ProductLabelGuiCommunicationFactory extends SprykerProductLabelGuiCommunicationFactory
21
{
22
    /**
23
     * @param int|null $idProductLabel
24
     *
25
     * @return \Pyz\Zed\ProductLabelGui\Communication\Table\AvailableProductTable
26
     */
27
    public function createAvailableProductTable($idProductLabel = null)
28
    {
29
        return new AvailableProductTable(
30
            $this->createRelatedProductTableQueryBuilder(),
31
            $this->getMoneyFacade(),
32
            $idProductLabel,
33
            $this->getPriceProductFacade()
34
        );
35
    }
36
37
    /**
38
     * @param int|null $idProductLabel
39
     *
40
     * @return \Pyz\Zed\ProductLabelGui\Communication\Table\AssignedProductTable
41
     */
42
    public function createAssignedProductTable($idProductLabel = null)
43
    {
44
        return new AssignedProductTable(
45
            $this->createRelatedProductTableQueryBuilder(),
46
            $this->getMoneyFacade(),
47
            $idProductLabel,
48
            $this->getPriceProductFacade()
49
        );
50
    }
51
52
    /**
53
     * @param int $idProductLabel
54
     *
55
     * @return \Spryker\Zed\ProductLabelGui\Communication\Table\RelatedProductOverviewTable
56
     */
57
    public function createRelatedProductOverviewTable($idProductLabel)
58
    {
59
        return new RelatedProductOverviewTable(
60
            $this->createRelatedProductTableQueryBuilder(),
61
            $this->getMoneyFacade(),
62
            $idProductLabel,
63
            $this->getPriceProductFacade()
64
        );
65
    }
66
67
    /**
68
     * @return \Spryker\Zed\ProductLabelGui\Communication\Table\RelatedProductTableQueryBuilderInterface
69
     */
70
    public function createRelatedProductTableQueryBuilder()
71
    {
72
        return new RelatedProductTableQueryBuilder(
73
            $this->getProductQueryContainer(),
74
            $this->getQueryContainer(),
75
            $this->getLocaleFacade(),
76
            $this->getConfig()
77
        );
78
    }
79
}
80