MinuboBusinessFactory   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 13
eloc 27
c 1
b 0
f 1
dl 0
loc 121
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A getExportPlugins() 0 3 1
A createOrderItemStateFlagExpander() 0 3 1
A getOrderDataExpandPlugins() 0 3 1
A getCustomerDataExpandPlugins() 0 3 1
A createCustomerDataExporter() 0 7 1
A getFileSystemService() 0 3 1
A getOrderDataFilterPlugins() 0 3 1
A createFileWriter() 0 6 1
A getCustomerDataFilterPlugins() 0 3 1
A createDataExporter() 0 5 1
A createOrderDataExporter() 0 7 1
A getUtilEncodingService() 0 3 1
A getOmsFacade() 0 3 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Minubo\Business;
9
10
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory;
11
use SprykerEco\Zed\Minubo\Business\DataExpander\OrderItemStateFlagExpander;
12
use SprykerEco\Zed\Minubo\Business\DataExpander\OrderItemStateFlagExpanderInterface;
13
use SprykerEco\Zed\Minubo\Business\Exporter\CustomerDataExporter;
14
use SprykerEco\Zed\Minubo\Business\Exporter\DataExporterInterface;
15
use SprykerEco\Zed\Minubo\Business\Exporter\Exporter;
16
use SprykerEco\Zed\Minubo\Business\Exporter\ExporterInterface;
17
use SprykerEco\Zed\Minubo\Business\Exporter\OrderDataExporter;
18
use SprykerEco\Zed\Minubo\Business\Writer\FileWriter;
19
use SprykerEco\Zed\Minubo\Business\Writer\WriterInterface;
20
use SprykerEco\Zed\Minubo\MinuboDependencyProvider;
21
22
/**
23
 * @method \SprykerEco\Zed\Minubo\MinuboConfig getConfig()
24
 * @method \SprykerEco\Zed\Minubo\Persistence\MinuboEntityManagerInterface getEntityManager()
25
 * @method \SprykerEco\Zed\Minubo\Persistence\MinuboRepositoryInterface getRepository()
26
 */
27
class MinuboBusinessFactory extends AbstractBusinessFactory
28
{
29
    /**
30
     * @return \SprykerEco\Zed\Minubo\Business\Exporter\ExporterInterface
31
     */
32
    public function createDataExporter(): ExporterInterface
33
    {
34
        return new Exporter(
35
            $this->getEntityManager(),
36
            $this->getExportPlugins(),
37
        );
38
    }
39
40
    /**
41
     * @return \SprykerEco\Zed\Minubo\Business\Exporter\DataExporterInterface
42
     */
43
    public function createCustomerDataExporter(): DataExporterInterface
44
    {
45
        return new CustomerDataExporter(
46
            $this->getRepository(),
47
            $this->getCustomerDataFilterPlugins(),
48
            $this->getCustomerDataExpandPlugins(),
49
            $this->createFileWriter(),
50
        );
51
    }
52
53
    /**
54
     * @return \SprykerEco\Zed\Minubo\Business\Exporter\DataExporterInterface
55
     */
56
    public function createOrderDataExporter(): DataExporterInterface
57
    {
58
        return new OrderDataExporter(
59
            $this->getRepository(),
60
            $this->getOrderDataFilterPlugins(),
61
            $this->getOrderDataExpandPlugins(),
62
            $this->createFileWriter(),
63
        );
64
    }
65
66
    /**
67
     * @return \SprykerEco\Zed\Minubo\Business\Writer\WriterInterface
68
     */
69
    public function createFileWriter(): WriterInterface
70
    {
71
        return new FileWriter(
72
            $this->getUtilEncodingService(),
73
            $this->getFileSystemService(),
74
            $this->getConfig(),
75
        );
76
    }
77
78
    /**
79
     * @return \SprykerEco\Zed\Minubo\Business\DataExpander\OrderItemStateFlagExpanderInterface
80
     */
81
    public function createOrderItemStateFlagExpander(): OrderItemStateFlagExpanderInterface
82
    {
83
        return new OrderItemStateFlagExpander($this->getOmsFacade());
84
    }
85
86
    /**
87
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface>
88
     */
89
    public function getExportPlugins(): array
90
    {
91
        return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_EXPORT_PLUGINS_STACK);
92
    }
93
94
    /**
95
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface>
96
     */
97
    public function getCustomerDataFilterPlugins(): array
98
    {
99
        return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK);
100
    }
101
102
    /**
103
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface>
104
     */
105
    public function getOrderDataFilterPlugins(): array
106
    {
107
        return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK);
108
    }
109
110
    /**
111
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface>
112
     */
113
    public function getCustomerDataExpandPlugins(): array
114
    {
115
        return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK);
116
    }
117
118
    /**
119
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface>
120
     */
121
    public function getOrderDataExpandPlugins(): array
122
    {
123
        return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK);
124
    }
125
126
    /**
127
     * @return \SprykerEco\Zed\Minubo\Dependency\Service\MinuboToUtilEncodingServiceInterface
128
     */
129
    public function getUtilEncodingService()
130
    {
131
        return $this->getProvidedDependency(MinuboDependencyProvider::SERVICE_UTIL_ENCODING);
132
    }
133
134
    /**
135
     * @return \SprykerEco\Zed\Minubo\Dependency\Service\MinuboToFileSystemServiceInterface
136
     */
137
    public function getFileSystemService()
138
    {
139
        return $this->getProvidedDependency(MinuboDependencyProvider::SERVICE_FILE_SYSTEM);
140
    }
141
142
    /**
143
     * @return \SprykerEco\Zed\Minubo\Dependency\Facade\MinuboToOmsFacadeInterface
144
     */
145
    public function getOmsFacade()
146
    {
147
        return $this->getProvidedDependency(MinuboDependencyProvider::FACADE_OMS);
148
    }
149
}
150