Magic360ColumnsUpdateObserver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A initializeMagic360Columns() 0 14 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Magic360\Observers\Magic360ColumnsUpdateObserver
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
 * @author    Bernhard Wick <[email protected]>
16
 * @copyright 2017 TechDivision GmbH <[email protected]>
17
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
 * @link      https://github.com/techdivision/import-product-magic360
19
 * @link      http://www.techdivision.com
20
 */
21
22
namespace TechDivision\Import\Product\Magic360\Observers;
23
24
use TechDivision\Import\Product\Magic360\Utils\MemberNames;
25
26
/**
27
 * Observer that creates/updates the magic360 columns information.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @author    Bernhard Wick <[email protected]>
31
 * @copyright 2017 TechDivision GmbH <[email protected]>
32
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
33
 * @link      https://github.com/techdivision/import-product-magic360
34
 * @link      http://www.techdivision.com
35
 */
36
class Magic360ColumnsUpdateObserver extends Magic360ColumnsObserver
37
{
38
39
    /**
40
     * Initialize the magic360 column with the passed attributes and returns an instance.
41
     *
42
     * @param array $attr The product media gallery value attributes
43
     *
44
     * @return array The initialized product media gallery value
45
     */
46
    protected function initializeMagic360Columns(array $attr)
47
    {
48
49
        // load the product ID
50
        $productId = $attr[MemberNames::PRODUCT_ID];
51
52
        // query whether the product media gallery value already exists or not
53
        if ($entity = $this->getProductMagic360Processor()->loadMagic360Columns($productId)) {
0 ignored issues
show
Bug introduced by
The method loadMagic360Columns() does not seem to exist on object<TechDivision\Impo...unchProcessorInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
54
            return $this->mergeEntity($entity, $attr);
55
        }
56
57
        // simply return the attributes
58
        return $attr;
59
    }
60
}
61