Completed
Pull Request — master (#46)
by Tim
04:42
created

ProductAttributeObserver   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 63
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A persistVarcharAttribute() 0 4 1
A persistIntAttribute() 0 4 1
A persistDecimalAttribute() 0 4 1
A persistDatetimeAttribute() 0 4 1
A persistTextAttribute() 0 4 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Observers\ProductAttributeObserver
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-product
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Product\Observers;
22
23
use TechDivision\Import\Observers\AbstractAttributeObserver;
24
25
/**
26
 * Observer that creates/updates the product's attributes.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2016 TechDivision GmbH <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      https://github.com/techdivision/import-product
32
 * @link      http://www.techdivision.com
33
 */
34
class ProductAttributeObserver extends AbstractAttributeObserver
35
{
36
37
    /**
38
     * Persist's the passed varchar attribute.
39
     *
40
     * @param array $attribute The attribute to persist
41
     *
42
     * @return void
43
     */
44
    protected function persistVarcharAttribute($attribute)
45
    {
46
        $this->getSubject()->persistProductVarcharAttribute($attribute);
47
    }
48
49
    /**
50
     * Persist's the passed integer attribute.
51
     *
52
     * @param array $attribute The attribute to persist
53
     *
54
     * @return void
55
     */
56
    protected function persistIntAttribute($attribute)
57
    {
58
        $this->getSubject()->persistProductIntAttribute($attribute);
59
    }
60
61
    /**
62
     * Persist's the passed decimal attribute.
63
     *
64
     * @param array $attribute The attribute to persist
65
     *
66
     * @return void
67
     */
68
    protected function persistDecimalAttribute($attribute)
69
    {
70
        $this->getSubject()->persistProductDecimalAttribute($attribute);
71
    }
72
73
    /**
74
     * Persist's the passed datetime attribute.
75
     *
76
     * @param array $attribute The attribute to persist
77
     *
78
     * @return void
79
     */
80
    protected function persistDatetimeAttribute($attribute)
81
    {
82
        $this->getSubject()->persistProductDatetimeAttribute($attribute);
83
    }
84
85
    /**
86
     * Persist's the passed text attribute.
87
     *
88
     * @param array $attribute The attribute to persist
89
     *
90
     * @return void
91
     */
92
    protected function persistTextAttribute($attribute)
93
    {
94
        $this->getSubject()->persistProductTextAttribute($attribute);
95
    }
96
}
97