Completed
Push — 15.x ( b45baa...4ca9b4 )
by Tim
02:13
created

SimpleStateDetector::detect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Observers\StateDetectors\SimpleStateDetector
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 2019 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
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Observers\StateDetectors;
22
23
use TechDivision\Import\Utils\EntityStatus;
24
use TechDivision\Import\Observers\ObserverInterface;
25
use TechDivision\Import\Observers\StateDetectorInterface;
26
27
/**
28
 * Simple state detector implementation.
29
 *
30
 * @author    Tim Wagner <[email protected]>
31
 * @copyright 2019 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
34
 * @link      http://www.techdivision.com
35
 */
36
class SimpleStateDetector implements StateDetectorInterface
37
{
38
39
    /**
40
     * Detect's and return's the entity state on the specific entity conditions and return's it.
41
     *
42
     * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer instance to detect the state for
43
     * @param array                                            $entity   The entity loaded from the database
44
     * @param array                                            $attr     The entity data from the import file
45
     *
46
     * @return string The detected entity state
47
     */
48
    public function detect(ObserverInterface $observer, array $entity, array $attr)
49
    {
50
        return EntityStatus::STATUS_UPDATE;
51
    }
52
}
53